Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e5abfec authored by Christopher Parsons's avatar Christopher Parsons Committed by Gerrit Code Review
Browse files

Merge "Delete bazel-related files while bazel is off" into main

parents a9ead6ef b6d6fc9c
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -632,6 +632,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() {
@@ -790,6 +794,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()