Support aconfig_declarations, aconfig_values and aconfig_value_set
Bug: 297356603
Test: Unit tests
Change-Id: I2f797578a35322440db0f281b4d46b6652512e00
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go
index ababd4c..1de14cb 100644
--- a/android/allowlists/allowlists.go
+++ b/android/allowlists/allowlists.go
@@ -928,6 +928,9 @@
"java_sdk_library",
"sysprop_library",
"xsd_config",
+ "aconfig_declarations",
+ "aconfig_values",
+ "aconfig_value_set",
}
// Add the names of modules that bp2build should never convert, if it is
diff --git a/android/config.go b/android/config.go
index 645a263..445c6cd 100644
--- a/android/config.go
+++ b/android/config.go
@@ -197,9 +197,22 @@
return c.config.productVariables.ReleaseVersion
}
-// The flag values files passed to aconfig, derived from RELEASE_VERSION
-func (c Config) ReleaseAconfigValueSets() []string {
- return c.config.productVariables.ReleaseAconfigValueSets
+// The aconfig value set passed to aconfig, derived from RELEASE_VERSION
+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 vendor/google 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))
+ }
+ if value_len > 0 {
+ return value[value_len-1]
+ }
+ return ""
}
// The flag default permission value passed to aconfig
diff --git a/android/variable.go b/android/variable.go
index 02eff25..3ca7963 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -475,8 +475,8 @@
ProductBrand string `json:",omitempty"`
BuildVersionTags []string `json:",omitempty"`
- ReleaseVersion string `json:",omitempty"`
- ReleaseAconfigValueSets []string `json:",omitempty"`
+ ReleaseVersion string `json:",omitempty"`
+ ReleaseAconfigValueSets string `json:",omitempty"`
ReleaseAconfigFlagDefaultPermission string `json:",omitempty"`