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

Commit f99915f5 authored by Dan Willemsen's avatar Dan Willemsen
Browse files

Speed up build_test

Stop writing out ninja files, as they become very large, especially when
multiplied by the number of defined products.

Test: treehugger
Change-Id: Id9529d14040acb72a0188e58b5db2911f142071e
parent 67df651c
Loading
Loading
Loading
Loading
+4 −6
Original line number Original line Diff line number Diff line
@@ -393,6 +393,9 @@ func buildProduct(mpctx *mpContext, product string) {


	config := build.NewConfig(ctx, flag.Args()...)
	config := build.NewConfig(ctx, flag.Args()...)
	config.Environment().Set("OUT_DIR", outDir)
	config.Environment().Set("OUT_DIR", outDir)
	if !*keepArtifacts {
		config.Environment().Set("EMPTY_NINJA_FILE", "true")
	}
	build.FindSources(ctx, config, mpctx.Finder)
	build.FindSources(ctx, config, mpctx.Finder)
	config.Lunch(ctx, product, *buildVariant)
	config.Lunch(ctx, product, *buildVariant)


@@ -413,12 +416,7 @@ func buildProduct(mpctx *mpContext, product string) {
				log.Fatalf("Error zipping artifacts: %v", err)
				log.Fatalf("Error zipping artifacts: %v", err)
			}
			}
		}
		}
		if *incremental {
		if !*incremental {
			// Save space, Kati doesn't notice
			if f := config.KatiBuildNinjaFile(); f != "" {
				os.Truncate(f, 0)
			}
		} else {
			os.RemoveAll(outDir)
			os.RemoveAll(outDir)
		}
		}
	}()
	}()
+3 −0
Original line number Original line Diff line number Diff line
@@ -143,6 +143,9 @@ func NewConfig(ctx Context, args ...string) Config {
		"ANDROID_DEV_SCRIPTS",
		"ANDROID_DEV_SCRIPTS",
		"ANDROID_EMULATOR_PREBUILTS",
		"ANDROID_EMULATOR_PREBUILTS",
		"ANDROID_PRE_BUILD_PATHS",
		"ANDROID_PRE_BUILD_PATHS",

		// Only set in multiproduct_kati after config generation
		"EMPTY_NINJA_FILE",
	)
	)


	// Tell python not to spam the source tree with .pyc files.
	// Tell python not to spam the source tree with .pyc files.
+4 −0
Original line number Original line Diff line number Diff line
@@ -81,6 +81,10 @@ func runKati(ctx Context, config Config, extraSuffix string, args []string, envF
		"--kati_stats",
		"--kati_stats",
	}, args...)
	}, args...)


	if config.Environment().IsEnvTrue("EMPTY_NINJA_FILE") {
		args = append(args, "--empty_ninja_file")
	}

	cmd := Command(ctx, config, "ckati", executable, args...)
	cmd := Command(ctx, config, "ckati", executable, args...)
	cmd.Sandbox = katiSandbox
	cmd.Sandbox = katiSandbox
	pipe, err := cmd.StdoutPipe()
	pipe, err := cmd.StdoutPipe()