| package { | |
| // See: http://go/android-license-faq | |
| // A large-scale-change added 'default_applicable_licenses' to import | |
| // all of the 'license_kinds' from "frameworks_base_license" | |
| // to get the below license kinds: | |
| // SPDX-license-identifier-Apache-2.0 | |
| default_applicable_licenses: ["frameworks_base_license"], | |
| default_team: "trendy_team_system_performance", | |
| } | |
| // Code generation for compile-time system feature queries in the framework. | |
| java_library_host { | |
| name: "systemfeatures-gen-lib", | |
| srcs: [ | |
| ":framework-metalava-annotations", | |
| ":systemfeatures-lookup-srcs", | |
| "src/com/android/systemfeatures/SystemFeaturesGenerator.kt", | |
| ], | |
| static_libs: [ | |
| "guava", | |
| "javapoet", | |
| ], | |
| } | |
| java_binary_host { | |
| name: "systemfeatures-gen-tool", | |
| main_class: "com.android.systemfeatures.SystemFeaturesGenerator", | |
| static_libs: ["systemfeatures-gen-lib"], | |
| } | |
| // Code generation for system feature name lookups in host tools that cannot | |
| // depend on the framework. | |
| java_library_host { | |
| name: "systemfeatures-lookup-gen-lib", | |
| srcs: ["src/com/android/systemfeatures/SystemFeaturesLookupGenerator.kt"], | |
| static_libs: [ | |
| "javapoet", | |
| "metalava-signature-reader", | |
| ], | |
| visibility: ["//visibility:private"], | |
| } | |
| java_binary_host { | |
| name: "systemfeatures-lookup-gen-tool", | |
| main_class: "com.android.systemfeatures.SystemFeaturesLookupGenerator", | |
| static_libs: ["systemfeatures-lookup-gen-lib"], | |
| visibility: ["//visibility:private"], | |
| } | |
| genrule { | |
| name: "systemfeatures-lookup-srcs", | |
| cmd: "$(location systemfeatures-lookup-gen-tool) $(in) $(out)", | |
| out: ["SystemFeaturesLookup.java"], | |
| srcs: [ | |
| ":non-updatable-current.txt", | |
| ":non-updatable-module-lib-current.txt", | |
| ":non-updatable-system-current.txt", | |
| ":non-updatable-test-current.txt", | |
| ], | |
| tools: ["systemfeatures-lookup-gen-tool"], | |
| visibility: ["//visibility:private"], | |
| } | |
| // Code generation for runtime system feature metadata queries in the framework. | |
| java_library_host { | |
| name: "systemfeatures-metadata-lib", | |
| srcs: [ | |
| ":framework-metalava-annotations", | |
| "src/com/android/systemfeatures/SystemFeaturesMetadataProcessor.kt", | |
| ], | |
| static_libs: [ | |
| "guava", | |
| "javapoet", | |
| ], | |
| } | |
| java_plugin { | |
| name: "systemfeatures-metadata-processor", | |
| processor_class: "com.android.systemfeatures.SystemFeaturesMetadataProcessor", | |
| static_libs: ["systemfeatures-metadata-lib"], | |
| } | |
| genrule { | |
| name: "systemfeatures-gen-tests-srcs", | |
| srcs: [ | |
| "tests/data/features-1.xml", | |
| "tests/data/features-2.xml", | |
| ], | |
| cmd: "$(location systemfeatures-gen-tool) com.android.systemfeatures.RwNoFeatures --readonly=false > $(location RwNoFeatures.java) && " + | |
| "$(location systemfeatures-gen-tool) com.android.systemfeatures.RoNoFeatures --readonly=true --feature-apis=WATCH > $(location RoNoFeatures.java) && " + | |
| "$(location systemfeatures-gen-tool) com.android.systemfeatures.RwFeatures --readonly=false --feature=WATCH:1 --feature=WIFI:0 --feature=VULKAN:UNAVAILABLE --feature=AUTO: --output-proguard-rules=$(location RwFeatures.proguard) > $(location RwFeatures.java) && " + | |
| "$(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 --output-proguard-rules=$(location RoFeatures.proguard) > $(location RoFeatures.java) && " + | |
| "$(location systemfeatures-gen-tool) com.android.systemfeatures.RwFeaturesFromXml --readonly=false --feature-xml-files=$(location tests/data/features-1.xml),$(location tests/data/features-2.xml) > $(location RwFeaturesFromXml.java) && " + | |
| "$(location systemfeatures-gen-tool) com.android.systemfeatures.RoFeaturesFromXml --readonly=true --feature-xml-files=$(location tests/data/features-1.xml),$(location tests/data/features-2.xml) > $(location RoFeaturesFromXml.java) && " + | |
| "$(location systemfeatures-gen-tool) com.android.systemfeatures.RoUnavailableFeaturesFromXml --readonly=true --unavailable-feature-xml-files=$(location tests/data/features-1.xml),$(location tests/data/features-2.xml) --output-proguard-rules=$(location RoUnavailableFeaturesFromXml.proguard) > $(location RoUnavailableFeaturesFromXml.java)", | |
| out: [ | |
| "RwNoFeatures.java", | |
| "RoNoFeatures.java", | |
| "RwFeatures.java", | |
| "RwFeatures.proguard", | |
| "RoFeatures.java", | |
| "RoFeatures.proguard", | |
| "RwFeaturesFromXml.java", | |
| "RoFeaturesFromXml.java", | |
| "RoUnavailableFeaturesFromXml.java", | |
| "RoUnavailableFeaturesFromXml.proguard", | |
| ], | |
| tools: ["systemfeatures-gen-tool"], | |
| } | |
| // Functional runtime behavior testing. | |
| java_test_host { | |
| name: "systemfeatures-gen-tests", | |
| test_suites: ["general-tests"], | |
| srcs: [ | |
| "tests/src/**/*.java", | |
| ":systemfeatures-gen-tests-srcs", | |
| ], | |
| data: [ | |
| "tests/data/features-1.xml", | |
| "tests/data/features-2.xml", | |
| ], | |
| test_options: { | |
| unit_test: true, | |
| }, | |
| static_libs: [ | |
| "aconfig-annotations-lib", | |
| "framework-annotations-lib", | |
| "junit", | |
| "objenesis", | |
| "mockito", | |
| "systemfeatures-gen-lib", | |
| "systemfeatures-lookup-gen-lib", | |
| "truth", | |
| ], | |
| plugins: ["systemfeatures-metadata-processor"], | |
| } | |
| // Rename the goldens as they may be copied into the source tree, and we don't | |
| // need or want the usual `.java` linting (e.g., copyright checks). | |
| genrule { | |
| name: "systemfeatures-gen-tests-golden-srcs", | |
| cmd: "for f in $(in); do cp $$f $(genDir)/tests/gen/$$(basename $$f).gen; done", | |
| srcs: [":systemfeatures-gen-tests-srcs"], | |
| out: [ | |
| "tests/gen/RwNoFeatures.java.gen", | |
| "tests/gen/RoNoFeatures.java.gen", | |
| "tests/gen/RwFeatures.java.gen", | |
| "tests/gen/RwFeatures.proguard.gen", | |
| "tests/gen/RoFeatures.java.gen", | |
| "tests/gen/RoFeatures.proguard.gen", | |
| "tests/gen/RwFeaturesFromXml.java.gen", | |
| "tests/gen/RoFeaturesFromXml.java.gen", | |
| "tests/gen/RoUnavailableFeaturesFromXml.java.gen", | |
| "tests/gen/RoUnavailableFeaturesFromXml.proguard.gen", | |
| ], | |
| } | |
| // Golden output testing. Golden sources can be updated via: | |
| // $ANDROID_BUILD_TOP/frameworks/base/tools/systemfeatures/tests/golden_test.sh --update | |
| sh_test_host { | |
| name: "systemfeatures-gen-golden-tests", | |
| src: "tests/golden_test.sh", | |
| filename: "systemfeatures-gen-golden-tests.sh", | |
| test_config: "tests/systemfeatures-gen-golden-tests.xml", | |
| data: [ | |
| "tests/golden/**/*", | |
| ":systemfeatures-gen-tests-golden-srcs", | |
| ], | |
| test_options: { | |
| unit_test: true, | |
| }, | |
| } | |
| java_library_host { | |
| name: "systemfeatures-errorprone-lib", | |
| srcs: [ | |
| ":systemfeatures-gen-metadata-srcs", | |
| "errorprone/java/**/*.java", | |
| ], | |
| static_libs: [ | |
| "//external/error_prone:error_prone_core", | |
| "guava", | |
| "jsr305", | |
| ], | |
| libs: [ | |
| "//external/auto:auto_service_annotations", | |
| ], | |
| javacflags: [ | |
| // These exports are needed because this errorprone plugin access some private classes | |
| // of the java compiler. | |
| "--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED", | |
| "--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED", | |
| "--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED", | |
| ], | |
| plugins: [ | |
| "//external/auto:auto_service_plugin", | |
| ], | |
| } | |
| java_plugin { | |
| name: "systemfeatures-errorprone", | |
| static_libs: ["systemfeatures-errorprone-lib"], | |
| } | |
| java_test_host { | |
| name: "systemfeatures-errorprone-tests", | |
| srcs: [ | |
| "errorprone/tests/java/**/*.java", | |
| ], | |
| java_resource_dirs: ["tests/src"], | |
| java_resources: [ | |
| ":systemfeatures-errorprone-tests-data", | |
| ], | |
| static_libs: [ | |
| "compile-testing-prebuilt", | |
| "error_prone_test_helpers", | |
| "framework-annotations-lib", | |
| "hamcrest", | |
| "hamcrest-library", | |
| "junit", | |
| "systemfeatures-errorprone-lib", | |
| "truth", | |
| ], | |
| test_options: { | |
| unit_test: true, | |
| }, | |
| } | |
| java_system_features_srcs { | |
| name: "systemfeatures-gen-metadata-srcs", | |
| full_class_name: "com.android.systemfeatures.RoSystemFeaturesMetadata", | |
| metadata_only: true, | |
| visibility: ["//visibility:private"], | |
| } | |
| filegroup { | |
| name: "systemfeatures-errorprone-tests-data", | |
| path: "tests/src", | |
| srcs: ["tests/src/android/**/*.java"], | |
| visibility: ["//visibility:private"], | |
| } |