Revert "release_config: build flags can be lists"
Revert submission 2787001-product-build-flags Reason for revert: Possible cause of b/308849337 Reverted changes: /q/submissionid:2787001-product-build-flags Bug: 302593603 Bug: 308849337 Change-Id: I6246d20201e674ba99faf6b880ecdc7ef934c653
This commit is contained in:
committed by
Gerrit Code Review
parent
1dc07fa574
commit
b05eaac092
@@ -55,11 +55,6 @@ _all_flags_schema = {
|
||||
},
|
||||
"declared_in": {"type": "string"},
|
||||
},
|
||||
"optional_keys": {
|
||||
"appends": {
|
||||
"type": "bool",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -80,23 +75,17 @@ _all_values_schema = {
|
||||
},
|
||||
}
|
||||
|
||||
def flag(name, partitions, default, _kwmarker = (), appends = False):
|
||||
def flag(name, partitions, default):
|
||||
"""Declare a flag.
|
||||
|
||||
Args:
|
||||
name: name of the flag
|
||||
partitions: the partitions where this should be recorded.
|
||||
default: the default value of the flag.
|
||||
_kwmarker: Used to detect argument misuse.
|
||||
appends: Whether new values should be append (not replace) the old.
|
||||
|
||||
Returns:
|
||||
A dictionary containing the flag declaration.
|
||||
"""
|
||||
|
||||
# If specified, appends must be a keyword value.
|
||||
if _kwmarker != ():
|
||||
fail("Too many positional parameters")
|
||||
if not partitions:
|
||||
fail("At least 1 partition is required")
|
||||
if not name.startswith("RELEASE_"):
|
||||
@@ -116,7 +105,6 @@ def flag(name, partitions, default, _kwmarker = (), appends = False):
|
||||
"name": name,
|
||||
"partitions": partitions,
|
||||
"default": default,
|
||||
"appends": appends,
|
||||
}
|
||||
|
||||
def value(name, value):
|
||||
@@ -165,12 +153,10 @@ def release_config(all_flags, all_values):
|
||||
|
||||
# Validate flags
|
||||
flag_names = []
|
||||
flags_dict = {}
|
||||
for flag in all_flags:
|
||||
if flag["name"] in flag_names:
|
||||
fail(flag["declared_in"] + ": Duplicate declaration of flag " + flag["name"])
|
||||
flag_names.append(flag["name"])
|
||||
flags_dict[flag["name"]] = flag
|
||||
|
||||
# Record which flags go on which partition
|
||||
partitions = {}
|
||||
@@ -184,21 +170,13 @@ def release_config(all_flags, all_values):
|
||||
else:
|
||||
partitions.setdefault(partition, []).append(flag["name"])
|
||||
|
||||
# Generate final values.
|
||||
# Only declared flags may have a value.
|
||||
# Validate values
|
||||
# TODO(joeo): Disallow duplicate values after we've split AOSP and vendor flags.
|
||||
values = {}
|
||||
for value in all_values:
|
||||
name = value["name"]
|
||||
if name not in flag_names:
|
||||
fail(value["set_in"] + ": Value set for undeclared build flag: " + name)
|
||||
if flags_dict[name]["appends"]:
|
||||
if name in values:
|
||||
values[name]["value"] += " " + value["value"]
|
||||
values[name]["set_in"] += " " + value["set_in"]
|
||||
else:
|
||||
values[name] = value
|
||||
else:
|
||||
values[name] = value
|
||||
if value["name"] not in flag_names:
|
||||
fail(value["set_in"] + ": Value set for undeclared build flag: " + value["name"])
|
||||
values[value["name"]] = value
|
||||
|
||||
# Collect values
|
||||
result = {
|
||||
|
Reference in New Issue
Block a user