blob: 7d6b24843a9bda668c67780fc2ccf9d65b235c80 [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"],
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +090051 libs: ["unsupportedappusage"],
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090052 visibility: ["//visibility:private"],
53}
54
55// TODO(b/233723405) - Remove this workaround.
56// Temporary work around of b/233723405. Using the module_lib stub directly
57// in the test causes it to sometimes get the dex jar and sometimes get the
58// classes jar due to b/233111644. Statically including it here instead
59// ensures that it will always get the classes jar.
60java_library {
61 name: "framework-connectivity.stubs.module_lib-for-test",
62 visibility: ["//visibility:private"],
63 static_libs: [
64 "framework-connectivity.stubs.module_lib",
65 ],
66 // Not strictly necessary but specified as this MUST not have generate
67 // a dex jar as that will break the tests.
68 compile_dex: false,
69}
70
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +090071java_library {
72 name: "framework-connectivity-t.stubs.module_lib-for-test",
73 visibility: ["//visibility:private"],
74 static_libs: [
75 "framework-connectivity-t.stubs.module_lib",
76 ],
77 // Not strictly necessary but specified as this MUST not have generate
78 // a dex jar as that will break the tests.
79 compile_dex: false,
80}
81
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090082python_test_host {
83 name: "jarjar-rules-generator-test",
84 srcs: [
85 "gen_jarjar.py",
86 "gen_jarjar_test.py",
87 ],
88 data: [
89 "testdata/test-jarjar-excludes.txt",
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +090090 // two unsupportedappusage lists with different classes to test using multiple lists
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090091 "testdata/test-unsupportedappusage.txt",
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +090092 "testdata/test-other-unsupportedappusage.txt",
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090093 ":framework-connectivity.stubs.module_lib-for-test",
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +090094 ":framework-connectivity-t.stubs.module_lib-for-test",
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090095 ":jarjar-rules-generator-testjavalib",
96 ],
97 main: "gen_jarjar_test.py",
98 version: {
99 py2: {
100 enabled: false,
101 },
102 py3: {
103 enabled: true,
104 },
105 },
106}