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 flag_declaration {
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  // reserve this for bug, if needed.
71  reserved 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 flag_value {
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
101// This replaces $(call declare-release-config).
102message release_config {
103  // The name of the release config.
104  // See # name for format detail
105  optional string name = 1;
106
107  // From which other release configs does this one inherit?
108  repeated string inherits = 2;
109
110  // List of names of the aconfig_value_set soong module(s) for this
111  // contribution.
112  repeated string aconfig_value_sets = 3;
113
114  // Only aconfig flags are allowed in this release config.
115  optional bool aconfig_flags_only = 4;
116
117  // Prior stage(s) for flag advancement (during development).
118  // Once a flag has met criteria in a prior stage, it can advance to this one.
119  repeated string prior_stages = 5;
120}
121
122// Any aliases.  These are used for continuous integration builder config.
123message release_alias {
124  // The name of the alias.
125  optional string name = 1;
126
127  // The release that `name` is an alias for.
128  optional string target = 2;
129}
130
131// This provides the data from release_config_map.mk
132message release_config_map {
133  // Any aliases.
134  repeated release_alias aliases = 1;
135
136  // Description of this map and its intended use.
137  optional string description = 2;
138
139  // The default container for flags declared here.
140  repeated string default_containers = 3;
141
142  // If needed, we can add these fields instead of hardcoding the location.
143  // Flag declarations: `flag_declarations/*.textproto`
144  // Release config contributions: `release_configs/*.textproto`
145  // Flag values: `flag_values/{RELEASE_NAME}/*.textproto`
146}
147