blob: b7b2aaafd595253f799d57efa6f8981fa71019d6 [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"],
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090045 visibility: ["//visibility:private"],
46}
47
48// TODO(b/233723405) - Remove this workaround.
49// Temporary work around of b/233723405. Using the module_lib stub directly
50// in the test causes it to sometimes get the dex jar and sometimes get the
51// classes jar due to b/233111644. Statically including it here instead
52// ensures that it will always get the classes jar.
53java_library {
54 name: "framework-connectivity.stubs.module_lib-for-test",
55 visibility: ["//visibility:private"],
56 static_libs: [
57 "framework-connectivity.stubs.module_lib",
58 ],
59 // Not strictly necessary but specified as this MUST not have generate
60 // a dex jar as that will break the tests.
61 compile_dex: false,
62}
63
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +090064java_library {
65 name: "framework-connectivity-t.stubs.module_lib-for-test",
66 visibility: ["//visibility:private"],
67 static_libs: [
68 "framework-connectivity-t.stubs.module_lib",
69 ],
70 // Not strictly necessary but specified as this MUST not have generate
71 // a dex jar as that will break the tests.
72 compile_dex: false,
73}
74
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090075python_test_host {
76 name: "jarjar-rules-generator-test",
77 srcs: [
78 "gen_jarjar.py",
79 "gen_jarjar_test.py",
80 ],
81 data: [
82 "testdata/test-jarjar-excludes.txt",
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +090083 // two unsupportedappusage lists with different classes to test using multiple lists
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090084 "testdata/test-unsupportedappusage.txt",
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +090085 "testdata/test-other-unsupportedappusage.txt",
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090086 ":framework-connectivity.stubs.module_lib-for-test",
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +090087 ":framework-connectivity-t.stubs.module_lib-for-test",
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090088 ":jarjar-rules-generator-testjavalib",
89 ],
90 main: "gen_jarjar_test.py",
Remi NGUYEN VAN11f162b2022-05-24 16:47:33 +090091}