blob: 9cc65e0f03be3d028af2238b588e3e140eabdd1e [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",
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090030 visibility: ["//packages/modules/Connectivity:__subpackages__"],
31}
32
33genrule_defaults {
34 name: "jarjar-rules-combine-defaults",
35 // Concat files with a line break in the middle
36 cmd: "for src in $(in); do cat $${src}; echo; done > $(out)",
37 defaults_visibility: ["//packages/modules/Connectivity:__subpackages__"],
38}
39
40java_library {
41 name: "jarjar-rules-generator-testjavalib",
42 srcs: ["testdata/java/**/*.java"],
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +090043 libs: ["unsupportedappusage"],
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090044 visibility: ["//visibility:private"],
45}
46
47// TODO(b/233723405) - Remove this workaround.
48// Temporary work around of b/233723405. Using the module_lib stub directly
49// in the test causes it to sometimes get the dex jar and sometimes get the
50// classes jar due to b/233111644. Statically including it here instead
51// ensures that it will always get the classes jar.
52java_library {
53 name: "framework-connectivity.stubs.module_lib-for-test",
54 visibility: ["//visibility:private"],
55 static_libs: [
56 "framework-connectivity.stubs.module_lib",
57 ],
58 // Not strictly necessary but specified as this MUST not have generate
59 // a dex jar as that will break the tests.
60 compile_dex: false,
61}
62
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +090063java_library {
64 name: "framework-connectivity-t.stubs.module_lib-for-test",
65 visibility: ["//visibility:private"],
66 static_libs: [
67 "framework-connectivity-t.stubs.module_lib",
68 ],
69 // Not strictly necessary but specified as this MUST not have generate
70 // a dex jar as that will break the tests.
71 compile_dex: false,
72}
73
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090074python_test_host {
75 name: "jarjar-rules-generator-test",
76 srcs: [
77 "gen_jarjar.py",
78 "gen_jarjar_test.py",
79 ],
80 data: [
81 "testdata/test-jarjar-excludes.txt",
Chidera Olibieaa44ef32023-03-23 10:32:45 +000082 // txt with Test classes to test they aren't included when added to jarjar excludes
83 "testdata/test-jarjar-excludes-testclass.txt",
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +090084 // two unsupportedappusage lists with different classes to test using multiple lists
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090085 "testdata/test-unsupportedappusage.txt",
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +090086 "testdata/test-other-unsupportedappusage.txt",
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090087 ":framework-connectivity.stubs.module_lib-for-test",
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +090088 ":framework-connectivity-t.stubs.module_lib-for-test",
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090089 ":jarjar-rules-generator-testjavalib",
90 ],
91 main: "gen_jarjar_test.py",
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090092}