Loading tools/aconfig/aconfig_storage_file/Android.bp +11 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,9 @@ rust_defaults { srcs: ["src/lib.rs"], rustlibs: [ "libanyhow", "libaconfig_storage_protos", "libonce_cell", "libprotobuf", ], } Loading @@ -24,3 +27,11 @@ rust_test_host { test_suites: ["general-tests"], defaults: ["aconfig_storage_file.defaults"], } 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, } tools/aconfig/aconfig_storage_file/Cargo.toml +4 −0 Original line number Diff line number Diff line Loading @@ -9,3 +9,7 @@ cargo = [] [dependencies] anyhow = "1.0.69" protobuf = "3.2.0" [build-dependencies] protobuf-codegen = "3.2.0" tools/aconfig/aconfig_storage_file/build.rs 0 → 100644 +17 −0 Original line number Diff line number Diff line use protobuf_codegen::Codegen; fn main() { let proto_files = vec!["protos/aconfig_storage_metadata.proto"]; // tell cargo to only re-run the build script if any of the proto files has changed for path in &proto_files { println!("cargo:rerun-if-changed={}", path); } Codegen::new() .pure() .include("protos") .inputs(proto_files) .cargo_out_dir("aconfig_storage_protos") .run_from_script(); } tools/aconfig/aconfig_storage_file/protos/aconfig_storage_metadata.proto 0 → 100644 +34 −0 Original line number Diff line number Diff line // Copyright (C) 2024 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License // This is the schema definition for aconfig files. Modifications need to be // either backwards compatible, or include updates to all aconfig files in the // Android tree. syntax = "proto2"; package android.aconfig_storage_metadata; message storage_file_info { optional uint32 version = 1; optional string container = 2; optional string package_map = 3; optional string flag_map = 4; optional string flag_val = 5; optional int64 timestamp = 6; } message storage_files { repeated storage_file_info files = 1; }; tools/aconfig/aconfig_storage_file/src/lib.rs +4 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,10 @@ pub mod flag_table; pub mod flag_value; pub mod package_table; mod protos; #[cfg(test)] mod test_utils; use anyhow::{anyhow, Result}; use std::collections::hash_map::DefaultHasher; use std::hash::{Hash, Hasher}; Loading Loading
tools/aconfig/aconfig_storage_file/Android.bp +11 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,9 @@ rust_defaults { srcs: ["src/lib.rs"], rustlibs: [ "libanyhow", "libaconfig_storage_protos", "libonce_cell", "libprotobuf", ], } Loading @@ -24,3 +27,11 @@ rust_test_host { test_suites: ["general-tests"], defaults: ["aconfig_storage_file.defaults"], } 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, }
tools/aconfig/aconfig_storage_file/Cargo.toml +4 −0 Original line number Diff line number Diff line Loading @@ -9,3 +9,7 @@ cargo = [] [dependencies] anyhow = "1.0.69" protobuf = "3.2.0" [build-dependencies] protobuf-codegen = "3.2.0"
tools/aconfig/aconfig_storage_file/build.rs 0 → 100644 +17 −0 Original line number Diff line number Diff line use protobuf_codegen::Codegen; fn main() { let proto_files = vec!["protos/aconfig_storage_metadata.proto"]; // tell cargo to only re-run the build script if any of the proto files has changed for path in &proto_files { println!("cargo:rerun-if-changed={}", path); } Codegen::new() .pure() .include("protos") .inputs(proto_files) .cargo_out_dir("aconfig_storage_protos") .run_from_script(); }
tools/aconfig/aconfig_storage_file/protos/aconfig_storage_metadata.proto 0 → 100644 +34 −0 Original line number Diff line number Diff line // Copyright (C) 2024 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License // This is the schema definition for aconfig files. Modifications need to be // either backwards compatible, or include updates to all aconfig files in the // Android tree. syntax = "proto2"; package android.aconfig_storage_metadata; message storage_file_info { optional uint32 version = 1; optional string container = 2; optional string package_map = 3; optional string flag_map = 4; optional string flag_val = 5; optional int64 timestamp = 6; } message storage_files { repeated storage_file_info files = 1; };
tools/aconfig/aconfig_storage_file/src/lib.rs +4 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,10 @@ pub mod flag_table; pub mod flag_value; pub mod package_table; mod protos; #[cfg(test)] mod test_utils; use anyhow::{anyhow, Result}; use std::collections::hash_map::DefaultHasher; use std::hash::{Hash, Hasher}; Loading