blob: 1fa93bb7e196ff5224cbd766571394c9a047cba3 [file] [log] [blame]
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +09001//
2// Copyright (C) 2022 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17package {
18 // See: http://go/android-license-faq
19 default_applicable_licenses: ["Android-Apache-2.0"],
20}
21
22// Build tool used to generate jarjar rules for all classes in a jar, except those that are
23// API, UnsupportedAppUsage or otherwise excluded.
24python_binary_host {
25 name: "jarjar-rules-generator",
26 srcs: [
27 "gen_jarjar.py",
28 ],
29 main: "gen_jarjar.py",
30 version: {
31 py2: {
32 enabled: false,
33 },
34 py3: {
35 enabled: true,
36 },
37 },
38 visibility: ["//packages/modules/Connectivity:__subpackages__"],
39}
40
41genrule_defaults {
42 name: "jarjar-rules-combine-defaults",
43 // Concat files with a line break in the middle
44 cmd: "for src in $(in); do cat $${src}; echo; done > $(out)",
45 defaults_visibility: ["//packages/modules/Connectivity:__subpackages__"],
46}
47
48java_library {
49 name: "jarjar-rules-generator-testjavalib",
50 srcs: ["testdata/java/**/*.java"],
51 visibility: ["//visibility:private"],
52}
53
54// TODO(b/233723405) - Remove this workaround.
55// Temporary work around of b/233723405. Using the module_lib stub directly
56// in the test causes it to sometimes get the dex jar and sometimes get the
57// classes jar due to b/233111644. Statically including it here instead
58// ensures that it will always get the classes jar.
59java_library {
60 name: "framework-connectivity.stubs.module_lib-for-test",
61 visibility: ["//visibility:private"],
62 static_libs: [
63 "framework-connectivity.stubs.module_lib",
64 ],
65 // Not strictly necessary but specified as this MUST not have generate
66 // a dex jar as that will break the tests.
67 compile_dex: false,
68}
69
70python_test_host {
71 name: "jarjar-rules-generator-test",
72 srcs: [
73 "gen_jarjar.py",
74 "gen_jarjar_test.py",
75 ],
76 data: [
77 "testdata/test-jarjar-excludes.txt",
78 "testdata/test-unsupportedappusage.txt",
79 ":framework-connectivity.stubs.module_lib-for-test",
80 ":jarjar-rules-generator-testjavalib",
81 ],
82 main: "gen_jarjar_test.py",
83 version: {
84 py2: {
85 enabled: false,
86 },
87 py3: {
88 enabled: true,
89 },
90 },
91}