1package { 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"], 8 default_team: "trendy_team_system_performance", 9} 10 11java_library_host { 12 name: "systemfeatures-gen-lib", 13 srcs: [ 14 "src/**/*.java", 15 "src/**/*.kt", 16 ":framework-metalava-annotations", 17 ], 18 static_libs: [ 19 "guava", 20 "javapoet", 21 ], 22} 23 24java_binary_host { 25 name: "systemfeatures-gen-tool", 26 main_class: "com.android.systemfeatures.SystemFeaturesGenerator", 27 static_libs: ["systemfeatures-gen-lib"], 28} 29 30java_plugin { 31 name: "systemfeatures-metadata-processor", 32 processor_class: "com.android.systemfeatures.SystemFeaturesMetadataProcessor", 33 static_libs: ["systemfeatures-gen-lib"], 34} 35 36genrule { 37 name: "systemfeatures-gen-tests-srcs", 38 cmd: "$(location systemfeatures-gen-tool) com.android.systemfeatures.RwNoFeatures --readonly=false > $(location RwNoFeatures.java) && " + 39 "$(location systemfeatures-gen-tool) com.android.systemfeatures.RoNoFeatures --readonly=true --feature-apis=WATCH > $(location RoNoFeatures.java) && " + 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)", 42 out: [ 43 "RwNoFeatures.java", 44 "RoNoFeatures.java", 45 "RwFeatures.java", 46 "RoFeatures.java", 47 ], 48 tools: ["systemfeatures-gen-tool"], 49} 50 51// Functional runtime behavior testing. 52java_test_host { 53 name: "systemfeatures-gen-tests", 54 test_suites: ["general-tests"], 55 srcs: [ 56 "tests/src/**/*.java", 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", 68 "systemfeatures-gen-lib", 69 "truth", 70 ], 71 plugins: ["systemfeatures-metadata-processor"], 72} 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). 76genrule { 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 90sh_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} 103