aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2017-05-12 19:28:13 -0700
committerDan Willemsen <dwillemsen@google.com>2017-05-15 14:46:04 -0700
commit0b73b4bc3735ea33d6c2ef873239b54eead3a4b2 (patch)
tree6a37395fe9fda25093d9d029a38702fc1597d205 /ui
parent02f3add3a33ce563fb1172923ca0b5321f0edce1 (diff)
downloadbuild_soong-0b73b4bc3735ea33d6c2ef873239b54eead3a4b2.tar.gz
build_soong-0b73b4bc3735ea33d6c2ef873239b54eead3a4b2.tar.bz2
build_soong-0b73b4bc3735ea33d6c2ef873239b54eead3a4b2.zip
Move clean/clobber to soong_ui
So that we don't have to load up all the makefile state just to remove the output directory. Starting from a completely empty out directory: kati: 16s soong_ui: 2.0s From a minimal out directory (m -j blueprint_tools): kati: 3.8s soong_ui: 0.4s Test: m -j clean Test: m -j clobber Change-Id: Ibeec6fbfa29387750342a752a55336caca4b3992
Diffstat (limited to 'ui')
-rw-r--r--ui/build/build.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/ui/build/build.go b/ui/build/build.go
index d6059c0b..67850829 100644
--- a/ui/build/build.go
+++ b/ui/build/build.go
@@ -73,6 +73,17 @@ func Build(ctx Context, config Config, what int) {
cmd.Stderr = ctx.Stderr()
cmd.RunOrFatal()
return
+ } else if inList("clean", config.Arguments()) || inList("clobber", config.Arguments()) {
+ // We can't use os.RemoveAll, since we don't want to remove the
+ // output directory itself, in case it's a symlink. So just do
+ // exactly what make used to do.
+ cmd := Command(ctx, config, "rm -rf $OUT_DIR/*",
+ "/bin/bash", "-c", "rm -rf "+config.OutDir()+"/*")
+ cmd.Stdout = ctx.Stdout()
+ cmd.Stderr = ctx.Stderr()
+ cmd.RunOrFatal()
+ ctx.Println("Entire build directory removed.")
+ return
}
SetupOutDir(ctx, config)