Add a soong-only mode to soong-ui
The previous --skip-kati flag could be interpreted as "do not run kati to re-generate ninja file". Add a more specific flag for the "soong only" build use-case, where we do not load the kati-generated ninja files at all. Bug: 189187214 Test: build/soong/soong_ui.bash \ --make-mode \ --soong-only --skip-soong-tests \ TARGET_PRODUCT=mainline_sdk \ SOONG_ALLOW_MISSING_DEPENDENCIES=true \ SOONG_SDK_SNAPSHOT_VERSION=unversioned \ SOONG_SDK_SNAPSHOT_USE_SRCJAR=true \ out/soong/mainline-sdks/art-module-sdk.zip Change-Id: I91abbd28af517d4b550ebc6d88fd64947caf9545
This commit is contained in:
@@ -60,15 +60,15 @@ builddir = {{.OutDir}}
|
|||||||
{{end -}}
|
{{end -}}
|
||||||
pool highmem_pool
|
pool highmem_pool
|
||||||
depth = {{.HighmemParallel}}
|
depth = {{.HighmemParallel}}
|
||||||
{{if .HasKatiSuffix}}subninja {{.KatiBuildNinjaFile}}
|
{{if and (not .SkipKatiNinja) .HasKatiSuffix}}subninja {{.KatiBuildNinjaFile}}
|
||||||
subninja {{.KatiPackageNinjaFile}}
|
subninja {{.KatiPackageNinjaFile}}
|
||||||
{{end -}}
|
{{end -}}
|
||||||
subninja {{.SoongNinjaFile}}
|
subninja {{.SoongNinjaFile}}
|
||||||
`))
|
`))
|
||||||
|
|
||||||
func createCombinedBuildNinjaFile(ctx Context, config Config) {
|
func createCombinedBuildNinjaFile(ctx Context, config Config) {
|
||||||
// If we're in SkipKati mode, skip creating this file if it already exists
|
// If we're in SkipKati mode but want to run kati ninja, skip creating this file if it already exists
|
||||||
if config.SkipKati() {
|
if config.SkipKati() && !config.SkipKatiNinja() {
|
||||||
if _, err := os.Stat(config.CombinedNinjaFile()); err == nil || !os.IsNotExist(err) {
|
if _, err := os.Stat(config.CombinedNinjaFile()); err == nil || !os.IsNotExist(err) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -94,13 +94,15 @@ const (
|
|||||||
RunSoong = 1 << iota
|
RunSoong = 1 << iota
|
||||||
// Whether to run kati to generate a ninja file.
|
// Whether to run kati to generate a ninja file.
|
||||||
RunKati = 1 << iota
|
RunKati = 1 << iota
|
||||||
|
// Whether to include the kati-generated ninja file in the combined ninja.
|
||||||
|
RunKatiNinja = 1 << iota
|
||||||
// Whether to run ninja on the combined ninja.
|
// Whether to run ninja on the combined ninja.
|
||||||
RunNinja = 1 << iota
|
RunNinja = 1 << iota
|
||||||
// Whether to run bazel on the combined ninja.
|
// Whether to run bazel on the combined ninja.
|
||||||
RunBazel = 1 << iota
|
RunBazel = 1 << iota
|
||||||
RunBuildTests = 1 << iota
|
RunBuildTests = 1 << iota
|
||||||
RunAll = RunProductConfig | RunSoong | RunKati | RunNinja
|
RunAll = RunProductConfig | RunSoong | RunKati | RunKatiNinja | RunNinja
|
||||||
RunAllWithBazel = RunProductConfig | RunSoong | RunKati | RunBazel
|
RunAllWithBazel = RunProductConfig | RunSoong | RunKati | RunKatiNinja | RunBazel
|
||||||
)
|
)
|
||||||
|
|
||||||
// checkProblematicFiles fails the build if existing Android.mk or CleanSpec.mk files are found at the root of the tree.
|
// checkProblematicFiles fails the build if existing Android.mk or CleanSpec.mk files are found at the root of the tree.
|
||||||
@@ -228,6 +230,10 @@ func Build(ctx Context, config Config) {
|
|||||||
ctx.Verboseln("Skipping Kati as requested")
|
ctx.Verboseln("Skipping Kati as requested")
|
||||||
what = what &^ RunKati
|
what = what &^ RunKati
|
||||||
}
|
}
|
||||||
|
if config.SkipKatiNinja() {
|
||||||
|
ctx.Verboseln("Skipping use of Kati ninja as requested")
|
||||||
|
what = what &^ RunKatiNinja
|
||||||
|
}
|
||||||
if config.SkipNinja() {
|
if config.SkipNinja() {
|
||||||
ctx.Verboseln("Skipping Ninja as requested")
|
ctx.Verboseln("Skipping Ninja as requested")
|
||||||
what = what &^ RunNinja
|
what = what &^ RunNinja
|
||||||
@@ -277,7 +283,7 @@ func Build(ctx Context, config Config) {
|
|||||||
runKatiPackage(ctx, config)
|
runKatiPackage(ctx, config)
|
||||||
|
|
||||||
ioutil.WriteFile(config.LastKatiSuffixFile(), []byte(config.KatiSuffix()), 0666) // a+rw
|
ioutil.WriteFile(config.LastKatiSuffixFile(), []byte(config.KatiSuffix()), 0666) // a+rw
|
||||||
} else {
|
} else if what&RunKatiNinja != 0 {
|
||||||
// Load last Kati Suffix if it exists
|
// Load last Kati Suffix if it exists
|
||||||
if katiSuffix, err := ioutil.ReadFile(config.LastKatiSuffixFile()); err == nil {
|
if katiSuffix, err := ioutil.ReadFile(config.LastKatiSuffixFile()); err == nil {
|
||||||
ctx.Verboseln("Loaded previous kati config:", string(katiSuffix))
|
ctx.Verboseln("Loaded previous kati config:", string(katiSuffix))
|
||||||
|
@@ -48,6 +48,7 @@ type configImpl struct {
|
|||||||
dist bool
|
dist bool
|
||||||
skipConfig bool
|
skipConfig bool
|
||||||
skipKati bool
|
skipKati bool
|
||||||
|
skipKatiNinja bool
|
||||||
skipNinja bool
|
skipNinja bool
|
||||||
skipSoongTests bool
|
skipSoongTests bool
|
||||||
|
|
||||||
@@ -573,7 +574,11 @@ func (c *configImpl) parseArgs(ctx Context, args []string) {
|
|||||||
c.skipConfig = true
|
c.skipConfig = true
|
||||||
c.skipKati = true
|
c.skipKati = true
|
||||||
} else if arg == "--skip-kati" {
|
} else if arg == "--skip-kati" {
|
||||||
|
// TODO: remove --skip-kati once module builds have been migrated to --song-only
|
||||||
c.skipKati = true
|
c.skipKati = true
|
||||||
|
} else if arg == "--soong-only" {
|
||||||
|
c.skipKati = true
|
||||||
|
c.skipKatiNinja = true
|
||||||
} else if arg == "--skip-soong-tests" {
|
} else if arg == "--skip-soong-tests" {
|
||||||
c.skipSoongTests = true
|
c.skipSoongTests = true
|
||||||
} else if len(arg) > 0 && arg[0] == '-' {
|
} else if len(arg) > 0 && arg[0] == '-' {
|
||||||
@@ -789,6 +794,10 @@ func (c *configImpl) SkipKati() bool {
|
|||||||
return c.skipKati
|
return c.skipKati
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *configImpl) SkipKatiNinja() bool {
|
||||||
|
return c.skipKatiNinja
|
||||||
|
}
|
||||||
|
|
||||||
func (c *configImpl) SkipNinja() bool {
|
func (c *configImpl) SkipNinja() bool {
|
||||||
return c.skipNinja
|
return c.skipNinja
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user