Define UseBazel in Config

The UseBazel() function will be used in several places to perform
different functionality such as setting up the metrics path.

Bug: b/173028918
Test: m nothing
Change-Id: Ie94073b8f0552ec7528e1cc2f3be74b693dc3135
This commit is contained in:
Patrice Arruda 2020-11-11 13:01:25 -08:00
parent 9414a8be12
commit 0c1c456643
2 changed files with 12 additions and 4 deletions

View file

@ -471,11 +471,9 @@ func make(ctx build.Context, config build.Config, _ []string, logsDir string) {
ctx.Fatal("done")
}
var toBuild int
if _, ok := config.Environment().Get("USE_BAZEL"); ok {
toBuild := build.BuildAll
if config.UseBazel() {
toBuild = build.BuildAllWithBazel
} else {
toBuild = build.BuildAll
}
if config.Checkbuild() {

View file

@ -840,6 +840,16 @@ func (c *configImpl) UseRBE() bool {
return false
}
func (c *configImpl) UseBazel() bool {
if v, ok := c.environ.Get("USE_BAZEL"); ok {
v = strings.TrimSpace(v)
if v != "" && v != "false" {
return true
}
}
return false
}
func (c *configImpl) StartRBE() bool {
if !c.UseRBE() {
return false