Merge "Add option to override defaultManifestVersion"
diff --git a/android/bazel_handler.go b/android/bazel_handler.go
index cf74b9c..122495f 100644
--- a/android/bazel_handler.go
+++ b/android/bazel_handler.go
@@ -387,6 +387,10 @@
for _, enabledProdModule := range allowlists.ProdMixedBuildsEnabledList {
enabledModules[enabledProdModule] = true
}
+
+ for enabledAdHocModule := range c.BazelModulesForceEnabledByFlag() {
+ enabledModules[enabledAdHocModule] = true
+ }
case BazelStagingMode:
modulesDefaultToBazel = false
// Staging mode includes all prod modules plus all staging modules.
@@ -396,6 +400,10 @@
for _, enabledStagingMode := range allowlists.StagingMixedBuildsEnabledList {
enabledModules[enabledStagingMode] = true
}
+
+ for enabledAdHocModule := range c.BazelModulesForceEnabledByFlag() {
+ enabledModules[enabledAdHocModule] = true
+ }
case BazelDevMode:
modulesDefaultToBazel = true
diff --git a/android/config.go b/android/config.go
index f430b72..9d9ab30 100644
--- a/android/config.go
+++ b/android/config.go
@@ -227,6 +227,11 @@
mixedBuildsLock sync.Mutex
mixedBuildEnabledModules map[string]struct{}
mixedBuildDisabledModules map[string]struct{}
+
+ // These are modules to be built with Bazel beyond the allowlisted/build-mode
+ // specified modules. They are passed via the command-line flag
+ // "--bazel-force-enabled-modules"
+ bazelForceEnabledModules map[string]struct{}
}
type deviceConfig struct {
@@ -399,7 +404,8 @@
// NewConfig creates a new Config object. The srcDir argument specifies the path
// to the root source directory. It also loads the config file, if found.
-func NewConfig(moduleListFile string, buildMode SoongBuildMode, runGoTests bool, outDir, soongOutDir string, availableEnv map[string]string) (Config, error) {
+func NewConfig(moduleListFile string, buildMode SoongBuildMode, runGoTests bool, outDir, soongOutDir string, availableEnv map[string]string,
+ bazelForceEnabledModules []string) (Config, error) {
// Make a config with default options.
config := &config{
ProductVariablesFileName: filepath.Join(soongOutDir, productVariablesFileName),
@@ -415,6 +421,7 @@
fs: pathtools.NewOsFs(absSrcDir),
mixedBuildDisabledModules: make(map[string]struct{}),
mixedBuildEnabledModules: make(map[string]struct{}),
+ bazelForceEnabledModules: make(map[string]struct{}),
}
config.deviceConfig = &deviceConfig{
@@ -500,6 +507,10 @@
config.BazelContext, err = NewBazelContext(config)
config.Bp2buildPackageConfig = GetBp2BuildAllowList()
+ for _, module := range bazelForceEnabledModules {
+ config.bazelForceEnabledModules[module] = struct{}{}
+ }
+
return Config{config}, err
}
@@ -1100,6 +1111,10 @@
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)
}
@@ -1158,6 +1173,10 @@
return String(c.productVariables.PrebuiltHiddenApiDir)
}
+func (c *config) BazelModulesForceEnabledByFlag() map[string]struct{} {
+ return c.bazelForceEnabledModules
+}
+
func (c *deviceConfig) Arches() []Arch {
var arches []Arch
for _, target := range c.config.Targets[Android] {
diff --git a/android/register.go b/android/register.go
index 6c69cc5..33e9ea3 100644
--- a/android/register.go
+++ b/android/register.go
@@ -161,32 +161,34 @@
func NewContext(config Config) *Context {
ctx := &Context{blueprint.NewContext(), config}
ctx.SetSrcDir(absSrcDir)
+ ctx.AddIncludeTags(config.IncludeTags()...)
return ctx
}
+// Helper function to register the module types used in bp2build and
+// api_bp2build.
+func registerModuleTypes(ctx *Context) {
+ for _, t := range moduleTypes {
+ t.register(ctx)
+ }
+ // Required for SingletonModule types, even though we are not using them.
+ for _, t := range singletons {
+ t.register(ctx)
+ }
+}
+
// RegisterForBazelConversion registers an alternate shadow pipeline of
// singletons, module types and mutators to register for converting Blueprint
// files to semantically equivalent BUILD files.
func (ctx *Context) RegisterForBazelConversion() {
- for _, t := range moduleTypes {
- t.register(ctx)
- }
-
- // Required for SingletonModule types, even though we are not using them.
- for _, t := range singletons {
- t.register(ctx)
- }
-
+ registerModuleTypes(ctx)
RegisterMutatorsForBazelConversion(ctx, bp2buildPreArchMutators)
}
// RegisterForApiBazelConversion is similar to RegisterForBazelConversion except that
// it only generates API targets in the generated workspace
func (ctx *Context) RegisterForApiBazelConversion() {
- for _, t := range moduleTypes {
- t.register(ctx)
- }
-
+ registerModuleTypes(ctx)
RegisterMutatorsForApiBazelConversion(ctx, bp2buildPreArchMutators)
}
diff --git a/android/variable.go b/android/variable.go
index 28f22c9..9725895 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -452,6 +452,8 @@
GenerateAidlNdkPlatformBackend bool `json:",omitempty"`
IgnorePrefer32OnDevice bool `json:",omitempty"`
+
+ IncludeTags []string `json:",omitempty"`
}
func boolPtr(v bool) *bool {
diff --git a/cc/afdo_test.go b/cc/afdo_test.go
index 5515464..fe3392a 100644
--- a/cc/afdo_test.go
+++ b/cc/afdo_test.go
@@ -15,28 +15,46 @@
package cc
import (
+ "strings"
"testing"
"android/soong/android"
+
"github.com/google/blueprint"
)
+type visitDirectDepsInterface interface {
+ VisitDirectDeps(blueprint.Module, func(dep blueprint.Module))
+}
+
+func hasDirectDep(ctx visitDirectDepsInterface, m android.Module, wantDep android.Module) bool {
+ var found bool
+ ctx.VisitDirectDeps(m, func(dep blueprint.Module) {
+ if dep == wantDep {
+ found = true
+ }
+ })
+ return found
+}
+
func TestAfdoDeps(t *testing.T) {
bp := `
- cc_library {
+ cc_library_shared {
name: "libTest",
- srcs: ["foo.c"],
+ srcs: ["test.c"],
static_libs: ["libFoo"],
afdo: true,
}
- cc_library {
+ cc_library_static {
name: "libFoo",
+ srcs: ["foo.c"],
static_libs: ["libBar"],
}
- cc_library {
+ cc_library_static {
name: "libBar",
+ srcs: ["bar.c"],
}
`
prepareForAfdoTest := android.FixtureAddTextFile("toolchain/pgo-profiles/sampling/libTest.afdo", "TEST")
@@ -46,25 +64,89 @@
prepareForAfdoTest,
).RunTestWithBp(t, bp)
- libTest := result.ModuleForTests("libTest", "android_arm64_armv8-a_shared").Module()
- libFoo := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static_afdo-libTest").Module()
- libBar := result.ModuleForTests("libBar", "android_arm64_armv8-a_static_afdo-libTest").Module()
+ libTest := result.ModuleForTests("libTest", "android_arm64_armv8-a_shared")
+ libFoo := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static_afdo-libTest")
+ libBar := result.ModuleForTests("libBar", "android_arm64_armv8-a_static_afdo-libTest")
- hasDep := func(m android.Module, wantDep android.Module) bool {
- var found bool
- result.VisitDirectDeps(m, func(dep blueprint.Module) {
- if dep == wantDep {
- found = true
- }
- })
- return found
- }
-
- if !hasDep(libTest, libFoo) {
+ if !hasDirectDep(result, libTest.Module(), libFoo.Module()) {
t.Errorf("libTest missing dependency on afdo variant of libFoo")
}
- if !hasDep(libFoo, libBar) {
+ if !hasDirectDep(result, libFoo.Module(), libBar.Module()) {
t.Errorf("libTest missing dependency on afdo variant of libBar")
}
+
+ cFlags := libTest.Rule("cc").Args["cFlags"]
+ if w := "-fprofile-sample-accurate"; !strings.Contains(cFlags, w) {
+ t.Errorf("Expected 'libTest' to enable afdo, but did not find %q in cflags %q", w, cFlags)
+ }
+
+ cFlags = libFoo.Rule("cc").Args["cFlags"]
+ if w := "-fprofile-sample-accurate"; !strings.Contains(cFlags, w) {
+ t.Errorf("Expected 'libFoo' to enable afdo, but did not find %q in cflags %q", w, cFlags)
+ }
+
+ cFlags = libBar.Rule("cc").Args["cFlags"]
+ if w := "-fprofile-sample-accurate"; !strings.Contains(cFlags, w) {
+ t.Errorf("Expected 'libBar' to enable afdo, but did not find %q in cflags %q", w, cFlags)
+ }
+}
+
+func TestAfdoEnabledOnStaticDepNoAfdo(t *testing.T) {
+ bp := `
+ cc_library_shared {
+ name: "libTest",
+ srcs: ["foo.c"],
+ static_libs: ["libFoo"],
+ }
+
+ cc_library_static {
+ name: "libFoo",
+ srcs: ["foo.c"],
+ static_libs: ["libBar"],
+ afdo: true, // TODO(b/256670524): remove support for enabling afdo from static only libraries, this can only propagate from shared libraries/binaries
+ }
+
+ cc_library_static {
+ name: "libBar",
+ }
+ `
+ prepareForAfdoTest := android.FixtureAddTextFile("toolchain/pgo-profiles/sampling/libFoo.afdo", "TEST")
+
+ result := android.GroupFixturePreparers(
+ prepareForCcTest,
+ prepareForAfdoTest,
+ ).RunTestWithBp(t, bp)
+
+ libTest := result.ModuleForTests("libTest", "android_arm64_armv8-a_shared").Module()
+ libFoo := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static")
+ libBar := result.ModuleForTests("libBar", "android_arm64_armv8-a_static").Module()
+
+ if !hasDirectDep(result, libTest, libFoo.Module()) {
+ t.Errorf("libTest missing dependency on afdo variant of libFoo")
+ }
+
+ if !hasDirectDep(result, libFoo.Module(), libBar) {
+ t.Errorf("libFoo missing dependency on afdo variant of libBar")
+ }
+
+ fooVariants := result.ModuleVariantsForTests("foo")
+ for _, v := range fooVariants {
+ if strings.Contains(v, "afdo-") {
+ t.Errorf("Expected no afdo variant of 'foo', got %q", v)
+ }
+ }
+
+ cFlags := libFoo.Rule("cc").Args["cFlags"]
+ if w := "-fprofile-sample-accurate"; strings.Contains(cFlags, w) {
+ t.Errorf("Expected 'foo' to not enable afdo, but found %q in cflags %q", w, cFlags)
+ }
+
+ barVariants := result.ModuleVariantsForTests("bar")
+ for _, v := range barVariants {
+ if strings.Contains(v, "afdo-") {
+ t.Errorf("Expected no afdo variant of 'bar', got %q", v)
+ }
+ }
+
}
diff --git a/cc/library.go b/cc/library.go
index d1d1945..7059023 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -120,6 +120,9 @@
// Extra flags passed to header-abi-diff
Diff_flags []string
+
+ // Opt-in reference dump directories
+ Ref_dump_dirs []string
}
// Inject boringssl hash into the shared library. This is only intended for use by external/boringssl.
@@ -1911,6 +1914,16 @@
isLlndkOrNdk, allowExtensions, "current", errorMessage)
}
+func (library *libraryDecorator) optInAbiDiff(ctx android.ModuleContext, referenceDump android.Path,
+ baseName, nameExt string, isLlndkOrNdk bool, refDumpDir string) {
+
+ libName := strings.TrimSuffix(baseName, filepath.Ext(baseName))
+ errorMessage := "error: Please update ABI references with: $$ANDROID_BUILD_TOP/development/vndk/tools/header-checker/utils/create_reference_dumps.py -l " + libName + " -ref-dump-dir $$ANDROID_BUILD_TOP/" + refDumpDir
+
+ library.sourceAbiDiff(ctx, referenceDump, baseName, nameExt,
+ isLlndkOrNdk, /* allowExtensions */ false, "current", errorMessage)
+}
+
func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objects, fileName string, soFile android.Path) {
if library.sabi.shouldCreateSourceAbiDump() {
exportIncludeDirs := library.flagExporter.exportedIncludes(ctx)
@@ -1955,6 +1968,19 @@
library.sameVersionAbiDiff(ctx, currDumpFile.Path(),
fileName, isLlndk || isNdk, ctx.IsVndkExt())
}
+ // Check against the opt-in reference dumps.
+ for i, optInDumpDir := range library.Properties.Header_abi_checker.Ref_dump_dirs {
+ optInDumpDirPath := android.PathForModuleSrc(ctx, optInDumpDir)
+ // Ref_dump_dirs are not versioned.
+ // They do not contain subdir for binder bitness because 64-bit binder has been mandatory.
+ optInDumpFile := getRefAbiDumpFile(ctx, optInDumpDirPath.String(), fileName)
+ if !optInDumpFile.Valid() {
+ continue
+ }
+ library.optInAbiDiff(ctx, optInDumpFile.Path(),
+ fileName, "opt"+strconv.Itoa(i), isLlndk || isNdk,
+ optInDumpDirPath.String())
+ }
}
}
diff --git a/cc/lto_test.go b/cc/lto_test.go
index b52f2b6..afd2c77 100644
--- a/cc/lto_test.go
+++ b/cc/lto_test.go
@@ -24,29 +24,35 @@
func TestThinLtoDeps(t *testing.T) {
bp := `
- cc_library {
+ cc_library_shared {
name: "lto_enabled",
srcs: ["src.c"],
- static_libs: ["foo"],
+ static_libs: ["foo", "lib_never_lto"],
shared_libs: ["bar"],
lto: {
thin: true,
}
}
- cc_library {
+ cc_library_static {
name: "foo",
static_libs: ["baz"],
}
- cc_library {
+ cc_library_shared {
name: "bar",
static_libs: ["qux"],
}
- cc_library {
+ cc_library_static {
name: "baz",
}
- cc_library {
+ cc_library_static {
name: "qux",
}
+ cc_library_static {
+ name: "lib_never_lto",
+ lto: {
+ never: true,
+ },
+ }
`
result := android.GroupFixturePreparers(
@@ -54,8 +60,6 @@
).RunTestWithBp(t, bp)
libLto := result.ModuleForTests("lto_enabled", "android_arm64_armv8-a_shared").Module()
- libFoo := result.ModuleForTests("foo", "android_arm64_armv8-a_static_lto-thin").Module()
- libBaz := result.ModuleForTests("baz", "android_arm64_armv8-a_static_lto-thin").Module()
hasDep := func(m android.Module, wantDep android.Module) bool {
var found bool
@@ -67,12 +71,24 @@
return found
}
+ libFoo := result.ModuleForTests("foo", "android_arm64_armv8-a_static_lto-thin").Module()
if !hasDep(libLto, libFoo) {
t.Errorf("'lto_enabled' missing dependency on thin lto variant of 'foo'")
}
+ libBaz := result.ModuleForTests("baz", "android_arm64_armv8-a_static_lto-thin").Module()
if !hasDep(libFoo, libBaz) {
- t.Errorf("'lto_enabled' missing dependency on thin lto variant of transitive dep 'baz'")
+ t.Errorf("'foo' missing dependency on thin lto variant of transitive dep 'baz'")
+ }
+
+ libNeverLto := result.ModuleForTests("lib_never_lto", "android_arm64_armv8-a_static_lto-thin").Module()
+ if !hasDep(libLto, libNeverLto) {
+ t.Errorf("'lto_enabled' missing dependency on NO-thin lto variant of 'lib_never_lto'")
+ }
+
+ libBar := result.ModuleForTests("bar", "android_arm64_armv8-a_shared").Module()
+ if !hasDep(libLto, libBar) {
+ t.Errorf("'lto_enabled' missing dependency on non-thin lto variant of 'bar'")
}
barVariants := result.ModuleVariantsForTests("bar")
@@ -88,3 +104,74 @@
}
}
}
+
+func TestThinLtoOnlyOnStaticDep(t *testing.T) {
+ bp := `
+ cc_library_shared {
+ name: "root",
+ srcs: ["src.c"],
+ static_libs: ["foo"],
+ }
+ cc_library_shared {
+ name: "root_no_lto",
+ srcs: ["src.c"],
+ static_libs: ["foo"],
+ lto: {
+ never: true,
+ }
+ }
+ cc_library_static {
+ name: "foo",
+ srcs: ["foo.c"],
+ static_libs: ["baz"],
+ lto: {
+ thin: true,
+ }
+ }
+ cc_library_static {
+ name: "baz",
+ srcs: ["baz.c"],
+ }
+`
+
+ result := android.GroupFixturePreparers(
+ prepareForCcTest,
+ ).RunTestWithBp(t, bp)
+
+ libRoot := result.ModuleForTests("root", "android_arm64_armv8-a_shared").Module()
+ libRootLtoNever := result.ModuleForTests("root_no_lto", "android_arm64_armv8-a_shared").Module()
+
+ hasDep := func(m android.Module, wantDep android.Module) bool {
+ var found bool
+ result.VisitDirectDeps(m, func(dep blueprint.Module) {
+ if dep == wantDep {
+ found = true
+ }
+ })
+ return found
+ }
+
+ libFoo := result.ModuleForTests("foo", "android_arm64_armv8-a_static")
+ if !hasDep(libRoot, libFoo.Module()) {
+ t.Errorf("'root' missing dependency on thin lto variant of 'foo'")
+ }
+
+ if !hasDep(libRootLtoNever, libFoo.Module()) {
+ t.Errorf("'root_no_lto' missing dependency on thin lto variant of 'foo'")
+ }
+
+ libFooCFlags := libFoo.Rule("cc").Args["cFlags"]
+ if w := "-flto=thin -fsplit-lto-unit"; !strings.Contains(libFooCFlags, w) {
+ t.Errorf("'foo' expected to have flags %q, but got %q", w, libFooCFlags)
+ }
+
+ libBaz := result.ModuleForTests("baz", "android_arm64_armv8-a_static_lto-thin")
+ if !hasDep(libFoo.Module(), libBaz.Module()) {
+ t.Errorf("'foo' missing dependency on thin lto variant of transitive dep 'baz'")
+ }
+
+ libBazCFlags := libFoo.Rule("cc").Args["cFlags"]
+ if w := "-flto=thin -fsplit-lto-unit"; !strings.Contains(libBazCFlags, w) {
+ t.Errorf("'baz' expected to have flags %q, but got %q", w, libFooCFlags)
+ }
+}
diff --git a/cc/sanitize_test.go b/cc/sanitize_test.go
index 580adfa..b102d33 100644
--- a/cc/sanitize_test.go
+++ b/cc/sanitize_test.go
@@ -314,6 +314,10 @@
}
func TestMiscUndefined(t *testing.T) {
+ if runtime.GOOS != "linux" {
+ t.Skip("requires linux")
+ }
+
bp := `
cc_binary {
name: "bin_with_ubsan",
diff --git a/cmd/soong_build/main.go b/cmd/soong_build/main.go
index 029bbb4..f4a63a4 100644
--- a/cmd/soong_build/main.go
+++ b/cmd/soong_build/main.go
@@ -89,6 +89,7 @@
flag.StringVar(&bp2buildMarker, "bp2build_marker", "", "If set, run bp2build, touch the specified marker file then exit")
flag.StringVar(&symlinkForestMarker, "symlink_forest_marker", "", "If set, create the bp2build symlink forest, touch the specified marker file, then exit")
flag.StringVar(&cmdlineArgs.OutFile, "o", "build.ninja", "the Ninja file to output")
+ flag.StringVar(&cmdlineArgs.BazelForceEnabledModules, "bazel-force-enabled-modules", "", "additional modules to build with Bazel. Comma-delimited")
flag.BoolVar(&cmdlineArgs.EmptyNinjaFile, "empty-ninja-file", false, "write out a 0-byte ninja file")
flag.BoolVar(&cmdlineArgs.BazelMode, "bazel-mode", false, "use bazel for analysis of certain modules")
flag.BoolVar(&cmdlineArgs.BazelModeStaging, "bazel-mode-staging", false, "use bazel for analysis of certain near-ready modules")
@@ -113,11 +114,16 @@
ctx := android.NewContext(configuration)
ctx.SetNameInterface(newNameResolver(configuration))
ctx.SetAllowMissingDependencies(configuration.AllowMissingDependencies())
+ ctx.AddIncludeTags(configuration.IncludeTags()...)
return ctx
}
func newConfig(availableEnv map[string]string) android.Config {
var buildMode android.SoongBuildMode
+ var bazelForceEnabledModules []string
+ if len(cmdlineArgs.BazelForceEnabledModules) > 0 {
+ bazelForceEnabledModules = strings.Split(cmdlineArgs.BazelForceEnabledModules, ",")
+ }
if symlinkForestMarker != "" {
buildMode = android.SymlinkForest
@@ -141,7 +147,7 @@
buildMode = android.AnalysisNoBazel
}
- configuration, err := android.NewConfig(cmdlineArgs.ModuleListFile, buildMode, runGoTests, outDir, soongOutDir, availableEnv)
+ configuration, err := android.NewConfig(cmdlineArgs.ModuleListFile, buildMode, runGoTests, outDir, soongOutDir, availableEnv, bazelForceEnabledModules)
if err != nil {
fmt.Fprintf(os.Stderr, "%s", err)
os.Exit(1)
diff --git a/filesystem/avb_add_hash_footer.go b/filesystem/avb_add_hash_footer.go
index 1ee0edc..2ee420c 100644
--- a/filesystem/avb_add_hash_footer.go
+++ b/filesystem/avb_add_hash_footer.go
@@ -149,7 +149,7 @@
cmd.FlagWithArg("--prop ", proptools.ShellEscape(fmt.Sprintf("%s:%s", name, value)))
} else {
p := android.PathForModuleSrc(ctx, file)
- cmd.Input(p)
+ cmd.Implicit(p)
cmd.FlagWithArg("--prop_from_file ", proptools.ShellEscape(fmt.Sprintf("%s:%s", name, cmd.PathForInput(p))))
}
}
diff --git a/ui/build/config.go b/ui/build/config.go
index c98601e..ef2e87e 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -109,6 +109,10 @@
emptyNinjaFile bool
metricsUploader string
+
+ bazelForceEnabledModules string
+
+ includeTags []string
}
const srcDirFileCheck = "build/soong/root.bp"
@@ -238,7 +242,7 @@
}
func defaultBazelProdMode(cfg *configImpl) bool {
- // Envirnoment flag to disable Bazel for users which experience
+ // Environment flag to disable Bazel for users which experience
// broken bazel-handled builds, or significant performance regressions.
if cfg.IsBazelMixedBuildForceDisabled() {
return false
@@ -741,6 +745,14 @@
c.bazelStagingMode = true
} else if arg == "--search-api-dir" {
c.searchApiDir = true
+ } else if strings.HasPrefix(arg, "--build-command=") {
+ buildCmd := strings.TrimPrefix(arg, "--build-command=")
+ // remove quotations
+ buildCmd = strings.TrimPrefix(buildCmd, "\"")
+ buildCmd = strings.TrimSuffix(buildCmd, "\"")
+ ctx.Metrics.SetBuildCommand([]string{buildCmd})
+ } else if strings.HasPrefix(arg, "--bazel-force-enabled-modules=") {
+ c.bazelForceEnabledModules = strings.TrimPrefix(arg, "--bazel-force-enabled-modules=")
} else if len(arg) > 0 && arg[0] == '-' {
parseArgNum := func(def int) int {
if len(arg) > 2 {
@@ -1069,6 +1081,14 @@
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
@@ -1488,6 +1508,10 @@
return c.Environment().IsEnvTrue("BUILD_BROKEN_DISABLE_BAZEL")
}
+func (c *configImpl) BazelModulesForceEnabledByFlag() string {
+ return c.bazelForceEnabledModules
+}
+
func GetMetricsUploader(topDir string, env *Environment) string {
if p, ok := env.Get("METRICS_UPLOADER"); ok {
metricsUploader := filepath.Join(topDir, p)
diff --git a/ui/build/dumpvars.go b/ui/build/dumpvars.go
index b3b3866..1e3e547 100644
--- a/ui/build/dumpvars.go
+++ b/ui/build/dumpvars.go
@@ -139,6 +139,7 @@
var BannerVars = []string{
"PLATFORM_VERSION_CODENAME",
"PLATFORM_VERSION",
+ "PRODUCT_INCLUDE_TAGS",
"TARGET_PRODUCT",
"TARGET_BUILD_VARIANT",
"TARGET_BUILD_APPS",
@@ -289,4 +290,5 @@
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 837f0a4..b89ca20 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -273,6 +273,10 @@
if config.bazelStagingMode {
mainSoongBuildExtraArgs = append(mainSoongBuildExtraArgs, "--bazel-mode-staging")
}
+ if len(config.bazelForceEnabledModules) > 0 {
+ mainSoongBuildExtraArgs = append(mainSoongBuildExtraArgs, "--bazel-force-enabled-modules="+config.bazelForceEnabledModules)
+ }
+
queryviewDir := filepath.Join(config.SoongOutDir(), "queryview")
// The BUILD files will be generated in out/soong/.api_bp2build (no symlinks to src files)
// The final workspace will be generated in out/soong/api_bp2build
@@ -399,6 +403,7 @@
}
blueprintCtx := blueprint.NewContext()
+ blueprintCtx.AddIncludeTags(config.GetIncludeTags()...)
blueprintCtx.SetIgnoreUnknownModuleTypes(true)
blueprintConfig := BlueprintConfig{
soongOutDir: config.SoongOutDir(),