Files
build/tools/aconfig/aconfig_protos/protos/aconfig.proto
Dennis Shen c77c6612e7 Restructure aconfig repo to be a cargo workspace with many crates
This is cherry pick of aosp/2924191 to avoid merge conflict in git main

Previously, aconfig repo is the root directory of aconfig binary crate,
but it also hosts printflags crate inside, and there is no cargo support
for printflags binary crate. In addition, with more aconfig development,
more crates are being added to this repo. Thus this repo should be
configured as a Cargo workspace with multiple crates rather than a
single crate.

Note the top level Cargo.toml file specifies the crates this workspace
carries:
(1) aconfig_protos: the proto library crate that will be used by many other
crates such as aconfig binary crate and printflags binary crate
(2) aconfig: the aconfig binary crate
(3) printflags: the printflags binary crate

(1) aconfig_protos crate setup:

Inside aconfig_protos dir we set up the aconfig_protos crate, the
previously src/proto.rs is now aconfig_protos/src/lib.rs, the build.rs
is carried over to this crate.

(2) aconfig binary crate setup:

Notice its Cargo.toml file claims package dependency on aconfig_protos
crate. It no longer carries proto related module and build.rs file.

(3) printflags binary crate setup:

Similary, notice that in its Cargo.toml file, it claims package
dependency on aconfig_protos crate.

With this setup, we can Cargo build/test each crate individually when
inside a specific crate dir. But we can also run Cargo build/test at
repo root level, which will build/test all the crates in this workplace.

This is the structuring cl. The next cl is to move storage modules into
its own library crate. This storage file library crate will be used by
both aconfig binary crate as well as flag read library crate (to be
created as another new crate here).

Bug: b/321984352
Test: top and individual crate dir level Cargo build/test, m each
individual targets

Ignore-AOSP-First: cherrypick to git main to resolve merge conflict
Change-Id: I75833f4997f7ee554ff6c1557df9ac87f62b2732
2024-01-24 02:17:57 +00:00

105 lines
2.8 KiB
Protocol Buffer

// Copyright (C) 2023 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;
// messages used in both aconfig input and output
enum flag_state {
ENABLED = 1;
DISABLED = 2;
}
enum flag_permission {
READ_ONLY = 1;
READ_WRITE = 2;
}
// aconfig input messages: flag declarations and values
message flag_declaration {
optional string name = 1;
optional string namespace = 2;
optional string description = 3;
repeated string bug = 4;
optional bool is_fixed_read_only = 5;
optional bool is_exported = 6;
optional flag_metadata metadata = 7;
};
// Optional metadata about the flag, such as its purpose and its intended form factors.
// Can influence the applied policies and testing strategy.
message flag_metadata {
enum flag_purpose {
PURPOSE_UNSPECIFIED = 0;
PURPOSE_FEATURE = 1;
PURPOSE_BUGFIX = 2;
}
optional flag_purpose purpose = 1;
// TODO(b/315025930): Add field to designate intended target device form factor(s), such as phone, watch or other.
}
message flag_declarations {
optional string package = 1;
repeated flag_declaration flag = 2;
optional string container = 3;
};
message flag_value {
optional string package = 1;
optional string name = 2;
optional flag_state state = 3;
optional flag_permission permission = 4;
};
message flag_values {
repeated flag_value flag_value = 1;
};
// aconfig output messages: parsed and verified flag declarations and values
message tracepoint {
// path to declaration or value file relative to $TOP
optional string source = 1;
optional flag_state state = 2;
optional flag_permission permission = 3;
}
message parsed_flag {
optional string package = 1;
optional string name = 2;
optional string namespace = 3;
optional string description = 4;
repeated string bug = 5;
optional flag_state state = 6;
optional flag_permission permission = 7;
repeated tracepoint trace = 8;
optional bool is_fixed_read_only = 9;
optional bool is_exported = 10;
optional string container = 11;
optional flag_metadata metadata = 12;
}
message parsed_flags {
repeated parsed_flag parsed_flag = 1;
}