Files
build/tools/aconfig/aconfig_storage_write_api/Android.bp
Dennis Shen 5590478580 aconfig: update storage read api
Update storage read api to not find storage file location from a pb
file, instead directly read from /metadata copy. Previously for
package.map and flag.map, we are reading from the respective RO
partition. Now we are reading from /metadata/maps dir. This has a few
advantages:

1, early flag availability, since /metadata can be mounted much earlier
than mainline modules, so it would make mainline flags availabile even
before mainline modules are mounted.

2, we no longer need to read from a pb file to find where package.map
and flag.map are. Thus the read api can be further simplified and
downsized. With this change, we are able to shrink the cc flag read api
lib size from 171k to 120k.

Bug: b/321077378
Test atest -c

Change-Id: Ic9086fe4c49c139a4d1c66a8d472023a88c9dd17
2024-05-22 19:25:17 +00:00

84 lines
2.1 KiB
Plaintext

package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
rust_defaults {
name: "aconfig_storage_write_api.defaults",
edition: "2021",
lints: "none",
srcs: ["src/lib.rs"],
rustlibs: [
"libanyhow",
"libtempfile",
"libmemmap2",
"libcxx",
"libthiserror",
"libaconfig_storage_file",
"libaconfig_storage_read_api",
],
}
rust_library {
name: "libaconfig_storage_write_api",
crate_name: "aconfig_storage_write_api",
host_supported: true,
defaults: ["aconfig_storage_write_api.defaults"],
}
rust_test_host {
name: "aconfig_storage_write_api.test",
test_suites: ["general-tests"],
defaults: ["aconfig_storage_write_api.defaults"],
data: [
"tests/flag.val",
"tests/flag.info",
],
rustlibs: [
"libaconfig_storage_read_api",
],
}
// cxx source codegen from rust api
genrule {
name: "libcxx_aconfig_storage_write_api_bridge_code",
tools: ["cxxbridge"],
cmd: "$(location cxxbridge) $(in) > $(out)",
srcs: ["src/lib.rs"],
out: ["aconfig_storage/lib.rs.cc"],
}
// cxx header codegen from rust api
genrule {
name: "libcxx_aconfig_storage_write_api_bridge_header",
tools: ["cxxbridge"],
cmd: "$(location cxxbridge) $(in) --header > $(out)",
srcs: ["src/lib.rs"],
out: ["aconfig_storage/lib.rs.h"],
}
// a static cc lib based on generated code
rust_ffi_static {
name: "libaconfig_storage_write_api_cxx_bridge",
crate_name: "aconfig_storage_write_api_cxx_bridge",
host_supported: true,
defaults: ["aconfig_storage_write_api.defaults"],
}
// flag write api cc interface
cc_library_static {
name: "libaconfig_storage_write_api_cc",
srcs: ["aconfig_storage_write_api.cpp"],
generated_headers: [
"cxx-bridge-header",
"libcxx_aconfig_storage_write_api_bridge_header",
],
generated_sources: ["libcxx_aconfig_storage_write_api_bridge_code"],
whole_static_libs: ["libaconfig_storage_write_api_cxx_bridge"],
export_include_dirs: ["include"],
static_libs: [
"libaconfig_storage_read_api_cc",
"libprotobuf-cpp-lite",
"libbase",
],
}