| 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 { | 
|  | 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. | 
|  | 24 | python_binary_host { | 
|  | 25 | name: "jarjar-rules-generator", | 
|  | 26 | srcs: [ | 
|  | 27 | "gen_jarjar.py", | 
|  | 28 | ], | 
|  | 29 | main: "gen_jarjar.py", | 
| Remi NGUYEN VAN | 11f162b | 2022-05-24 16:47:33 +0900 | [diff] [blame] | 30 | visibility: ["//packages/modules/Connectivity:__subpackages__"], | 
|  | 31 | } | 
|  | 32 |  | 
|  | 33 | genrule_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 |  | 
|  | 40 | java_library { | 
|  | 41 | name: "jarjar-rules-generator-testjavalib", | 
|  | 42 | srcs: ["testdata/java/**/*.java"], | 
| Remi NGUYEN VAN | 0bd90f1 | 2022-08-10 20:15:46 +0900 | [diff] [blame] | 43 | libs: ["unsupportedappusage"], | 
| Remi NGUYEN VAN | 11f162b | 2022-05-24 16:47:33 +0900 | [diff] [blame] | 44 | 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. | 
|  | 52 | java_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 VAN | 0bd90f1 | 2022-08-10 20:15:46 +0900 | [diff] [blame] | 63 | java_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 VAN | 11f162b | 2022-05-24 16:47:33 +0900 | [diff] [blame] | 74 | python_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", | 
| Remi NGUYEN VAN | 0bd90f1 | 2022-08-10 20:15:46 +0900 | [diff] [blame] | 82 | // two unsupportedappusage lists with different classes to test using multiple lists | 
| Remi NGUYEN VAN | 11f162b | 2022-05-24 16:47:33 +0900 | [diff] [blame] | 83 | "testdata/test-unsupportedappusage.txt", | 
| Remi NGUYEN VAN | 0bd90f1 | 2022-08-10 20:15:46 +0900 | [diff] [blame] | 84 | "testdata/test-other-unsupportedappusage.txt", | 
| Remi NGUYEN VAN | 11f162b | 2022-05-24 16:47:33 +0900 | [diff] [blame] | 85 | ":framework-connectivity.stubs.module_lib-for-test", | 
| Remi NGUYEN VAN | 0bd90f1 | 2022-08-10 20:15:46 +0900 | [diff] [blame] | 86 | ":framework-connectivity-t.stubs.module_lib-for-test", | 
| Remi NGUYEN VAN | 11f162b | 2022-05-24 16:47:33 +0900 | [diff] [blame] | 87 | ":jarjar-rules-generator-testjavalib", | 
|  | 88 | ], | 
|  | 89 | main: "gen_jarjar_test.py", | 
| Remi NGUYEN VAN | 11f162b | 2022-05-24 16:47:33 +0900 | [diff] [blame] | 90 | } |