Add support for skipping just kati
The existing --skip-make flag disables both the config step and the kati step in the build. Add support for a --skip-kati flag that skips just the kati step, and refactor things so that the logic is shared between these two. Bug: 174315599 Test: TARGET_PRODUCT=aosp_arm64 soong_ui --make-mode --skip-kati; (verify soong.variables is regenerated) Change-Id: I75b1910fc1c12fcda130e37b7bc4c050131c7b33
This commit is contained in:
@@ -28,7 +28,7 @@ import (
|
|||||||
func SetupOutDir(ctx Context, config Config) {
|
func SetupOutDir(ctx Context, config Config) {
|
||||||
ensureEmptyFileExists(ctx, filepath.Join(config.OutDir(), "Android.mk"))
|
ensureEmptyFileExists(ctx, filepath.Join(config.OutDir(), "Android.mk"))
|
||||||
ensureEmptyFileExists(ctx, filepath.Join(config.OutDir(), "CleanSpec.mk"))
|
ensureEmptyFileExists(ctx, filepath.Join(config.OutDir(), "CleanSpec.mk"))
|
||||||
if !config.SkipMake() {
|
if !config.SkipKati() {
|
||||||
// Run soong_build with Kati for a hybrid build, e.g. running the
|
// Run soong_build with Kati for a hybrid build, e.g. running the
|
||||||
// AndroidMk singleton and postinstall commands. Communicate this to
|
// AndroidMk singleton and postinstall commands. Communicate this to
|
||||||
// soong_build by writing an empty .soong.kati_enabled marker file in the
|
// soong_build by writing an empty .soong.kati_enabled marker file in the
|
||||||
@@ -67,8 +67,8 @@ subninja {{.SoongNinjaFile}}
|
|||||||
`))
|
`))
|
||||||
|
|
||||||
func createCombinedBuildNinjaFile(ctx Context, config Config) {
|
func createCombinedBuildNinjaFile(ctx Context, config Config) {
|
||||||
// If we're in SkipMake mode, skip creating this file if it already exists
|
// If we're in SkipKati mode, skip creating this file if it already exists
|
||||||
if config.SkipMake() {
|
if config.SkipKati() {
|
||||||
if _, err := os.Stat(config.CombinedNinjaFile()); err == nil || !os.IsNotExist(err) {
|
if _, err := os.Stat(config.CombinedNinjaFile()); err == nil || !os.IsNotExist(err) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -208,10 +208,14 @@ func Build(ctx Context, config Config, what int) {
|
|||||||
|
|
||||||
SetupPath(ctx, config)
|
SetupPath(ctx, config)
|
||||||
|
|
||||||
if config.SkipMake() {
|
if config.SkipConfig() {
|
||||||
ctx.Verboseln("Skipping Make/Kati as requested")
|
ctx.Verboseln("Skipping Config as requested")
|
||||||
// If Make/Kati is disabled, then explicitly build using Soong and Ninja.
|
what = what &^ BuildProductConfig
|
||||||
what = what & (BuildSoong | BuildNinja)
|
}
|
||||||
|
|
||||||
|
if config.SkipKati() {
|
||||||
|
ctx.Verboseln("Skipping Kati as requested")
|
||||||
|
what = what &^ BuildKati
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.StartGoma() {
|
if config.StartGoma() {
|
||||||
@@ -276,7 +280,7 @@ func Build(ctx Context, config Config, what int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if what&BuildNinja != 0 {
|
if what&BuildNinja != 0 {
|
||||||
if !config.SkipMake() {
|
if what&BuildKati != 0 {
|
||||||
installCleanIfNecessary(ctx, config)
|
installCleanIfNecessary(ctx, config)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -46,7 +46,8 @@ type configImpl struct {
|
|||||||
verbose bool
|
verbose bool
|
||||||
checkbuild bool
|
checkbuild bool
|
||||||
dist bool
|
dist bool
|
||||||
skipMake bool
|
skipConfig bool
|
||||||
|
skipKati bool
|
||||||
skipSoongTests bool
|
skipSoongTests bool
|
||||||
|
|
||||||
// From the product config
|
// From the product config
|
||||||
@@ -536,7 +537,10 @@ func (c *configImpl) parseArgs(ctx Context, args []string) {
|
|||||||
} else if arg == "showcommands" {
|
} else if arg == "showcommands" {
|
||||||
c.verbose = true
|
c.verbose = true
|
||||||
} else if arg == "--skip-make" {
|
} else if arg == "--skip-make" {
|
||||||
c.skipMake = true
|
c.skipConfig = true
|
||||||
|
c.skipKati = true
|
||||||
|
} else if arg == "--skip-kati" {
|
||||||
|
c.skipKati = 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] == '-' {
|
||||||
@@ -697,7 +701,7 @@ func (c *configImpl) DistDir() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *configImpl) NinjaArgs() []string {
|
func (c *configImpl) NinjaArgs() []string {
|
||||||
if c.skipMake {
|
if c.skipKati {
|
||||||
return c.arguments
|
return c.arguments
|
||||||
}
|
}
|
||||||
return c.ninjaArgs
|
return c.ninjaArgs
|
||||||
@@ -740,8 +744,12 @@ func (c *configImpl) IsVerbose() bool {
|
|||||||
return c.verbose
|
return c.verbose
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *configImpl) SkipMake() bool {
|
func (c *configImpl) SkipKati() bool {
|
||||||
return c.skipMake
|
return c.skipKati
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *configImpl) SkipConfig() bool {
|
||||||
|
return c.skipConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *configImpl) TargetProduct() string {
|
func (c *configImpl) TargetProduct() string {
|
||||||
|
@@ -173,7 +173,7 @@ func runSoong(ctx Context, config Config) {
|
|||||||
|
|
||||||
distGzipFile(ctx, config, config.SoongNinjaFile(), "soong")
|
distGzipFile(ctx, config, config.SoongNinjaFile(), "soong")
|
||||||
|
|
||||||
if !config.SkipMake() {
|
if !config.SkipKati() {
|
||||||
distGzipFile(ctx, config, config.SoongAndroidMk(), "soong")
|
distGzipFile(ctx, config, config.SoongAndroidMk(), "soong")
|
||||||
distGzipFile(ctx, config, config.SoongMakeVarsMk(), "soong")
|
distGzipFile(ctx, config, config.SoongMakeVarsMk(), "soong")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user