aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpandan Das <spandandas@google.com>2022-11-08 18:42:16 +0000
committerZhi Dou <zhidou@google.com>2023-03-15 22:16:23 +0000
commit82747779baa334116d0337fb13edd1c0fdca5324 (patch)
tree48c92e78197ffeb8426226c669b58c82b3c33d99
parent8ab8056a4f9de6cec1fdedc7d49502439ea7aef6 (diff)
downloadsoong-android13-qpr3-c-s1-release.tar.gz
Bug: 270654958 Users can use this feature by 1. Setting PRODUCT_INCLUDE_TAGS += <val> in their product mk files 2. Set ``` blueprint_packge_includes { match_al: ["<val>"], } other_module_type {name: foo} other_module_type {name: bar} ``` bar and foo will be included if and only if <val> is set Test: Unit tests in blueprint Test: TH Change-Id: I32eed4e3b5ac47fb565c62d13d8881fa984c86f4 Merged-In: I32eed4e3b5ac47fb565c62d13d8881fa984c86f4 (cherry picked from commit b45fbfbabe69d368d50e149ab37da3476a431a96)
-rw-r--r--android/config.go4
-rw-r--r--android/register.go1
-rw-r--r--android/variable.go2
-rw-r--r--cmd/soong_build/main.go1
-rw-r--r--ui/build/config.go10
-rw-r--r--ui/build/dumpvars.go2
-rw-r--r--ui/build/soong.go1
7 files changed, 21 insertions, 0 deletions
diff --git a/android/config.go b/android/config.go
index 3c99659f9..cbf186e46 100644
--- a/android/config.go
+++ b/android/config.go
@@ -1093,6 +1093,10 @@ func (c *config) ExportedNamespaces() []string {
return append([]string(nil), c.productVariables.NamespacesToExport...)
}
+func (c *config) IncludeTags() []string {
+ return c.productVariables.IncludeTags
+}
+
func (c *config) HostStaticBinaries() bool {
return Bool(c.productVariables.HostStaticBinaries)
}
diff --git a/android/register.go b/android/register.go
index c50583322..a29cfeaf1 100644
--- a/android/register.go
+++ b/android/register.go
@@ -160,6 +160,7 @@ type Context struct {
func NewContext(config Config) *Context {
ctx := &Context{blueprint.NewContext(), config}
ctx.SetSrcDir(absSrcDir)
+ ctx.AddIncludeTags(config.IncludeTags()...)
return ctx
}
diff --git a/android/variable.go b/android/variable.go
index 442068423..8d96e31cb 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -445,6 +445,8 @@ type productVariables struct {
GenerateAidlNdkPlatformBackend bool `json:",omitempty"`
ForceMultilibFirstOnDevice bool `json:",omitempty"`
+
+ IncludeTags []string `json:",omitempty"`
}
func boolPtr(v bool) *bool {
diff --git a/cmd/soong_build/main.go b/cmd/soong_build/main.go
index 4b3161b33..f1884a795 100644
--- a/cmd/soong_build/main.go
+++ b/cmd/soong_build/main.go
@@ -117,6 +117,7 @@ func newContext(configuration android.Config) *android.Context {
ctx.Register()
ctx.SetNameInterface(newNameResolver(configuration))
ctx.SetAllowMissingDependencies(configuration.AllowMissingDependencies())
+ ctx.AddIncludeTags(configuration.IncludeTags()...)
return ctx
}
diff --git a/ui/build/config.go b/ui/build/config.go
index e271bfca2..a6763214f 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -98,6 +98,8 @@ type configImpl struct {
emptyNinjaFile bool
metricsUploader string
+
+ includeTags []string
}
const srcDirFileCheck = "build/soong/root.bp"
@@ -1038,6 +1040,14 @@ func (c *configImpl) Parallel() int {
return c.parallel
}
+func (c *configImpl) GetIncludeTags() []string {
+ return c.includeTags
+}
+
+func (c *configImpl) SetIncludeTags(i []string) {
+ c.includeTags = i
+}
+
func (c *configImpl) HighmemParallel() int {
if i, ok := c.environ.GetInt("NINJA_HIGHMEM_NUM_JOBS"); ok {
return i
diff --git a/ui/build/dumpvars.go b/ui/build/dumpvars.go
index 285f1569b..cc796ce3f 100644
--- a/ui/build/dumpvars.go
+++ b/ui/build/dumpvars.go
@@ -139,6 +139,7 @@ func dumpMakeVars(ctx Context, config Config, goals, vars []string, write_soong_
var BannerVars = []string{
"PLATFORM_VERSION_CODENAME",
"PLATFORM_VERSION",
+ "PRODUCT_INCLUDE_TAGS",
"TARGET_PRODUCT",
"TARGET_BUILD_VARIANT",
"TARGET_BUILD_TYPE",
@@ -295,4 +296,5 @@ func runMakeProductConfig(ctx Context, config Config) {
config.SetBuildBrokenDupRules(makeVars["BUILD_BROKEN_DUP_RULES"] == "true")
config.SetBuildBrokenUsesNetwork(makeVars["BUILD_BROKEN_USES_NETWORK"] == "true")
config.SetBuildBrokenNinjaUsesEnvVars(strings.Fields(makeVars["BUILD_BROKEN_NINJA_USES_ENV_VARS"]))
+ config.SetIncludeTags(strings.Fields(makeVars["PRODUCT_INCLUDE_TAGS"]))
}
diff --git a/ui/build/soong.go b/ui/build/soong.go
index c7f22f946..a0ab1cc10 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -332,6 +332,7 @@ func bootstrapBlueprint(ctx Context, config Config) {
blueprintArgs.EmptyNinjaFile = false
blueprintCtx := blueprint.NewContext()
+ blueprintCtx.AddIncludeTags(config.GetIncludeTags()...)
blueprintCtx.SetIgnoreUnknownModuleTypes(true)
blueprintConfig := BlueprintConfig{
soongOutDir: config.SoongOutDir(),