Files
build/tools/aconfig/protos/aconfig.proto
Mårten Kongstad a2e5ab82c7 aconfig: make proto fields optional
Change all required proto fields to optional. While the proto file is
supposed to be a backwards compatible API, and fields are not supposed
to be deprecated, this commit will allow for that option if needed.

Implementation wise this change doesn't matter much: any parsed data
needs additional verification outside what the protobuf crate's parser
provides anyway, so adding checks to verify that all required fields,
even though marked optional in the proto file, were found is a minor
increase in code complexity.

If in the future a proto field should no longer be used:

  - keep the field in the proto, still marked optional and clearly
    document that it is no longer in use
  - change protos.rs from checking struct.has_field() to explicitly
    dropping any value via struct.clear_field()

Bug: 286337317
Test: atest aconfig.test
Change-Id: Iad1ccfe50ecac286ff7a796aec909bec70b9520d
2023-06-19 16:53:22 +02:00

81 lines
2.0 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;
};
message flag_declarations {
optional string package = 1;
repeated flag_declaration flag = 2;
};
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;
optional flag_state state = 5;
optional flag_permission permission = 6;
repeated tracepoint trace = 7;
}
message parsed_flags {
repeated parsed_flag parsed_flag = 1;
}