blob: 2c2ed148aeead4956c2279a5b71002832eafe74f [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 {
Aditya Choudhary01b5ede2024-01-31 11:08:57 +000018 default_team: "trendy_team_fwk_core_networking",
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090019 // See: http://go/android-license-faq
20 default_applicable_licenses: ["Android-Apache-2.0"],
21}
22
23// Build tool used to generate jarjar rules for all classes in a jar, except those that are
24// API, UnsupportedAppUsage or otherwise excluded.
25python_binary_host {
26 name: "jarjar-rules-generator",
27 srcs: [
28 "gen_jarjar.py",
29 ],
30 main: "gen_jarjar.py",
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090031 visibility: ["//packages/modules/Connectivity:__subpackages__"],
32}
33
34genrule_defaults {
35 name: "jarjar-rules-combine-defaults",
36 // Concat files with a line break in the middle
37 cmd: "for src in $(in); do cat $${src}; echo; done > $(out)",
38 defaults_visibility: ["//packages/modules/Connectivity:__subpackages__"],
39}
40
41java_library {
42 name: "jarjar-rules-generator-testjavalib",
43 srcs: ["testdata/java/**/*.java"],
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +090044 libs: ["unsupportedappusage"],
Zhi Doue521ae32024-02-19 18:36:40 +000045 sdk_version: "core_platform",
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090046 visibility: ["//visibility:private"],
47}
48
49// TODO(b/233723405) - Remove this workaround.
50// Temporary work around of b/233723405. Using the module_lib stub directly
51// in the test causes it to sometimes get the dex jar and sometimes get the
52// classes jar due to b/233111644. Statically including it here instead
53// ensures that it will always get the classes jar.
54java_library {
55 name: "framework-connectivity.stubs.module_lib-for-test",
56 visibility: ["//visibility:private"],
57 static_libs: [
58 "framework-connectivity.stubs.module_lib",
59 ],
Zhi Doue521ae32024-02-19 18:36:40 +000060 sdk_version: "module_current",
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090061 // Not strictly necessary but specified as this MUST not have generate
62 // a dex jar as that will break the tests.
63 compile_dex: false,
64}
65
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +090066java_library {
67 name: "framework-connectivity-t.stubs.module_lib-for-test",
68 visibility: ["//visibility:private"],
69 static_libs: [
70 "framework-connectivity-t.stubs.module_lib",
71 ],
Zhi Doue521ae32024-02-19 18:36:40 +000072 sdk_version: "module_current",
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +090073 // Not strictly necessary but specified as this MUST not have generate
74 // a dex jar as that will break the tests.
75 compile_dex: false,
76}
77
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090078python_test_host {
79 name: "jarjar-rules-generator-test",
80 srcs: [
81 "gen_jarjar.py",
82 "gen_jarjar_test.py",
83 ],
84 data: [
85 "testdata/test-jarjar-excludes.txt",
Chidera Olibieaa44ef32023-03-23 10:32:45 +000086 // txt with Test classes to test they aren't included when added to jarjar excludes
87 "testdata/test-jarjar-excludes-testclass.txt",
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +090088 // two unsupportedappusage lists with different classes to test using multiple lists
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090089 "testdata/test-unsupportedappusage.txt",
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +090090 "testdata/test-other-unsupportedappusage.txt",
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090091 ":framework-connectivity.stubs.module_lib-for-test",
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +090092 ":framework-connectivity-t.stubs.module_lib-for-test",
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090093 ":jarjar-rules-generator-testjavalib",
94 ],
95 main: "gen_jarjar_test.py",
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090096}