implement USE_BAZEL_VERSION for m
This allows USE_BAZEL_VERSION to be set for m builds, which will use Bazelisk for any Bazel invocations during those builds. This should be used only for manual debugging, typically to either test new Bazel features, verify Bazel compatibility with Android, or culprit find new Bazel breakages. Test: Manually run builds with USE_BAZEL_VERSION, toggled off and on to ensure the build was rerun. Tested with a broken commit, a working commit, and 'last_green' special term Change-Id: I8b475dca5c8d4bd849ee3724a8c3aca9b631bcb8
This commit is contained in:
@@ -1712,6 +1712,16 @@ func (c *configImpl) IsPersistentBazelEnabled() bool {
|
||||
return c.Environment().IsEnvTrue("USE_PERSISTENT_BAZEL")
|
||||
}
|
||||
|
||||
// GetBazeliskBazelVersion returns the Bazel version to use for this build,
|
||||
// or the empty string if the current canonical prod Bazel should be used.
|
||||
// This environment variable should only be set to debug the build system.
|
||||
// The Bazel version, if set, will be passed to Bazelisk, and Bazelisk will
|
||||
// handle downloading and invoking the correct Bazel binary.
|
||||
func (c *configImpl) GetBazeliskBazelVersion() string {
|
||||
value, _ := c.Environment().Get("USE_BAZEL_VERSION")
|
||||
return value
|
||||
}
|
||||
|
||||
func (c *configImpl) BazelModulesForceEnabledByFlag() string {
|
||||
return c.bazelForceEnabledModules
|
||||
}
|
||||
|
||||
@@ -521,7 +521,7 @@ func runSoong(ctx Context, config Config) {
|
||||
defer ctx.EndTrace()
|
||||
|
||||
if config.IsPersistentBazelEnabled() {
|
||||
bazelProxy := bazel.NewProxyServer(ctx.Logger, config.OutDir(), filepath.Join(config.SoongOutDir(), "workspace"))
|
||||
bazelProxy := bazel.NewProxyServer(ctx.Logger, config.OutDir(), filepath.Join(config.SoongOutDir(), "workspace"), config.GetBazeliskBazelVersion())
|
||||
bazelProxy.Start()
|
||||
defer bazelProxy.Close()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user