Simplify vendor conditionals
Support vendor conditionals with no Go code.
Test: TestSoongConfigModule
Change-Id: I42546e7f17324921ada80f4d8e1cd399830f8dfc
diff --git a/android/config.go b/android/config.go
index 5c4f0a8..769119a 100644
--- a/android/config.go
+++ b/android/config.go
@@ -29,6 +29,8 @@
"github.com/google/blueprint/bootstrap"
"github.com/google/blueprint/pathtools"
"github.com/google/blueprint/proptools"
+
+ "android/soong/android/soongconfig"
)
var Bool = proptools.Bool
@@ -66,19 +68,7 @@
*deviceConfig
}
-type VendorConfig interface {
- // Bool interprets the variable named `name` as a boolean, returning true if, after
- // lowercasing, it matches one of "1", "y", "yes", "on", or "true". Unset, or any other
- // value will return false.
- Bool(name string) bool
-
- // String returns the string value of `name`. If the variable was not set, it will
- // return the empty string.
- String(name string) string
-
- // IsSet returns whether the variable `name` was set by Make.
- IsSet(name string) bool
-}
+type VendorConfig soongconfig.SoongConfig
type config struct {
FileConfigurableOptions
@@ -128,8 +118,6 @@
OncePer
}
-type vendorConfig map[string]string
-
type jsonConfigurable interface {
SetDefaultConfig()
}
@@ -1137,21 +1125,7 @@
}
func (c *config) VendorConfig(name string) VendorConfig {
- return vendorConfig(c.productVariables.VendorVars[name])
-}
-
-func (c vendorConfig) Bool(name string) bool {
- v := strings.ToLower(c[name])
- return v == "1" || v == "y" || v == "yes" || v == "on" || v == "true"
-}
-
-func (c vendorConfig) String(name string) string {
- return c[name]
-}
-
-func (c vendorConfig) IsSet(name string) bool {
- _, ok := c[name]
- return ok
+ return soongconfig.Config(c.productVariables.VendorVars[name])
}
func (c *config) NdkAbis() bool {