| Remi NGUYEN VAN | 11f162b | 2022-05-24 16:47:33 +0900 | [diff] [blame] | 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 |  | 
|  | 17 | package { | 
| Aditya Choudhary | 01b5ede | 2024-01-31 11:08:57 +0000 | [diff] [blame] | 18 | default_team: "trendy_team_fwk_core_networking", | 
| Remi NGUYEN VAN | 11f162b | 2022-05-24 16:47:33 +0900 | [diff] [blame] | 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. | 
|  | 25 | python_binary_host { | 
|  | 26 | name: "jarjar-rules-generator", | 
|  | 27 | srcs: [ | 
|  | 28 | "gen_jarjar.py", | 
|  | 29 | ], | 
|  | 30 | main: "gen_jarjar.py", | 
| Remi NGUYEN VAN | 11f162b | 2022-05-24 16:47:33 +0900 | [diff] [blame] | 31 | visibility: ["//packages/modules/Connectivity:__subpackages__"], | 
|  | 32 | } | 
|  | 33 |  | 
|  | 34 | genrule_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 |  | 
|  | 41 | java_library { | 
|  | 42 | name: "jarjar-rules-generator-testjavalib", | 
|  | 43 | srcs: ["testdata/java/**/*.java"], | 
| Remi NGUYEN VAN | 0bd90f1 | 2022-08-10 20:15:46 +0900 | [diff] [blame] | 44 | libs: ["unsupportedappusage"], | 
| Zhi Dou | e521ae3 | 2024-02-19 18:36:40 +0000 | [diff] [blame] | 45 | sdk_version: "core_platform", | 
| Remi NGUYEN VAN | 11f162b | 2022-05-24 16:47:33 +0900 | [diff] [blame] | 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. | 
|  | 54 | java_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 Dou | e521ae3 | 2024-02-19 18:36:40 +0000 | [diff] [blame] | 60 | sdk_version: "module_current", | 
| Remi NGUYEN VAN | 11f162b | 2022-05-24 16:47:33 +0900 | [diff] [blame] | 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 |  | 
| Remi NGUYEN VAN | 0bd90f1 | 2022-08-10 20:15:46 +0900 | [diff] [blame] | 66 | java_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 Dou | e521ae3 | 2024-02-19 18:36:40 +0000 | [diff] [blame] | 72 | sdk_version: "module_current", | 
| Remi NGUYEN VAN | 0bd90f1 | 2022-08-10 20:15:46 +0900 | [diff] [blame] | 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 |  | 
| Remi NGUYEN VAN | 11f162b | 2022-05-24 16:47:33 +0900 | [diff] [blame] | 78 | python_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 Olibie | aa44ef3 | 2023-03-23 10:32:45 +0000 | [diff] [blame] | 86 | // txt with Test classes to test they aren't included when added to jarjar excludes | 
|  | 87 | "testdata/test-jarjar-excludes-testclass.txt", | 
| Remi NGUYEN VAN | 0bd90f1 | 2022-08-10 20:15:46 +0900 | [diff] [blame] | 88 | // two unsupportedappusage lists with different classes to test using multiple lists | 
| Remi NGUYEN VAN | 11f162b | 2022-05-24 16:47:33 +0900 | [diff] [blame] | 89 | "testdata/test-unsupportedappusage.txt", | 
| Remi NGUYEN VAN | 0bd90f1 | 2022-08-10 20:15:46 +0900 | [diff] [blame] | 90 | "testdata/test-other-unsupportedappusage.txt", | 
| Remi NGUYEN VAN | 11f162b | 2022-05-24 16:47:33 +0900 | [diff] [blame] | 91 | ":framework-connectivity.stubs.module_lib-for-test", | 
| Remi NGUYEN VAN | 0bd90f1 | 2022-08-10 20:15:46 +0900 | [diff] [blame] | 92 | ":framework-connectivity-t.stubs.module_lib-for-test", | 
| Remi NGUYEN VAN | 11f162b | 2022-05-24 16:47:33 +0900 | [diff] [blame] | 93 | ":jarjar-rules-generator-testjavalib", | 
|  | 94 | ], | 
|  | 95 | main: "gen_jarjar_test.py", | 
| Remi NGUYEN VAN | 11f162b | 2022-05-24 16:47:33 +0900 | [diff] [blame] | 96 | } |