Cut the multiproduct_kati -> soong-ui-build dep.
This is done by moving SetupSignals() to its own little package. There are a number of tiny little utility packages for soong_ui we might be better of merging, but that's for another change (maybe) Test: Presubmits. Change-Id: I07b0ca98bfb8884ef4223d665e632183b9896a0d
This commit is contained in:
@@ -19,8 +19,8 @@ package {
|
|||||||
blueprint_go_binary {
|
blueprint_go_binary {
|
||||||
name: "multiproduct_kati",
|
name: "multiproduct_kati",
|
||||||
deps: [
|
deps: [
|
||||||
"soong-ui-build",
|
|
||||||
"soong-ui-logger",
|
"soong-ui-logger",
|
||||||
|
"soong-ui-signal",
|
||||||
"soong-ui-terminal",
|
"soong-ui-terminal",
|
||||||
"soong-ui-tracer",
|
"soong-ui-tracer",
|
||||||
"soong-zip",
|
"soong-zip",
|
||||||
|
@@ -31,8 +31,8 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"android/soong/ui/build"
|
|
||||||
"android/soong/ui/logger"
|
"android/soong/ui/logger"
|
||||||
|
"android/soong/ui/signal"
|
||||||
"android/soong/ui/status"
|
"android/soong/ui/status"
|
||||||
"android/soong/ui/terminal"
|
"android/soong/ui/terminal"
|
||||||
"android/soong/ui/tracer"
|
"android/soong/ui/tracer"
|
||||||
@@ -127,12 +127,12 @@ func copyFile(from, to string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type mpContext struct {
|
type mpContext struct {
|
||||||
Context context.Context
|
|
||||||
Logger logger.Logger
|
Logger logger.Logger
|
||||||
Status status.ToolStatus
|
Status status.ToolStatus
|
||||||
Tracer tracer.Tracer
|
|
||||||
|
|
||||||
LogsDir string
|
SoongUi string
|
||||||
|
MainOutDir string
|
||||||
|
MainLogsDir string
|
||||||
}
|
}
|
||||||
|
|
||||||
func detectTotalRAM() uint64 {
|
func detectTotalRAM() uint64 {
|
||||||
@@ -179,7 +179,7 @@ func main() {
|
|||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
_, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
trace := tracer.New(log)
|
trace := tracer.New(log)
|
||||||
@@ -192,7 +192,7 @@ func main() {
|
|||||||
var failures failureCount
|
var failures failureCount
|
||||||
stat.AddOutput(&failures)
|
stat.AddOutput(&failures)
|
||||||
|
|
||||||
build.SetupSignals(log, cancel, func() {
|
signal.SetupSignals(log, cancel, func() {
|
||||||
trace.Close()
|
trace.Close()
|
||||||
log.Cleanup()
|
log.Cleanup()
|
||||||
stat.Finish()
|
stat.Finish()
|
||||||
@@ -310,12 +310,11 @@ func main() {
|
|||||||
s.SetTotalActions(len(finalProductsList))
|
s.SetTotalActions(len(finalProductsList))
|
||||||
|
|
||||||
mpCtx := &mpContext{
|
mpCtx := &mpContext{
|
||||||
Context: ctx,
|
|
||||||
Logger: log,
|
Logger: log,
|
||||||
Status: s,
|
Status: s,
|
||||||
Tracer: trace,
|
SoongUi: soongUi,
|
||||||
|
MainOutDir: outputDir,
|
||||||
LogsDir: logsDir,
|
MainLogsDir: logsDir,
|
||||||
}
|
}
|
||||||
|
|
||||||
products := make(chan string, len(productsList))
|
products := make(chan string, len(productsList))
|
||||||
@@ -337,7 +336,7 @@ func main() {
|
|||||||
if product == "" {
|
if product == "" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
runSoongUiForProduct(mpCtx, product, soongUi, outputDir)
|
runSoongUiForProduct(mpCtx, product)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@@ -391,10 +390,10 @@ func cleanupAfterProduct(outDir, productZip string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func runSoongUiForProduct(mpctx *mpContext, product, soongUi, mainOutDir string) {
|
func runSoongUiForProduct(mpctx *mpContext, product string) {
|
||||||
outDir := filepath.Join(mainOutDir, product)
|
outDir := filepath.Join(mpctx.MainOutDir, product)
|
||||||
logsDir := filepath.Join(mpctx.LogsDir, product)
|
logsDir := filepath.Join(mpctx.MainLogsDir, product)
|
||||||
productZip := filepath.Join(mainOutDir, product+".zip")
|
productZip := filepath.Join(mpctx.MainOutDir, product+".zip")
|
||||||
consoleLogPath := filepath.Join(logsDir, "std.log")
|
consoleLogPath := filepath.Join(logsDir, "std.log")
|
||||||
|
|
||||||
if err := os.MkdirAll(outDir, 0777); err != nil {
|
if err := os.MkdirAll(outDir, 0777); err != nil {
|
||||||
@@ -429,7 +428,7 @@ func runSoongUiForProduct(mpctx *mpContext, product, soongUi, mainOutDir string)
|
|||||||
args = append(args, "dist")
|
args = append(args, "dist")
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.Command(soongUi, args...)
|
cmd := exec.Command(mpctx.SoongUi, args...)
|
||||||
cmd.Stdout = consoleLogWriter
|
cmd.Stdout = consoleLogWriter
|
||||||
cmd.Stderr = consoleLogWriter
|
cmd.Stderr = consoleLogWriter
|
||||||
cmd.Env = append(os.Environ(),
|
cmd.Env = append(os.Environ(),
|
||||||
|
@@ -20,6 +20,7 @@ blueprint_go_binary {
|
|||||||
name: "soong_ui",
|
name: "soong_ui",
|
||||||
deps: [
|
deps: [
|
||||||
"soong-ui-build",
|
"soong-ui-build",
|
||||||
|
"soong-ui-signal",
|
||||||
"soong-ui-logger",
|
"soong-ui-logger",
|
||||||
"soong-ui-terminal",
|
"soong-ui-terminal",
|
||||||
"soong-ui-tracer",
|
"soong-ui-tracer",
|
||||||
|
@@ -30,6 +30,7 @@ import (
|
|||||||
"android/soong/ui/build"
|
"android/soong/ui/build"
|
||||||
"android/soong/ui/logger"
|
"android/soong/ui/logger"
|
||||||
"android/soong/ui/metrics"
|
"android/soong/ui/metrics"
|
||||||
|
"android/soong/ui/signal"
|
||||||
"android/soong/ui/status"
|
"android/soong/ui/status"
|
||||||
"android/soong/ui/terminal"
|
"android/soong/ui/terminal"
|
||||||
"android/soong/ui/tracer"
|
"android/soong/ui/tracer"
|
||||||
@@ -190,7 +191,7 @@ func main() {
|
|||||||
stat.AddOutput(trace.StatusTracer())
|
stat.AddOutput(trace.StatusTracer())
|
||||||
|
|
||||||
// Set up a cleanup procedure in case the normal termination process doesn't work.
|
// Set up a cleanup procedure in case the normal termination process doesn't work.
|
||||||
build.SetupSignals(log, cancel, func() {
|
signal.SetupSignals(log, cancel, func() {
|
||||||
trace.Close()
|
trace.Close()
|
||||||
log.Cleanup()
|
log.Cleanup()
|
||||||
stat.Finish()
|
stat.Finish()
|
||||||
|
@@ -7,6 +7,7 @@ blueprint_go_binary {
|
|||||||
deps: [
|
deps: [
|
||||||
"soong-ui-build",
|
"soong-ui-build",
|
||||||
"soong-ui-logger",
|
"soong-ui-logger",
|
||||||
|
"soong-ui-signal",
|
||||||
"soong-ui-terminal",
|
"soong-ui-terminal",
|
||||||
"soong-ui-tracer",
|
"soong-ui-tracer",
|
||||||
],
|
],
|
||||||
|
@@ -27,6 +27,7 @@ import (
|
|||||||
"android/soong/ui/build"
|
"android/soong/ui/build"
|
||||||
"android/soong/ui/logger"
|
"android/soong/ui/logger"
|
||||||
"android/soong/ui/metrics"
|
"android/soong/ui/metrics"
|
||||||
|
"android/soong/ui/signal"
|
||||||
"android/soong/ui/status"
|
"android/soong/ui/status"
|
||||||
"android/soong/ui/terminal"
|
"android/soong/ui/terminal"
|
||||||
"android/soong/ui/tracer"
|
"android/soong/ui/tracer"
|
||||||
@@ -65,7 +66,7 @@ func (t *Test) Run(logsDir string) {
|
|||||||
stat.AddOutput(output)
|
stat.AddOutput(output)
|
||||||
stat.AddOutput(trace.StatusTracer())
|
stat.AddOutput(trace.StatusTracer())
|
||||||
|
|
||||||
build.SetupSignals(log, cancel, func() {
|
signal.SetupSignals(log, cancel, func() {
|
||||||
trace.Close()
|
trace.Close()
|
||||||
log.Cleanup()
|
log.Cleanup()
|
||||||
stat.Finish()
|
stat.Finish()
|
||||||
|
@@ -61,7 +61,6 @@ bootstrap_go_package {
|
|||||||
"proc_sync.go",
|
"proc_sync.go",
|
||||||
"rbe.go",
|
"rbe.go",
|
||||||
"sandbox_config.go",
|
"sandbox_config.go",
|
||||||
"signal.go",
|
|
||||||
"soong.go",
|
"soong.go",
|
||||||
"test_build.go",
|
"test_build.go",
|
||||||
"upload.go",
|
"upload.go",
|
||||||
|
28
ui/signal/Android.bp
Normal file
28
ui/signal/Android.bp
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
// Copyright 2021 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 {
|
||||||
|
default_applicable_licenses: ["Android-Apache-2.0"],
|
||||||
|
}
|
||||||
|
|
||||||
|
bootstrap_go_package {
|
||||||
|
name: "soong-ui-signal",
|
||||||
|
pkgPath: "android/soong/ui/signal",
|
||||||
|
srcs: [
|
||||||
|
"signal.go",
|
||||||
|
],
|
||||||
|
deps: [
|
||||||
|
"soong-ui-logger",
|
||||||
|
],
|
||||||
|
}
|
@@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package build
|
package signal
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
Reference in New Issue
Block a user