platform_build/tools/aconfig/Android.bp
Ted Bauer afe55106e5 Cache Java codegen'd flags in static member variables.
By caching flag values directly in member variables instead of caching
a HashMap and accessing that, flag reads avoid `hashCode()`, map
lookup, and Boolean.parse runtime costs. Flag reads are turning out
to have performance problems in hot paths, so this should help to
alleviate that.

Bug: 309625014
Test: m
Change-Id: I923bf6af2ae3fcbbf2fee7126b492a47cd6049ad
2023-11-14 12:02:01 -05:00

202 lines
4 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",
min_sdk_version: "UpsideDownCake",
apex_available: [
"com.android.configinfrastructure",
"//apex_available:platform",
]
}
java_library_host {
name: "libaconfig_java_proto_full",
srcs: ["protos/aconfig.proto"],
static_libs: ["libprotobuf-java-full"],
proto: {
type: "full",
},
}
python_library_host {
name: "libaconfig_python_proto",
srcs: ["protos/aconfig.proto"],
proto: {
canonical_path_from_root: false,
},
}
// host binary: aconfig
rust_protobuf {
name: "libaconfig_protos",
protos: ["protos/aconfig.proto"],
crate_name: "aconfig_protos",
source_stem: "aconfig_protos",
use_protobuf3: true,
host_supported: true,
}
rust_defaults {
name: "aconfig.defaults",
edition: "2021",
clippy_lints: "android",
lints: "android",
srcs: ["src/main.rs"],
rustlibs: [
"libaconfig_protos",
"libanyhow",
"libclap",
"libitertools",
"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,
mode: "test",
}
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",
mode: "test",
}
rust_test {
name: "aconfig.test_mode.test.rust",
srcs: [
"tests/aconfig_test_mode_test.rs"
],
rustlibs: [
"libaconfig_test_rust_library_with_test_mode",
],
}