diff options
author | Yoshisato Yanagisawa <yyanagisawa@google.com> | 2019-01-10 10:14:16 +0900 |
---|---|---|
committer | Yoshisato Yanagisawa <yyanagisawa@google.com> | 2019-01-10 10:14:16 +0900 |
commit | 2cb0e5df53c2588adb8b2aeb8ad5ebafcd799c30 (patch) | |
tree | a3f7f6ac28c503110702d9ed6d7cb5dd1c658135 /ui/build/goma.go | |
parent | 2837d75ffd06213de3471dfc8969f2baceb6e3df (diff) | |
download | build_soong-2cb0e5df53c2588adb8b2aeb8ad5ebafcd799c30.tar.gz build_soong-2cb0e5df53c2588adb8b2aeb8ad5ebafcd799c30.tar.bz2 build_soong-2cb0e5df53c2588adb8b2aeb8ad5ebafcd799c30.zip |
goma_ctl.py ensure_start in Soong UI.
As suggested in b/118390303#comment18, let me run
"goma_ctl.py ensure_start" in soong UI.
Bug: 118390303
Test: stop compiler_proxy, and execute following command:
Test: USE_GOMA=true lunch aosp_arm-eng
Test: and confirms compiler_proxy is running.
Change-Id: I859daae6ae2399c5b6bce2fafd874dfdb7c6aae0
Signed-off-by: Yoshisato Yanagisawa <yyanagisawa@google.com>
Diffstat (limited to 'ui/build/goma.go')
-rw-r--r-- | ui/build/goma.go | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/ui/build/goma.go b/ui/build/goma.go new file mode 100644 index 00000000..d0dc9cfc --- /dev/null +++ b/ui/build/goma.go @@ -0,0 +1,48 @@ +// 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 +} |