Delete bazel-related files while bazel is off
Bug: 189485959 Test: Manually verified that files are removed Test: Presubmits Change-Id: Ia279937d6d335174776ff661ab20c7821b979ca7
This commit is contained in:
parent
ee44d32add
commit
b6d6fc9c63
1 changed files with 16 additions and 0 deletions
|
@ -631,6 +631,10 @@ func runSoong(ctx Context, config Config) {
|
|||
|
||||
if config.BazelBuildEnabled() || config.Bp2Build() {
|
||||
checkEnvironmentFile(ctx, soongBuildEnv, config.UsedEnvFile(bp2buildFilesTag))
|
||||
} else {
|
||||
// Remove bazel files in the event that bazel is disabled for the build.
|
||||
// These files may have been left over from a previous bazel-enabled build.
|
||||
cleanBazelFiles(config)
|
||||
}
|
||||
|
||||
if config.JsonModuleGraph() {
|
||||
|
@ -776,6 +780,18 @@ func loadSoongBuildMetrics(ctx Context, config Config, oldTimestamp time.Time) {
|
|||
}
|
||||
}
|
||||
|
||||
func cleanBazelFiles(config Config) {
|
||||
files := []string{
|
||||
shared.JoinPath(config.SoongOutDir(), "bp2build"),
|
||||
shared.JoinPath(config.SoongOutDir(), "workspace"),
|
||||
shared.JoinPath(config.SoongOutDir(), bazel.SoongInjectionDirName),
|
||||
shared.JoinPath(config.OutDir(), "bazel")}
|
||||
|
||||
for _, f := range files {
|
||||
os.RemoveAll(f)
|
||||
}
|
||||
}
|
||||
|
||||
func runMicrofactory(ctx Context, config Config, name string, pkg string, mapping map[string]string) {
|
||||
ctx.BeginTrace(metrics.RunSoong, name)
|
||||
defer ctx.EndTrace()
|
||||
|
|
Loading…
Reference in a new issue