Files
build/tools/aconfig/aconfig_storage_file/Android.bp
Marybeth Fair 45b0438cc0 Add ability to manually write to binary files.
I was updating the format of PackageTableHeader to add an additional
field (and due to that change incremented the file version). This broke
several tests under aconfig_storage_read_api and
aconfig_storage_write_api that were operating on files written in the
old schema. I tried to re-generate them using aconfig create-storage as
explained in aosp/2933375, but was having some trouble. Figure if we can
just update the files directly it will be easier to make updates in the
future anyway. This isn't bypassing logic that's tested - IIUC the tests
cover reading the file correctly (writing is covered in separate tests).

Usage:
$ aconfig-storage print --file=path/to/flag.map --type=flag_map
--format=json > flag_map.json
$ vim flag_map.json // Manually make updates
$ aconfig-storage write-bytes --input-file=flag_map.json
--output-file=path/to/flag.map --type=flag_map

Change-Id: I212bf0b97483740b30130eb121acb895d350da84
Test: manual (adding debug-only tooling) + cargo t
Bug: 316357686
2024-09-16 10:30:04 -04:00

170 lines
4.1 KiB
Plaintext

package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
rust_defaults {
name: "aconfig_storage_file.defaults",
edition: "2021",
lints: "none",
rustlibs: [
"libanyhow",
"libthiserror",
"libtempfile",
"libprotobuf",
"libclap",
"libcxx",
"libaconfig_storage_protos",
"libserde",
],
}
rust_library {
name: "libaconfig_storage_file",
crate_name: "aconfig_storage_file",
host_supported: true,
defaults: ["aconfig_storage_file.defaults"],
srcs: ["src/lib.rs"],
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
min_sdk_version: "29",
vendor_available: true,
product_available: true,
}
rust_binary_host {
name: "aconfig-storage",
defaults: ["aconfig_storage_file.defaults"],
srcs: ["src/main.rs"],
rustlibs: [
"libaconfig_storage_file",
"libserde_json",
],
}
rust_test_host {
name: "aconfig_storage_file.test",
test_suites: ["general-tests"],
defaults: ["aconfig_storage_file.defaults"],
srcs: ["src/lib.rs"],
}
rust_protobuf {
name: "libaconfig_storage_protos",
protos: ["protos/aconfig_storage_metadata.proto"],
crate_name: "aconfig_storage_protos",
source_stem: "aconfig_storage_protos",
host_supported: true,
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
min_sdk_version: "29",
vendor_available: true,
product_available: true,
}
cc_library {
name: "libaconfig_storage_protos_cc",
proto: {
export_proto_headers: true,
type: "lite",
},
srcs: ["protos/aconfig_storage_metadata.proto"],
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
host_supported: true,
min_sdk_version: "29",
vendor_available: true,
product_available: true,
double_loadable: true,
}
// cxx source codegen from rust api
genrule {
name: "libcxx_aconfig_storage_file_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_file_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_file_cxx_bridge",
crate_name: "aconfig_storage_file_cxx_bridge",
host_supported: true,
vendor_available: true,
product_available: true,
srcs: ["src/lib.rs"],
defaults: ["aconfig_storage_file.defaults"],
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
min_sdk_version: "29",
}
// storage file parse api cc interface
cc_library {
name: "libaconfig_storage_file_cc",
srcs: ["aconfig_storage_file.cpp"],
generated_headers: [
"cxx-bridge-header",
"libcxx_aconfig_storage_file_bridge_header",
],
generated_sources: ["libcxx_aconfig_storage_file_bridge_code"],
whole_static_libs: ["libaconfig_storage_file_cxx_bridge"],
export_include_dirs: ["include"],
host_supported: true,
vendor_available: true,
product_available: true,
shared_libs: [
"libbase",
],
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
min_sdk_version: "29",
double_loadable: true,
}
// storage file parse api java library
java_library {
name: "aconfig_storage_file_java",
srcs: [
"srcs/**/*.java",
],
sdk_version: "core_current",
min_sdk_version: "29",
host_supported: true,
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
}
// storage file parse api java library for core library
java_library {
name: "aconfig_storage_file_java_none",
srcs: [
"srcs/**/*.java",
],
sdk_version: "none",
system_modules: "core-all-system-modules",
host_supported: true,
}