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", |
| 16 | ], |
| 17 | static_libs: [ |
| 18 | "guava", |
| 19 | "javapoet", |
| 20 | ], |
| 21 | } |
| 22 | |
| 23 | java_binary_host { |
| 24 | name: "systemfeatures-gen-tool", |
| 25 | main_class: "com.android.systemfeatures.SystemFeaturesGenerator", |
| 26 | static_libs: ["systemfeatures-gen-lib"], |
| 27 | } |
| 28 | |
Jared Duke | 230d650 | 2024-07-31 21:35:24 +0000 | [diff] [blame] | 29 | genrule { |
| 30 | name: "systemfeatures-gen-tests-srcs", |
| 31 | 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] | 32 | "$(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] | 33 | "$(location systemfeatures-gen-tool) com.android.systemfeatures.RwFeatures --readonly=false --feature=WATCH:1 --feature=WIFI:0 --feature=VULKAN:UNAVAILABLE --feature=AUTO: > $(location RwFeatures.java) && " + |
| 34 | "$(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] | 35 | out: [ |
| 36 | "RwNoFeatures.java", |
| 37 | "RoNoFeatures.java", |
| 38 | "RwFeatures.java", |
| 39 | "RoFeatures.java", |
| 40 | ], |
| 41 | tools: ["systemfeatures-gen-tool"], |
| 42 | } |
| 43 | |
Jared Duke | 2d1a832 | 2024-08-23 22:17:09 +0000 | [diff] [blame] | 44 | // Functional runtime behavior testing. |
Jared Duke | 230d650 | 2024-07-31 21:35:24 +0000 | [diff] [blame] | 45 | java_test_host { |
| 46 | name: "systemfeatures-gen-tests", |
| 47 | test_suites: ["general-tests"], |
| 48 | srcs: [ |
Jared Duke | 2d1a832 | 2024-08-23 22:17:09 +0000 | [diff] [blame] | 49 | "tests/src/**/*.java", |
Jared Duke | 230d650 | 2024-07-31 21:35:24 +0000 | [diff] [blame] | 50 | ":systemfeatures-gen-tests-srcs", |
| 51 | ], |
| 52 | test_options: { |
| 53 | unit_test: true, |
| 54 | }, |
| 55 | static_libs: [ |
| 56 | "aconfig-annotations-lib", |
| 57 | "framework-annotations-lib", |
| 58 | "junit", |
| 59 | "objenesis", |
| 60 | "mockito", |
| 61 | "truth", |
| 62 | ], |
| 63 | } |
Jared Duke | 2d1a832 | 2024-08-23 22:17:09 +0000 | [diff] [blame] | 64 | |
| 65 | // Rename the goldens as they may be copied into the source tree, and we don't |
| 66 | // need or want the usual `.java` linting (e.g., copyright checks). |
| 67 | genrule { |
| 68 | name: "systemfeatures-gen-tests-golden-srcs", |
| 69 | cmd: "for f in $(in); do cp $$f $(genDir)/tests/gen/$$(basename $$f).gen; done", |
| 70 | srcs: [":systemfeatures-gen-tests-srcs"], |
| 71 | out: [ |
| 72 | "tests/gen/RwNoFeatures.java.gen", |
| 73 | "tests/gen/RoNoFeatures.java.gen", |
| 74 | "tests/gen/RwFeatures.java.gen", |
| 75 | "tests/gen/RoFeatures.java.gen", |
| 76 | ], |
| 77 | } |
| 78 | |
| 79 | // Golden output testing. Golden sources can be updated via: |
| 80 | // $ANDROID_BUILD_TOP/frameworks/base/tools/systemfeatures/tests/golden_test.sh --update |
| 81 | sh_test_host { |
| 82 | name: "systemfeatures-gen-golden-tests", |
| 83 | src: "tests/golden_test.sh", |
| 84 | filename: "systemfeatures-gen-golden-tests.sh", |
| 85 | test_config: "tests/systemfeatures-gen-golden-tests.xml", |
| 86 | data: [ |
| 87 | "tests/golden/**/*.java*", |
| 88 | ":systemfeatures-gen-tests-golden-srcs", |
| 89 | ], |
| 90 | test_options: { |
| 91 | unit_test: true, |
| 92 | }, |
| 93 | } |