Merge "Simplify vendor conditionals"

This commit is contained in:
Colin Cross
2020-01-27 19:03:23 +00:00
committed by Gerrit Code Review
12 changed files with 1479 additions and 57 deletions

View File

@@ -29,6 +29,8 @@ import (
"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 @@ type DeviceConfig struct {
*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 @@ type deviceConfig struct {
OncePer
}
type vendorConfig map[string]string
type jsonConfigurable interface {
SetDefaultConfig()
}
@@ -1141,21 +1129,7 @@ func (c *config) XOMDisabledForPath(path string) bool {
}
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 {