xref: /aosp_15_r20/build/soong/cmd/release_config/release_config_proto/build_flags_src.proto (revision 333d2b3687b3a337dbcca9d65000bca186795e39)
1//
2// Copyright (C) 2024 The Android Open-Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//   http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16syntax = "proto2";
17package android.release_config_proto;
18option go_package = "android/soong/release_config/release_config_proto";
19
20import "build_flags_common.proto";
21
22// This protobuf file defines messages used to represent the build flags used by
23// a release in a more human-editable form.  It is used for on-disk files in the
24// source tree.
25//
26// The following format requirements apply across various message fields:
27//
28// # name: name of the flag
29//
30//    format: an uppercase string in SNAKE_CASE format starting with RELEASE_,
31//      no consecutive underscores, and no leading digit. For example
32//      RELEASE_MY_PACKAGE_FLAG is a valid name, while MY_PACKAGE_FLAG, and
33//      RELEASE_MY_PACKAGE__FLAG are invalid.
34//
35// # namespace: namespace the flag belongs to
36//
37//    format: a lowercase string in snake_case format, no consecutive underscores, and no leading
38//      digit. For example android_bar_system
39//
40// # package: package to which the flag belongs
41//
42//    format: lowercase strings in snake_case format, delimited by dots, no
43//      consecutive underscores and no leading digit in each string. For example
44//      com.android.mypackage is a valid name while com.android.myPackage,
45//      com.android.1mypackage are invalid
46
47message Value {
48  oneof val {
49    bool unspecified_value = 200;
50    string string_value = 201;
51    bool bool_value = 202;
52    // If true, the flag is obsolete.  Assigning it further will be flagged.
53    bool obsolete = 203;
54  }
55}
56
57// The proto used in the source tree.
58message FlagDeclaration {
59  // The name of the flag.
60  // See # name for format detail
61  optional string name = 1;
62
63  // Namespace the flag belongs to (required)
64  // See # namespace for format detail
65  optional string namespace = 2;
66
67  // Text description of the flag's purpose.
68  optional string description = 3;
69
70  // The bug number associated with the flag.
71  repeated string bugs = 4;
72
73  // Value for the flag
74  optional Value value = 201;
75
76  // Workflow for this flag.
77  optional Workflow workflow = 205;
78
79  // The container for this flag.  This overrides any default container given
80  // in the release_config_map message.
81  repeated string containers = 206;
82
83  // The package associated with this flag.
84  // (when Gantry is ready for it) optional string package = 207;
85  reserved 207;
86}
87
88message FlagValue {
89  // Name of the flag.
90  // See # name for format detail
91  optional string name = 2;
92
93  // Value for the flag
94  optional Value value = 201;
95
96  // If true, the flag is completely removed from the release config as if
97  // never declared.
98  optional bool redacted = 202;
99}
100
101enum ReleaseConfigType {
102  // This is treated as `RELEASE_CONFIG`.
103  CONFIG_TYPE_UNSPECIFIED = 0;
104
105  // This is a normal release config.  This is the only ReleaseConfigType with
106  // implicit inheritance.
107  RELEASE_CONFIG = 1;
108
109  // Same as RELEASE_CONFIG, except no implicit inheritance happens.
110  // This is the "root" release config.
111  EXPLICIT_INHERITANCE_CONFIG = 2;
112
113  // This is a release config applied based on the TARGET_BUILD_VARIANT
114  // environment variable, if the build flag RELEASE_BUILD_USE_VARIANT_FLAGS is
115  // enabled.
116  BUILD_VARIANT = 3;
117}
118
119// This replaces $(call declare-release-config).
120message ReleaseConfig {
121  // The name of the release config.
122  // See # name for format detail
123  optional string name = 1;
124
125  // From which other release configs does this one inherit?
126  repeated string inherits = 2;
127
128  // List of names of the aconfig_value_set soong module(s) for this
129  // contribution.
130  repeated string aconfig_value_sets = 3;
131
132  // Only aconfig flags are allowed in this release config.
133  optional bool aconfig_flags_only = 4;
134
135  // Prior stage(s) for flag advancement (during development).
136  // Once a flag has met criteria in a prior stage, it can advance to this one.
137  repeated string prior_stages = 5;
138
139  // The ReleaseConfigType of this release config.
140  optional ReleaseConfigType release_config_type = 6;
141}
142
143// Any aliases.  These are used for continuous integration builder config.
144message ReleaseAlias {
145  // The name of the alias.
146  optional string name = 1;
147
148  // The release that `name` is an alias for.
149  optional string target = 2;
150}
151
152// This provides the data from release_config_map.mk
153message ReleaseConfigMap {
154  // Any aliases.
155  repeated ReleaseAlias aliases = 1;
156
157  // Description of this map and its intended use.
158  optional string description = 2;
159
160  // The default container for flags declared here.
161  repeated string default_containers = 3;
162
163  // If needed, we can add these fields instead of hardcoding the location.
164  // Flag declarations: `flag_declarations/*.textproto`
165  // Release config contributions: `release_configs/*.textproto`
166  // Flag values: `flag_values/{RELEASE_NAME}/*.textproto`
167}
168