Jared Duke | 230d650 | 2024-07-31 21:35:24 +0000 | [diff] [blame] | 1 | package { |
| 2 | // See: http://go/android-license-faq |
| 3 | // A large-scale-change added 'default_applicable_licenses' to import |
| 4 | // all of the 'license_kinds' from "frameworks_base_license" |
| 5 | // to get the below license kinds: |
| 6 | // SPDX-license-identifier-Apache-2.0 |
| 7 | default_applicable_licenses: ["frameworks_base_license"], |
Jared Duke | 2d1a832 | 2024-08-23 22:17:09 +0000 | [diff] [blame] | 8 | default_team: "trendy_team_system_performance", |
Jared Duke | 230d650 | 2024-07-31 21:35:24 +0000 | [diff] [blame] | 9 | } |
| 10 | |
| 11 | java_library_host { |
| 12 | name: "systemfeatures-gen-lib", |
| 13 | srcs: [ |
| 14 | "src/**/*.java", |
| 15 | "src/**/*.kt", |
Jared Duke | 13519f0 | 2024-11-21 22:36:12 +0000 | [diff] [blame] | 16 | ":framework-metalava-annotations", |
Jared Duke | 230d650 | 2024-07-31 21:35:24 +0000 | [diff] [blame] | 17 | ], |
| 18 | static_libs: [ |
| 19 | "guava", |
| 20 | "javapoet", |
| 21 | ], |
| 22 | } |
| 23 | |
| 24 | java_binary_host { |
| 25 | name: "systemfeatures-gen-tool", |
| 26 | main_class: "com.android.systemfeatures.SystemFeaturesGenerator", |
| 27 | static_libs: ["systemfeatures-gen-lib"], |
| 28 | } |
| 29 | |
Jared Duke | 13519f0 | 2024-11-21 22:36:12 +0000 | [diff] [blame] | 30 | java_plugin { |
| 31 | name: "systemfeatures-metadata-processor", |
| 32 | processor_class: "com.android.systemfeatures.SystemFeaturesMetadataProcessor", |
| 33 | static_libs: ["systemfeatures-gen-lib"], |
| 34 | } |
| 35 | |
Jared Duke | 230d650 | 2024-07-31 21:35:24 +0000 | [diff] [blame] | 36 | genrule { |
| 37 | name: "systemfeatures-gen-tests-srcs", |
| 38 | cmd: "$(location systemfeatures-gen-tool) com.android.systemfeatures.RwNoFeatures --readonly=false > $(location RwNoFeatures.java) && " + |
Jared Duke | 97ffe12 | 2024-08-19 23:30:28 +0000 | [diff] [blame] | 39 | "$(location systemfeatures-gen-tool) com.android.systemfeatures.RoNoFeatures --readonly=true --feature-apis=WATCH > $(location RoNoFeatures.java) && " + |
Jared Duke | 90e4363 | 2024-09-20 17:05:02 +0000 | [diff] [blame] | 40 | "$(location systemfeatures-gen-tool) com.android.systemfeatures.RwFeatures --readonly=false --feature=WATCH:1 --feature=WIFI:0 --feature=VULKAN:UNAVAILABLE --feature=AUTO: > $(location RwFeatures.java) && " + |
| 41 | "$(location systemfeatures-gen-tool) com.android.systemfeatures.RoFeatures --readonly=true --feature=WATCH:1 --feature=WIFI:0 --feature=VULKAN:UNAVAILABLE --feature=AUTO: --feature-apis=WATCH,PC > $(location RoFeatures.java)", |
Jared Duke | 230d650 | 2024-07-31 21:35:24 +0000 | [diff] [blame] | 42 | out: [ |
| 43 | "RwNoFeatures.java", |
| 44 | "RoNoFeatures.java", |
| 45 | "RwFeatures.java", |
| 46 | "RoFeatures.java", |
| 47 | ], |
| 48 | tools: ["systemfeatures-gen-tool"], |
| 49 | } |
| 50 | |
Jared Duke | 2d1a832 | 2024-08-23 22:17:09 +0000 | [diff] [blame] | 51 | // Functional runtime behavior testing. |
Jared Duke | 230d650 | 2024-07-31 21:35:24 +0000 | [diff] [blame] | 52 | java_test_host { |
| 53 | name: "systemfeatures-gen-tests", |
| 54 | test_suites: ["general-tests"], |
| 55 | srcs: [ |
Jared Duke | 2d1a832 | 2024-08-23 22:17:09 +0000 | [diff] [blame] | 56 | "tests/src/**/*.java", |
Jared Duke | 230d650 | 2024-07-31 21:35:24 +0000 | [diff] [blame] | 57 | ":systemfeatures-gen-tests-srcs", |
| 58 | ], |
| 59 | test_options: { |
| 60 | unit_test: true, |
| 61 | }, |
| 62 | static_libs: [ |
| 63 | "aconfig-annotations-lib", |
| 64 | "framework-annotations-lib", |
| 65 | "junit", |
| 66 | "objenesis", |
| 67 | "mockito", |
Jared Duke | f0e69b8 | 2024-10-31 23:54:21 +0000 | [diff] [blame] | 68 | "systemfeatures-gen-lib", |
Jared Duke | 230d650 | 2024-07-31 21:35:24 +0000 | [diff] [blame] | 69 | "truth", |
| 70 | ], |
Jared Duke | 13519f0 | 2024-11-21 22:36:12 +0000 | [diff] [blame] | 71 | plugins: ["systemfeatures-metadata-processor"], |
Jared Duke | 230d650 | 2024-07-31 21:35:24 +0000 | [diff] [blame] | 72 | } |
Jared Duke | 2d1a832 | 2024-08-23 22:17:09 +0000 | [diff] [blame] | 73 | |
| 74 | // Rename the goldens as they may be copied into the source tree, and we don't |
| 75 | // need or want the usual `.java` linting (e.g., copyright checks). |
| 76 | genrule { |
| 77 | name: "systemfeatures-gen-tests-golden-srcs", |
| 78 | cmd: "for f in $(in); do cp $$f $(genDir)/tests/gen/$$(basename $$f).gen; done", |
| 79 | srcs: [":systemfeatures-gen-tests-srcs"], |
| 80 | out: [ |
| 81 | "tests/gen/RwNoFeatures.java.gen", |
| 82 | "tests/gen/RoNoFeatures.java.gen", |
| 83 | "tests/gen/RwFeatures.java.gen", |
| 84 | "tests/gen/RoFeatures.java.gen", |
| 85 | ], |
| 86 | } |
| 87 | |
| 88 | // Golden output testing. Golden sources can be updated via: |
| 89 | // $ANDROID_BUILD_TOP/frameworks/base/tools/systemfeatures/tests/golden_test.sh --update |
| 90 | sh_test_host { |
| 91 | name: "systemfeatures-gen-golden-tests", |
| 92 | src: "tests/golden_test.sh", |
| 93 | filename: "systemfeatures-gen-golden-tests.sh", |
| 94 | test_config: "tests/systemfeatures-gen-golden-tests.xml", |
| 95 | data: [ |
| 96 | "tests/golden/**/*.java*", |
| 97 | ":systemfeatures-gen-tests-golden-srcs", |
| 98 | ], |
| 99 | test_options: { |
| 100 | unit_test: true, |
| 101 | }, |
| 102 | } |
Jared Duke | c552762 | 2024-12-21 00:51:47 +0000 | [diff] [blame^] | 103 | |
| 104 | java_library_host { |
| 105 | name: "systemfeatures-errorprone-lib", |
| 106 | srcs: [ |
| 107 | ":systemfeatures-gen-metadata-srcs", |
| 108 | "errorprone/java/**/*.java", |
| 109 | ], |
| 110 | static_libs: [ |
| 111 | "//external/error_prone:error_prone_core", |
| 112 | "guava", |
| 113 | "jsr305", |
| 114 | ], |
| 115 | libs: [ |
| 116 | "//external/auto:auto_service_annotations", |
| 117 | ], |
| 118 | javacflags: [ |
| 119 | // These exports are needed because this errorprone plugin access some private classes |
| 120 | // of the java compiler. |
| 121 | "--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED", |
| 122 | "--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED", |
| 123 | "--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED", |
| 124 | ], |
| 125 | plugins: [ |
| 126 | "//external/auto:auto_service_plugin", |
| 127 | ], |
| 128 | } |
| 129 | |
| 130 | java_plugin { |
| 131 | name: "systemfeatures-errorprone", |
| 132 | static_libs: ["systemfeatures-errorprone-lib"], |
| 133 | } |
| 134 | |
| 135 | java_test_host { |
| 136 | name: "systemfeatures-errorprone-tests", |
| 137 | srcs: [ |
| 138 | "errorprone/tests/java/**/*.java", |
| 139 | ], |
| 140 | java_resource_dirs: ["tests/src"], |
| 141 | java_resources: [ |
| 142 | ":systemfeatures-errorprone-tests-data", |
| 143 | ], |
| 144 | static_libs: [ |
| 145 | "compile-testing-prebuilt", |
| 146 | "error_prone_test_helpers", |
| 147 | "framework-annotations-lib", |
| 148 | "hamcrest", |
| 149 | "hamcrest-library", |
| 150 | "junit", |
| 151 | "systemfeatures-errorprone-lib", |
| 152 | "truth", |
| 153 | ], |
| 154 | test_options: { |
| 155 | unit_test: true, |
| 156 | }, |
| 157 | } |
| 158 | |
| 159 | java_system_features_srcs { |
| 160 | name: "systemfeatures-gen-metadata-srcs", |
| 161 | full_class_name: "com.android.systemfeatures.RoSystemFeaturesMetadata", |
| 162 | metadata_only: true, |
| 163 | visibility: ["//visibility:private"], |
| 164 | } |
| 165 | |
| 166 | filegroup { |
| 167 | name: "systemfeatures-errorprone-tests-data", |
| 168 | path: "tests/src", |
| 169 | srcs: ["tests/src/android/**/*.java"], |
| 170 | visibility: ["//visibility:private"], |
| 171 | } |