Remove kati marker in soong-only build

Previously we ensured the kati marker exists in kati-enabled builds, but
did not ensure the kati marker didn't exist in non-kati-enabled builds,
resulting in soong thinking kati would run after it when it would not.

Also change the condition to only create the kati_enabled marker if we
don't skip kati or kati ninja.

Bug: 189187214
Test: m nothing && soong_ui --make-mode --soong-only && verify
      kati_enabled marker is gone
Change-Id: If196b194b6aee38e9d4135889a4a4048ee5add82
This commit is contained in:
Anton Hansson
2021-06-18 16:37:14 +01:00
parent 22fd032ccb
commit 17fc5a03da

View File

@@ -28,16 +28,20 @@ import (
func SetupOutDir(ctx Context, config Config) {
ensureEmptyFileExists(ctx, filepath.Join(config.OutDir(), "Android.mk"))
ensureEmptyFileExists(ctx, filepath.Join(config.OutDir(), "CleanSpec.mk"))
if !config.SkipKati() {
// Run soong_build with Kati for a hybrid build, e.g. running the
// AndroidMk singleton and postinstall commands. Communicate this to
// soong_build by writing an empty .soong.kati_enabled marker file in the
// soong_build output directory for the soong_build primary builder to
// know if the user wants to run Kati after.
//
// This does not preclude running Kati for *product configuration purposes*.
ensureEmptyFileExists(ctx, filepath.Join(config.SoongOutDir(), ".soong.kati_enabled"))
// Potentially write a marker file for whether kati is enabled. This is used by soong_build to
// potentially run the AndroidMk singleton and postinstall commands.
// Note that the absence of the file does not not preclude running Kati for product
// configuration purposes.
katiEnabledMarker := filepath.Join(config.SoongOutDir(), ".soong.kati_enabled")
if config.SkipKatiNinja() {
os.Remove(katiEnabledMarker)
// Note that we can not remove the file for SkipKati builds yet -- some continuous builds
// --skip-make builds rely on kati targets being defined.
} else if !config.SkipKati() {
ensureEmptyFileExists(ctx, katiEnabledMarker)
}
// 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"))