Merge "Handle the case where the release value set is a list." into main am: f613da45db am: 81b7edc4ae am: 4af9447c20 am: bff73dd63b am: e02078582f

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

Change-Id: I940607fe865a71b50151a9efb24a730cbcca0cd7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Yu Liu
2023-10-14 06:12:24 +00:00
committed by Automerger Merge Worker
5 changed files with 59 additions and 17 deletions

View File

@@ -200,21 +200,23 @@ func (c Config) ReleaseVersion() string {
}
// The aconfig value set passed to aconfig, derived from RELEASE_VERSION
func (c Config) ReleaseAconfigValueSets() string {
func (c Config) ReleaseAconfigValueSets() []string {
// This logic to handle both Soong module name and bazel target is temporary in order to
// provide backward compatibility where aosp and internal both have the release
// aconfig value set but can't be updated at the same time to use bazel target
value := strings.Split(c.config.productVariables.ReleaseAconfigValueSets, ":")
value_len := len(value)
if value_len > 2 {
// This shouldn't happen as this should be either a module name or a bazel target path.
panic(fmt.Errorf("config file: invalid value for release aconfig value sets: %s",
c.config.productVariables.ReleaseAconfigValueSets))
var valueSets []string
for _, valueSet := range c.config.productVariables.ReleaseAconfigValueSets {
value := strings.Split(valueSet, ":")
valueLen := len(value)
if valueLen > 2 {
// This shouldn't happen as this should be either a module name or a bazel target path.
panic(fmt.Errorf("config file: invalid value for release aconfig value sets: %s", valueSet))
}
if valueLen > 0 {
valueSets = append(valueSets, value[valueLen-1])
}
}
if value_len > 0 {
return value[value_len-1]
}
return ""
return valueSets
}
// The flag default permission value passed to aconfig