aboutsummaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2018-03-12 15:30:26 -0700
committerDan Willemsen <dwillemsen@google.com>2018-04-17 10:34:23 -0700
commit050ca73dbfdd360a209daf93a6f7d059a8705569 (patch)
tree3332693a54c93fb13b220f44ea3a5ea7e171a65a /android
parente9216117dd376aa48476c0ef448fcbd818961861 (diff)
downloadbuild_soong-050ca73dbfdd360a209daf93a6f7d059a8705569.tar.gz
build_soong-050ca73dbfdd360a209daf93a6f7d059a8705569.tar.bz2
build_soong-050ca73dbfdd360a209daf93a6f7d059a8705569.zip
Use Config/DeviceConfig functions to access ProductVariables
An upcoming change will stop exporting ProductVariables from Config, so switch to using existing accessor functions, and add more when they're missing. Bug: 76168832 Test: out/soong/build.ninja is identical Change-Id: Ie0135bdbd2df3258ef3ddb53e5f8fc00aa9b97f7 Merged-In: Ie0135bdbd2df3258ef3ddb53e5f8fc00aa9b97f7 (cherry picked from commit 3fb1faeeb98143e132ca4d6f1cac42d6f060888b)
Diffstat (limited to 'android')
-rw-r--r--android/config.go31
-rw-r--r--android/makevars.go5
2 files changed, 36 insertions, 0 deletions
diff --git a/android/config.go b/android/config.go
index db833eca..e14f42ee 100644
--- a/android/config.go
+++ b/android/config.go
@@ -641,6 +641,37 @@ func (c *config) ArtUseReadBarrier() bool {
return Bool(c.ProductVariables.ArtUseReadBarrier)
}
+func (c *config) EnforceRROForModule(name string) bool {
+ enforceList := c.ProductVariables.EnforceRROTargets
+ if enforceList != nil {
+ if len(*enforceList) == 1 && (*enforceList)[0] == "*" {
+ return true
+ }
+ return InList(name, *enforceList)
+ }
+ return false
+}
+
+func (c *config) EnforceRROExcludedOverlay(path string) bool {
+ excluded := c.ProductVariables.EnforceRROExcludedOverlays
+ if excluded != nil {
+ for _, exclude := range *excluded {
+ if strings.HasPrefix(path, exclude) {
+ return true
+ }
+ }
+ }
+ return false
+}
+
+func (c *config) ExportedNamespaces() []string {
+ return append([]string(nil), c.ProductVariables.NamespacesToExport...)
+}
+
+func (c *config) HostStaticBinaries() bool {
+ return Bool(c.ProductVariables.HostStaticBinaries)
+}
+
func (c *deviceConfig) Arches() []Arch {
var arches []Arch
for _, target := range c.config.Targets[Device] {
diff --git a/android/makevars.go b/android/makevars.go
index b6cd571f..37923575 100644
--- a/android/makevars.go
+++ b/android/makevars.go
@@ -36,6 +36,7 @@ func androidMakeVarsProvider(ctx MakeVarsContext) {
// Interface for other packages to use to declare make variables
type MakeVarsContext interface {
Config() Config
+ DeviceConfig() DeviceConfig
SingletonContext() SingletonContext
// Verify the make variable matches the Soong version, fail the build
@@ -231,6 +232,10 @@ func (c *makeVarsContext) Config() Config {
return c.config
}
+func (c *makeVarsContext) DeviceConfig() DeviceConfig {
+ return DeviceConfig{c.config.deviceConfig}
+}
+
func (c *makeVarsContext) SingletonContext() SingletonContext {
return c.ctx
}