Mixed bazel/soong build prototype for genrule
With this change, bazel_module is a specifiable property on
genrule module definitions. With bazel-enabled mode, soong_build will
defer to Bazel for information on these modules.
source build/soong/bazelenv.sh to enter bazel-enabled mode.
Test: Manually verified on bionic/libc genrules using aosp_cf_x86_phone-userdebug
Change-Id: I3619848186d50be7273a5eba31c79989b981d408
diff --git a/android/config.go b/android/config.go
index 8df65f7..345f26e 100644
--- a/android/config.go
+++ b/android/config.go
@@ -85,6 +85,8 @@
// Only available on configs created by TestConfig
TestProductVariables *productVariables
+ BazelContext BazelContext
+
PrimaryBuilder string
ConfigFileName string
ProductVariablesFileName string
@@ -248,6 +250,8 @@
// Set testAllowNonExistentPaths so that test contexts don't need to specify every path
// passed to PathForSource or PathForModuleSrc.
testAllowNonExistentPaths: true,
+
+ BazelContext: noopBazelContext{},
}
config.deviceConfig = &deviceConfig{
config: config,
@@ -324,6 +328,20 @@
return testConfig
}
+// Returns a config object which is "reset" for another bootstrap run.
+// Only per-run data is reset. Data which needs to persist across multiple
+// runs in the same program execution is carried over (such as Bazel context
+// or environment deps).
+func ConfigForAdditionalRun(c Config) (Config, error) {
+ newConfig, err := NewConfig(c.srcDir, c.buildDir, c.moduleListFile)
+ if err != nil {
+ return Config{}, err
+ }
+ newConfig.BazelContext = c.BazelContext
+ newConfig.envDeps = c.envDeps
+ return newConfig, nil
+}
+
// New 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(srcDir, buildDir string, moduleListFile string) (Config, error) {
@@ -425,6 +443,10 @@
Bool(config.productVariables.GcovCoverage) ||
Bool(config.productVariables.ClangCoverage))
+ config.BazelContext, err = NewBazelContext(config)
+ if err != nil {
+ return Config{}, err
+ }
return Config{config}, nil
}