aboutsummaryrefslogtreecommitdiffstats
path: root/ui/build/build.go
diff options
context:
space:
mode:
Diffstat (limited to 'ui/build/build.go')
-rw-r--r--ui/build/build.go31
1 files changed, 28 insertions, 3 deletions
diff --git a/ui/build/build.go b/ui/build/build.go
index 32f4ba57..f7c305cd 100644
--- a/ui/build/build.go
+++ b/ui/build/build.go
@@ -26,7 +26,9 @@ import (
func SetupOutDir(ctx Context, config Config) {
ensureEmptyFileExists(ctx, filepath.Join(config.OutDir(), "Android.mk"))
ensureEmptyFileExists(ctx, filepath.Join(config.OutDir(), "CleanSpec.mk"))
- ensureEmptyFileExists(ctx, filepath.Join(config.SoongOutDir(), ".soong.in_make"))
+ if !config.SkipMake() {
+ ensureEmptyFileExists(ctx, filepath.Join(config.SoongOutDir(), ".soong.in_make"))
+ }
// The ninja_build file is used by our buildbots to understand that the output
// can be parsed as ninja output.
ensureEmptyFileExists(ctx, filepath.Join(config.OutDir(), "ninja_build"))
@@ -34,12 +36,20 @@ func SetupOutDir(ctx Context, config Config) {
var combinedBuildNinjaTemplate = template.Must(template.New("combined").Parse(`
builddir = {{.OutDir}}
-include {{.KatiNinjaFile}}
+{{if .HasKatiSuffix}}include {{.KatiNinjaFile}}
+{{end -}}
include {{.SoongNinjaFile}}
build {{.CombinedNinjaFile}}: phony {{.SoongNinjaFile}}
`))
func createCombinedBuildNinjaFile(ctx Context, config Config) {
+ // If we're in SkipMake mode, skip creating this file if it already exists
+ if config.SkipMake() {
+ if _, err := os.Stat(config.CombinedNinjaFile()); err == nil || !os.IsNotExist(err) {
+ return
+ }
+ }
+
file, err := os.Create(config.CombinedNinjaFile())
if err != nil {
ctx.Fatalln("Failed to create combined ninja file:", err)
@@ -106,6 +116,11 @@ func Build(ctx Context, config Config, what int) {
ctx.Verboseln("Starting build with args:", config.Arguments())
ctx.Verboseln("Environment:", config.Environment().Environ())
+ if config.SkipMake() {
+ ctx.Verboseln("Skipping Make/Kati as requested")
+ what = what & (BuildSoong | BuildNinja)
+ }
+
if inList("help", config.Arguments()) {
help(ctx, config, what)
return
@@ -148,10 +163,20 @@ func Build(ctx Context, config Config, what int) {
if what&BuildKati != 0 {
// Run ckati
runKati(ctx, config)
+
+ ioutil.WriteFile(config.LastKatiSuffixFile(), []byte(config.KatiSuffix()), 0777)
+ } else {
+ // Load last Kati Suffix if it exists
+ if katiSuffix, err := ioutil.ReadFile(config.LastKatiSuffixFile()); err == nil {
+ ctx.Verboseln("Loaded previous kati config:", string(katiSuffix))
+ config.SetKatiSuffix(string(katiSuffix))
+ }
}
if what&BuildNinja != 0 {
- installCleanIfNecessary(ctx, config)
+ if !config.SkipMake() {
+ installCleanIfNecessary(ctx, config)
+ }
// Write combined ninja file
createCombinedBuildNinjaFile(ctx, config)