Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0b6b92e5 authored by Mårten Kongstad's avatar Mårten Kongstad Committed by Gerrit Code Review
Browse files

Merge changes from topic "aconfig-part-1"

* changes:
  aconfig: add support for changing flag value based on build
  aconfig: introduce cache
  aconfig: define Aconfig proto
  aconfig: add support for cargo
parents 047ed4ab 09c28d16
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
/Cargo.lock
/target
+4 −0
Original line number Diff line number Diff line
@@ -18,7 +18,11 @@ rust_defaults {
    srcs: ["src/main.rs"],
    rustlibs: [
        "libaconfig_protos",
        "libanyhow",
        "libclap",
        "libprotobuf",
        "libserde",
        "libserde_json",
    ],
}

+19 −0
Original line number Diff line number Diff line
[package]
name = "aconfig"
version = "0.1.0"
edition = "2021"
build = "build.rs"

[features]
default = ["cargo"]
cargo = []

[dependencies]
anyhow = "1.0.69"
clap = { version = "4.1.8", features = ["derive"] }
protobuf = "3.2.0"
serde = { version = "1.0.152", features = ["derive"] }
serde_json = "1.0.93"

[build-dependencies]
protobuf-codegen = "3.2.0"

tools/aconfig/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.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_proto")
        .run_from_script();
}
+26 −4
Original line number Diff line number Diff line
@@ -12,12 +12,34 @@
// See the License for the specific language governing permissions and
// limitations under the License

// Placeholder proto file. Will be replaced by actual contents.
// This is the schema definition for of Aconfig files. Modifications need to be
// either backwards compatible, or include updates to all Aconfig files in the
// Android tree.

syntax = "proto3";
syntax = "proto2";

package android.aconfig;

message Placeholder {
  string name = 1;
message value {
  required bool value = 1;
  optional uint32 since = 2;
}

message flag {
  required string id = 1;
  required string description = 2;
  repeated value value = 3;
};

message android_config {
  repeated flag flag = 1;
};

message override {
  required string id = 1;
  required bool value = 2;
};

message override_config {
  repeated override override = 1;
};
Loading