| package { | |
| default_applicable_licenses: ["Android-Apache-2.0"], | |
| } | |
| android_app { | |
| name: "AconfigDemoActivity", | |
| manifest: "AndroidManifest.xml", | |
| srcs: [ | |
| "src/**/*.java", | |
| ], | |
| platform_apis: true, | |
| certificate: "platform", | |
| static_libs: [ | |
| "ContentLibs", | |
| "dagger2", | |
| "jsr330", | |
| ], | |
| jni_libs: [ | |
| "libexample_cpp_lib", | |
| ], | |
| required: ["libexample_rust_jni"], | |
| plugins: ["dagger2-compiler"], | |
| optimize: { | |
| proguard_flags_files: ["proguard.flags"], | |
| }, | |
| } | |
| aconfig_declarations { | |
| name: "aconfig_demo_flags", | |
| package: "com.example.android.aconfig.demo.flags", | |
| container: "system", | |
| srcs: ["aconfig_demo_flags.aconfig"], | |
| } | |
| java_aconfig_library { | |
| name: "aconfig_demo_flags_java_lib", | |
| aconfig_declarations: "aconfig_demo_flags", | |
| } | |
| filegroup { | |
| name: "ContentLibsFile", | |
| srcs: [ | |
| "lib/**/*.java", | |
| ], | |
| } | |
| java_defaults { | |
| name: "ContentLibsDefault", | |
| sdk_version: "current", | |
| srcs: [ | |
| ":ContentLibsFile", | |
| ], | |
| libs: ["jsr330"], | |
| } | |
| java_library { | |
| name: "ContentLibs", | |
| defaults: ["ContentLibsDefault"], | |
| static_libs: [ | |
| "aconfig_demo_flags_java_lib", | |
| ], | |
| } | |
| cc_aconfig_library { | |
| name: "aconfig_demo_flags_c_lib", | |
| aconfig_declarations: "aconfig_demo_flags", | |
| } | |
| cc_library { | |
| name: "libexample_cpp_lib", | |
| srcs: ["src/example_cpp_lib.cc"], | |
| double_loadable: true, | |
| cflags: [ | |
| "-Wall", | |
| "-Werror", | |
| "-Wno-unused-function", | |
| "-Wno-unused-parameter", | |
| ], | |
| header_libs: [ | |
| "jni_headers", | |
| ], | |
| shared_libs: [ | |
| "server_configurable_flags", | |
| ], | |
| static_libs: [ | |
| "aconfig_demo_flags_c_lib", | |
| ], | |
| export_include_dirs: ["src/include"], | |
| defaults: [ | |
| "aconfig_lib_cc_static_link.defaults", | |
| ], | |
| } | |
| rust_aconfig_library { | |
| name: "libaconfig_demo_flags_rust", | |
| crate_name: "aconfig_demo_flags_rust", | |
| aconfig_declarations: "aconfig_demo_flags", | |
| } | |
| rust_ffi_shared { | |
| name: "libexample_rust_jni", | |
| crate_name: "example_rust_jni", | |
| srcs: ["src/lib.rs"], | |
| rustlibs: [ | |
| "libjni", | |
| "libaconfig_demo_flags_rust", | |
| ], | |
| } | |
| // Test setup | |
| // Create test verion of the java flag library | |
| // It needs to use the same aconfig_declarations as | |
| // the production one | |
| java_aconfig_library { | |
| name: "aconfig_demo_flags_java_lib_test", | |
| aconfig_declarations: "aconfig_demo_flags", | |
| // host_supported is set to true here for test running | |
| // one host, in tests/unittests/Android.bp | |
| host_supported: true, | |
| mode: "test", | |
| } |