aboutsummaryrefslogtreecommitdiffstats
path: root/android/variable.go
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2018-03-26 12:41:18 -0700
committerDan Willemsen <dwillemsen@google.com>2018-04-17 10:34:23 -0700
commit8328367c44085b948c003116c0ed74a047237a69 (patch)
tree9c57edfd06e098474a2db4da9bf38821be7865fb /android/variable.go
parentd57ed550fd57c9c6c1093c1368480dfab17ef79a (diff)
downloadbuild_soong-8328367c44085b948c003116c0ed74a047237a69.tar.gz
build_soong-8328367c44085b948c003116c0ed74a047237a69.tar.bz2
build_soong-8328367c44085b948c003116c0ed74a047237a69.zip
Add VendorConfig for board-level Soong plugin configuration
This allows Soong (Go) plugins to get custom configurations set in the current product's BoardConfig.mk. I'll have some more comprehensive documentation later, but the general concept is that you'd have one namespace per plugin, defined in the BoardConfig.mk (though they would work in the product.mk files too): SOONG_CONFIG_NAMESPACES += myPlugin Within that namespace you can set key-value pairs: SOONG_CONFIG_myPlugin := key1 key2 ... ... SOONG_CONFIG_myPlugin_key1 := value ... SOONG_CONFIG_myPlugin_key2 := true Then in your plugin, you can ask for your namespace: vars := ctx.Config().VendorConfig("myPlugin") And then use them: str := vars.String("key1") if vars.Bool("key2") { ... } if vars.IsSet("key3") { ... } Warning: It's not a good idea to fail on missing inputs, since an android tree may contain plugins from multiple owners, and we may configure your modules (but not build/install them) even if they're not meant for the currently configured product. Bug: 76168832 Test: define some variables, use them Test: m blueprint_tools Change-Id: I4c38f5a4344022c6f332de279d9bbef24502e741 Merged-In: I4c38f5a4344022c6f332de279d9bbef24502e741 (cherry picked from commit 0fe7866897b177f2bf7ec934c5615a2b48e48a23)
Diffstat (limited to 'android/variable.go')
-rw-r--r--android/variable.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/android/variable.go b/android/variable.go
index 831c50a5..a386b9df 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -226,6 +226,8 @@ type productVariables struct {
NamespacesToExport []string `json:",omitempty"`
PgoAdditionalProfileDirs []string `json:",omitempty"`
+
+ VendorVars map[string]map[string]string `json:",omitempty"`
}
func boolPtr(v bool) *bool {