aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2017-07-24 22:26:54 -0700
committerDan Willemsen <dwillemsen@google.com>2017-08-23 01:53:33 +0000
commit59fdf96fcf26ad83c611b57f7afefb60a02ea382 (patch)
tree091d55c3b3ee4f403ed56bd8af6911eeec773c05 /ui
parent56ad256e70d863e415e37b8780edc2dfed45c872 (diff)
downloadbuild_soong-59fdf96fcf26ad83c611b57f7afefb60a02ea382.tar.gz
build_soong-59fdf96fcf26ad83c611b57f7afefb60a02ea382.tar.bz2
build_soong-59fdf96fcf26ad83c611b57f7afefb60a02ea382.zip
Split CleanSpec processing out of main Kati run
Instead of pairing the reading of CleanSpec.mk files with the reading of Android.mk files, split them into separate, individually cachable steps. This way we only read Android.mk files once after a clean/sync. We'll still read the CleanSpec.mk files multiple times, but that's significantly faster than reading all the Android.mk files. This adds about 50ms if kati doesn't need to reread the CleanSpec.mk files. Reading all the CleanSpec.mk files takes about a second. Bug: 35970961 Test: m clean; m nothing; m nothing Test: Add CleanSpec.mk line, see it executed. Change-Id: I83bad15c50709510959d5b8b673a907b8aa7de82
Diffstat (limited to 'ui')
-rw-r--r--ui/build/kati.go36
-rw-r--r--ui/build/sandbox_darwin.go11
-rw-r--r--ui/build/sandbox_linux.go11
3 files changed, 46 insertions, 12 deletions
diff --git a/ui/build/kati.go b/ui/build/kati.go
index 4bb2db97..cc02c761 100644
--- a/ui/build/kati.go
+++ b/ui/build/kati.go
@@ -59,11 +59,13 @@ func genKatiSuffix(ctx Context, config Config) {
}
func runKati(ctx Context, config Config) {
+ genKatiSuffix(ctx, config)
+
+ runKatiCleanSpec(ctx, config)
+
ctx.BeginTrace("kati")
defer ctx.EndTrace()
- genKatiSuffix(ctx, config)
-
executable := config.PrebuiltBuildTool("ckati")
args := []string{
"--ninja",
@@ -159,3 +161,33 @@ func katiRewriteOutput(ctx Context, pipe io.ReadCloser) {
fmt.Fprintln(ctx.Stdout())
}
}
+
+func runKatiCleanSpec(ctx Context, config Config) {
+ ctx.BeginTrace("kati cleanspec")
+ defer ctx.EndTrace()
+
+ executable := config.PrebuiltBuildTool("ckati")
+ args := []string{
+ "--ninja",
+ "--ninja_dir=" + config.OutDir(),
+ "--ninja_suffix=" + config.KatiSuffix() + "-cleanspec",
+ "--regen",
+ "--detect_android_echo",
+ "--color_warnings",
+ "--gen_all_targets",
+ "--werror_find_emulator",
+ "--use_find_emulator",
+ "-f", "build/make/core/cleanbuild.mk",
+ "BUILDING_WITH_NINJA=true",
+ "SOONG_MAKEVARS_MK=" + config.SoongMakeVarsMk(),
+ }
+
+ cmd := Command(ctx, config, "ckati", executable, args...)
+ cmd.Sandbox = katiCleanSpecSandbox
+ cmd.Stdout = ctx.Stdout()
+ cmd.Stderr = ctx.Stderr()
+
+ // Kati leaks memory, so ensure leak detection is turned off
+ cmd.Environment.Set("ASAN_OPTIONS", "detect_leaks=0")
+ cmd.RunOrFatal()
+}
diff --git a/ui/build/sandbox_darwin.go b/ui/build/sandbox_darwin.go
index 54c145c5..60407d49 100644
--- a/ui/build/sandbox_darwin.go
+++ b/ui/build/sandbox_darwin.go
@@ -22,11 +22,12 @@ import (
type Sandbox string
const (
- noSandbox = ""
- globalSandbox = "build/soong/ui/build/sandbox/darwin/global.sb"
- makeSandbox = globalSandbox
- soongSandbox = globalSandbox
- katiSandbox = globalSandbox
+ noSandbox = ""
+ globalSandbox = "build/soong/ui/build/sandbox/darwin/global.sb"
+ makeSandbox = globalSandbox
+ soongSandbox = globalSandbox
+ katiSandbox = globalSandbox
+ katiCleanSpecSandbox = globalSandbox
)
var sandboxExecPath string
diff --git a/ui/build/sandbox_linux.go b/ui/build/sandbox_linux.go
index fb48b9cb..6615d374 100644
--- a/ui/build/sandbox_linux.go
+++ b/ui/build/sandbox_linux.go
@@ -17,11 +17,12 @@ package build
type Sandbox bool
const (
- noSandbox = false
- globalSandbox = false
- makeSandbox = false
- soongSandbox = false
- katiSandbox = false
+ noSandbox = false
+ globalSandbox = false
+ makeSandbox = false
+ soongSandbox = false
+ katiSandbox = false
+ katiCleanSpecSandbox = false
)
func (c *Cmd) sandboxSupported() bool {