Merge "Allow and merge multiple release configs with the same name" am: ac57d98b87 am: caee07b951 am: 6f23f12697

Original change: https://android-review.googlesource.com/c/platform/build/+/2622584

Change-Id: If75b68308bfe08717d616345c0c882e812ad7b99
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Joe Onorato 2023-06-13 17:23:32 +00:00 committed by Automerger Merge Worker
commit 6ccc3a5f58
2 changed files with 19 additions and 7 deletions

View file

@ -88,6 +88,7 @@ def release_config(all_flags, all_values):
partitions.setdefault(partition, []).append(flag["name"]) partitions.setdefault(partition, []).append(flag["name"])
# Validate values # Validate values
# TODO(joeo): Disallow duplicate values after we've split AOSP and vendor flags.
values = {} values = {}
for value in all_values: for value in all_values:
if value["name"] not in flag_names: if value["name"] not in flag_names:

View file

@ -16,6 +16,22 @@
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# Choose the flag files # Choose the flag files
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# Release configs are defined in reflease_config_map files, which map
# the short name (e.g. -next) used in lunch to the starlark files
# defining the build flag values.
#
# (If you're thinking about aconfig flags, there is one build flag,
# RELEASE_DEVICE_CONFIG_VALUE_SETS, that sets which device_config_value_set
# module to use to set the aconfig flag values.)
#
# The short release config names *can* appear multiple times, to allow
# for AOSP and vendor specific flags under the same name, but the
# individual flag values must appear in exactly one config. Vendor
# does not override AOSP, or anything like that. This is because
# vendor code usually includes prebuilts, and having vendor compile
# with different flags from AOSP increases the likelihood of flag
# mismatch.
# Do this first, because we're going to unset TARGET_RELEASE before # Do this first, because we're going to unset TARGET_RELEASE before
# including anyone, so they don't start making conditionals based on it. # including anyone, so they don't start making conditionals based on it.
# This logic is in make because starlark doesn't understand optional # This logic is in make because starlark doesn't understand optional
@ -39,17 +55,12 @@ config_map_files := $(wildcard build/release/release_config_map.mk) \
# $1 config name # $1 config name
# $2 release config files # $2 release config files
define declare-release-config define declare-release-config
$(eval # No duplicates)
$(if $(filter $(_all_release_configs), $(strip $(1))), \
$(error declare-release-config: config $(strip $(1)) declared in: $(_included) Previously declared here: $(_all_release_configs.$(strip $(1)).DECLARED_IN)) \
)
$(eval # Must have release config files)
$(if $(strip $(2)),, \ $(if $(strip $(2)),, \
$(error declare-release-config: config $(strip $(1)) must have release config files) \ $(error declare-release-config: config $(strip $(1)) must have release config files) \
) )
$(eval _all_release_configs := $(sort $(_all_release_configs) $(strip $(1)))) $(eval _all_release_configs := $(sort $(_all_release_configs) $(strip $(1))))
$(eval _all_release_configs.$(strip $(1)).DECLARED_IN := $(_included)) $(eval _all_release_configs.$(strip $(1)).DECLARED_IN := $(_included) $(_all_release_configs.$(strip $(1)).DECLARED_IN))
$(eval _all_release_configs.$(strip $(1)).FILES := $(strip $(2))) $(eval _all_release_configs.$(strip $(1)).FILES := $(_all_release_configs.$(strip $(1)).FILES) $(strip $(2)))
endef endef
# Include the config map files # Include the config map files