platform_build/tools/aconfig/Android.bp
Vinh Tran 906405f5c9 Add rust_test with rust_aconfig_library in test mode
Using test mode in aconfig  allows us to override the flag for unit
testing

Test: atest aconfig.test_mode.test.rust
Change-Id: I890fb20fd8cf83e6033defc7093430e3a77e4de4
2023-08-11 21:41:13 +00:00

187 lines
No EOL
3.7 KiB
Text

package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
// proto libraries for consumers of `aconfig dump --format=protobuf` output
java_library {
name: "libaconfig_java_proto_lite",
host_supported: true,
srcs: ["protos/aconfig.proto"],
static_libs: ["libprotobuf-java-lite"],
proto: {
type: "lite",
},
sdk_version: "current",
}
java_library_host {
name: "libaconfig_java_proto_full",
srcs: ["protos/aconfig.proto"],
static_libs: ["libprotobuf-java-full"],
proto: {
type: "full",
},
}
// host binary: aconfig
rust_protobuf_host {
name: "libaconfig_protos",
protos: ["protos/aconfig.proto"],
crate_name: "aconfig_protos",
source_stem: "aconfig_protos",
use_protobuf3: true,
}
rust_defaults {
name: "aconfig.defaults",
edition: "2021",
clippy_lints: "android",
lints: "android",
srcs: ["src/main.rs"],
rustlibs: [
"libaconfig_protos",
"libanyhow",
"libclap",
"libprotobuf",
"libserde",
"libserde_json",
"libtinytemplate",
],
proc_macros: [
"libpaste",
]
}
rust_binary_host {
name: "aconfig",
defaults: ["aconfig.defaults"],
}
rust_test_host {
name: "aconfig.test",
defaults: ["aconfig.defaults"],
rustlibs: [
"libitertools",
],
}
// integration tests: general
aconfig_declarations {
name: "aconfig.test.flags",
package: "com.android.aconfig.test",
srcs: ["tests/test.aconfig"],
}
aconfig_values {
name: "aconfig.test.flag.values",
package: "com.android.aconfig.test",
srcs: [
"tests/first.values",
"tests/second.values",
],
}
aconfig_value_set {
name: "aconfig.test.flag.value_set",
values: [
"aconfig.test.flag.values",
],
}
// integration tests: java
java_aconfig_library {
name: "aconfig_test_java_library",
aconfig_declarations: "aconfig.test.flags",
}
android_test {
name: "aconfig.test.java",
srcs: [
"tests/AconfigTest.java",
],
manifest: "tests/AndroidManifest.xml",
certificate: "platform",
static_libs: [
"aconfig_test_java_library",
"androidx.test.rules",
"testng",
],
test_suites: ["device-tests"],
}
java_aconfig_library {
name: "aconfig_host_test_java_library",
aconfig_declarations: "aconfig.test.flags",
host_supported: true,
test: true,
}
java_test_host {
name: "AconfigJavaHostTest",
srcs: [
"tests/AconfigHostTest.java",
],
static_libs: [
"aconfig_host_test_java_library",
"junit",
],
test_suites: ["general-tests"],
}
// integration tests: C++
cc_aconfig_library {
name: "aconfig_test_cpp_library",
aconfig_declarations: "aconfig.test.flags",
}
cc_test {
name: "aconfig.test.cpp",
srcs: [
"tests/aconfig_test.cpp",
],
static_libs: [
"aconfig_test_cpp_library",
"libgmock",
],
shared_libs: [
"server_configurable_flags",
],
}
rust_aconfig_library {
name: "libaconfig_test_rust_library",
crate_name: "aconfig_test_rust_library",
aconfig_declarations: "aconfig.test.flags",
}
rust_test {
name: "aconfig.prod_mode.test.rust",
srcs: [
"tests/aconfig_prod_mode_test.rs"
],
rustlibs: [
"libaconfig_test_rust_library",
],
}
rust_aconfig_library {
name: "libaconfig_test_rust_library_with_test_mode",
crate_name: "aconfig_test_rust_library",
aconfig_declarations: "aconfig.test.flags",
test: true,
}
rust_test {
name: "aconfig.test_mode.test.rust",
srcs: [
"tests/aconfig_test_mode_test.rs"
],
rustlibs: [
"libaconfig_test_rust_library_with_test_mode",
],
}