Introduce the Cache struct to represent parsed and verified aconfig and override content. Most commands in aconfig will work of an existing cache file, eliminating the need to re-read the input every time. Restructure main.rs to use clap to create a proper command line interface with support for sub-commands. main.rs is responsible for parsing the command line, performing disk I/O and calling the correct subcommand implementation (in commands.rs). To simplify unit tests, subcommands never perform explicit I/O; instead they only work with Read and Write traits. Also add dependencies on clap, serde and serde_json. Bug: 279485059 Test: atest aconfig.test Change-Id: Ib6abf2eabd264009804f253874b6fba924fc391b
38 lines
725 B
Plaintext
38 lines
725 B
Plaintext
package {
|
|
default_applicable_licenses: ["Android-Apache-2.0"],
|
|
}
|
|
|
|
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",
|
|
],
|
|
}
|
|
|
|
rust_binary_host {
|
|
name: "aconfig",
|
|
defaults: ["aconfig.defaults"],
|
|
}
|
|
|
|
rust_test_host {
|
|
name: "aconfig.test",
|
|
defaults: ["aconfig.defaults"],
|
|
}
|