summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yuntao Xu <yuntaoxu@google.com> 2021-08-09 15:44:44 -0700
committer Yuntao Xu <yuntaoxu@google.com> 2021-08-11 12:33:37 -0700
commit402e9b08e1331fec2da05daf14f0badd2014e36f (patch)
tree061ecaef83ed7819a92c4a2268b3334fc749fffe
parent0bcba80823b07b5e12f655fde6f9c019d1a0d03d (diff)
Add Platform_sdk_version_or_codename variable
1. Added a new product variable Platform_sdk_version_or_codename; 2. This variable is used to support the logic in the Android.bp file when either the Platform_sdk_version or the Platform_sdk_codename is used. Bug: 195986342 Test: m CtsThemeHostTestCases (the module where the product variable is used) Test: TreeHugger Change-Id: I6b952ce47fd4adc280aa3c7ef4185487558af9bc
-rw-r--r--android/config.go14
-rw-r--r--android/variable.go5
2 files changed, 19 insertions, 0 deletions
diff --git a/android/config.go b/android/config.go
index b3b8f3cc2..e3d05a67e 100644
--- a/android/config.go
+++ b/android/config.go
@@ -209,6 +209,20 @@ func loadFromConfigFile(configurable *productVariables, filename string) error {
Bool(configurable.GcovCoverage) ||
Bool(configurable.ClangCoverage))
+ // when Platform_sdk_final is true (or PLATFORM_VERSION_CODENAME is REL), use Platform_sdk_version;
+ // if false (pre-released version, for example), use Platform_sdk_codename.
+ if Bool(configurable.Platform_sdk_final) {
+ if configurable.Platform_sdk_version != nil {
+ configurable.Platform_sdk_version_or_codename =
+ proptools.StringPtr(strconv.Itoa(*(configurable.Platform_sdk_version)))
+ } else {
+ return fmt.Errorf("Platform_sdk_version cannot be pointed by a NULL pointer")
+ }
+ } else {
+ configurable.Platform_sdk_version_or_codename =
+ proptools.StringPtr(String(configurable.Platform_sdk_codename))
+ }
+
return saveToBazelConfigFile(configurable, filepath.Dir(filename))
}
diff --git a/android/variable.go b/android/variable.go
index 0fb907810..5cf9aa8e8 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -42,6 +42,10 @@ type variableProperties struct {
Cflags []string
}
+ Platform_sdk_version_or_codename struct {
+ Java_resource_dirs []string
+ }
+
// unbundled_build is a catch-all property to annotate modules that don't build in one or
// more unbundled branches, usually due to dependencies missing from the manifest.
Unbundled_build struct {
@@ -164,6 +168,7 @@ type productVariables struct {
Platform_version_name *string `json:",omitempty"`
Platform_sdk_version *int `json:",omitempty"`
Platform_sdk_codename *string `json:",omitempty"`
+ Platform_sdk_version_or_codename *string `json:",omitempty"`
Platform_sdk_final *bool `json:",omitempty"`
Platform_version_active_codenames []string `json:",omitempty"`
Platform_vndk_version *string `json:",omitempty"`