aboutsummaryrefslogtreecommitdiffstats
path: root/android/variable.go
diff options
context:
space:
mode:
Diffstat (limited to 'android/variable.go')
-rw-r--r--android/variable.go22
1 files changed, 20 insertions, 2 deletions
diff --git a/android/variable.go b/android/variable.go
index f4aaec7a..6af4f7e1 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -20,6 +20,8 @@ import (
"runtime"
"strings"
+ "lineage/soong/android"
+
"github.com/google/blueprint/proptools"
)
@@ -114,6 +116,9 @@ type variableProperties struct {
Static_libs []string
Srcs []string
}
+
+ // include Lineage variables
+ Lineage android.Product_variables
} `android:"arch_variant"`
}
@@ -230,6 +235,9 @@ type productVariables struct {
PgoAdditionalProfileDirs []string `json:",omitempty"`
VendorVars map[string]map[string]string `json:",omitempty"`
+
+ // include Lineage variables
+ Lineage android.ProductVariables
}
func boolPtr(v bool) *bool {
@@ -289,7 +297,14 @@ func variableMutator(mctx BottomUpMutatorContext) {
a := module.base()
variableValues := reflect.ValueOf(&a.variableProperties.Product_variables).Elem()
zeroValues := reflect.ValueOf(zeroProductVariables.Product_variables)
+ valStruct := reflect.ValueOf(mctx.Config().productVariables)
+
+ doVariableMutation(mctx, a, variableValues, zeroValues, valStruct)
+
+}
+func doVariableMutation(mctx BottomUpMutatorContext, a *ModuleBase, variableValues reflect.Value, zeroValues reflect.Value,
+ valStruct reflect.Value) {
for i := 0; i < variableValues.NumField(); i++ {
variableValue := variableValues.Field(i)
zeroValue := zeroValues.Field(i)
@@ -297,8 +312,11 @@ func variableMutator(mctx BottomUpMutatorContext) {
property := "product_variables." + proptools.PropertyNameForField(name)
// Check that the variable was set for the product
- val := reflect.ValueOf(mctx.Config().productVariables).FieldByName(name)
- if !val.IsValid() || val.Kind() != reflect.Ptr || val.IsNil() {
+ val := valStruct.FieldByName(name)
+ if val.IsValid() && val.Kind() == reflect.Struct {
+ doVariableMutation(mctx, a, variableValue, zeroValue, val)
+ continue
+ } else if !val.IsValid() || val.Kind() != reflect.Ptr || val.IsNil() {
continue
}