Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 82747779 authored by Spandan Das's avatar Spandan Das Committed by Zhi Dou
Browse files

Create a new product variable to gate blueprint files

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)
parent 8ab8056a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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)
}
+1 −0
Original line number Diff line number Diff line
@@ -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
}

+2 −0
Original line number Diff line number Diff line
@@ -445,6 +445,8 @@ type productVariables struct {
	GenerateAidlNdkPlatformBackend bool `json:",omitempty"`

	ForceMultilibFirstOnDevice bool `json:",omitempty"`

	IncludeTags []string `json:",omitempty"`
}

func boolPtr(v bool) *bool {
+1 −0
Original line number Diff line number Diff line
@@ -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
}

+10 −0
Original line number Diff line number Diff line
@@ -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
Loading