1// 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 default_team: "trendy_team_fwk_core_networking", 19 // 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", 31 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"], 44 libs: ["unsupportedappusage"], 45 sdk_version: "core_platform", 46 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 ], 60 sdk_version: "module_current", 61 // 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 66java_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 ], 72 sdk_version: "module_current", 73 // 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 78python_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", 86 // txt with Test classes to test they aren't included when added to jarjar excludes 87 "testdata/test-jarjar-excludes-testclass.txt", 88 // two unsupportedappusage lists with different classes to test using multiple lists 89 "testdata/test-unsupportedappusage.txt", 90 "testdata/test-other-unsupportedappusage.txt", 91 ":framework-connectivity.stubs.module_lib-for-test", 92 ":framework-connectivity-t.stubs.module_lib-for-test", 93 ":jarjar-rules-generator-testjavalib", 94 ], 95 main: "gen_jarjar_test.py", 96} 97