Loading ui/build/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ bootstrap_go_package { "environment.go", "exec.go", "finder.go", "goma.go", "kati.go", "ninja.go", "path.go", Loading ui/build/build.go +5 −0 Original line number Diff line number Diff line Loading @@ -156,6 +156,11 @@ func Build(ctx Context, config Config, what int) { SetupPath(ctx, config) if config.StartGoma() { // Ensure start Goma compiler_proxy startGoma(ctx, config) } if what&BuildProductConfig != 0 { // Run make for product config runMakeProductConfig(ctx, config) Loading ui/build/config.go +14 −0 Original line number Diff line number Diff line Loading @@ -478,6 +478,20 @@ func (c *configImpl) UseGoma() bool { return false } func (c *configImpl) StartGoma() bool { if !c.UseGoma() { return false } if v, ok := c.environ.Get("NOSTART_GOMA"); ok { v = strings.TrimSpace(v) if v != "" && v != "false" { return false } } return true } // RemoteParallel controls how many remote jobs (i.e., commands which contain // gomacc) are run in parallel. Note the parallelism of all other jobs is // still limited by Parallel() Loading ui/build/goma.go 0 → 100644 +48 −0 Original line number Diff line number Diff line // Copyright 2018 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package build import ( "errors" "path/filepath" "android/soong/ui/metrics" ) const gomaCtlScript = "goma_ctl.py" var gomaCtlNotFound = errors.New("goma_ctl.py not found") func startGoma(ctx Context, config Config) error { ctx.BeginTrace(metrics.RunSetupTool, "goma_ctl") defer ctx.EndTrace() var gomaCtl string if gomaDir, ok := config.Environment().Get("GOMA_DIR"); ok { gomaCtl = filepath.Join(gomaDir, gomaCtlScript) } else if home, ok := config.Environment().Get("HOME"); ok { gomaCtl = filepath.Join(home, "goma", gomaCtlScript) } else { return gomaCtlNotFound } cmd := Command(ctx, config, "goma_ctl.py ensure_start", gomaCtl, "ensure_start") if err := cmd.Run(); err != nil { ctx.Fatalf("goma_ctl.py ensure_start failed with: %v", err) } return nil } Loading
ui/build/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ bootstrap_go_package { "environment.go", "exec.go", "finder.go", "goma.go", "kati.go", "ninja.go", "path.go", Loading
ui/build/build.go +5 −0 Original line number Diff line number Diff line Loading @@ -156,6 +156,11 @@ func Build(ctx Context, config Config, what int) { SetupPath(ctx, config) if config.StartGoma() { // Ensure start Goma compiler_proxy startGoma(ctx, config) } if what&BuildProductConfig != 0 { // Run make for product config runMakeProductConfig(ctx, config) Loading
ui/build/config.go +14 −0 Original line number Diff line number Diff line Loading @@ -478,6 +478,20 @@ func (c *configImpl) UseGoma() bool { return false } func (c *configImpl) StartGoma() bool { if !c.UseGoma() { return false } if v, ok := c.environ.Get("NOSTART_GOMA"); ok { v = strings.TrimSpace(v) if v != "" && v != "false" { return false } } return true } // RemoteParallel controls how many remote jobs (i.e., commands which contain // gomacc) are run in parallel. Note the parallelism of all other jobs is // still limited by Parallel() Loading
ui/build/goma.go 0 → 100644 +48 −0 Original line number Diff line number Diff line // Copyright 2018 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package build import ( "errors" "path/filepath" "android/soong/ui/metrics" ) const gomaCtlScript = "goma_ctl.py" var gomaCtlNotFound = errors.New("goma_ctl.py not found") func startGoma(ctx Context, config Config) error { ctx.BeginTrace(metrics.RunSetupTool, "goma_ctl") defer ctx.EndTrace() var gomaCtl string if gomaDir, ok := config.Environment().Get("GOMA_DIR"); ok { gomaCtl = filepath.Join(gomaDir, gomaCtlScript) } else if home, ok := config.Environment().Get("HOME"); ok { gomaCtl = filepath.Join(home, "goma", gomaCtlScript) } else { return gomaCtlNotFound } cmd := Command(ctx, config, "goma_ctl.py ensure_start", gomaCtl, "ensure_start") if err := cmd.Run(); err != nil { ctx.Fatalf("goma_ctl.py ensure_start failed with: %v", err) } return nil }