Remove the bootstrap.Config class.

It was confusing because bootstrapping uses two configurations: the
"global" config and the special-cased bootstrap one.

This change merges them.

Test: Presubmits.
Change-Id: I82b482cbe28a343ab6991374b2a28667e1a06b48
This commit is contained in:
Lukacs T. Berki
2021-09-02 09:58:09 +02:00
parent 7686708a43
commit ea1a31c07f
3 changed files with 64 additions and 19 deletions

View File

@@ -71,10 +71,14 @@ func writeEnvironmentFile(ctx Context, envFile string, envDeps map[string]string
// A tiny struct used to tell Blueprint that it's in bootstrap mode. It would
// probably be nicer to use a flag in bootstrap.Args instead.
type BlueprintConfig struct {
toolDir string
soongOutDir string
outDir string
debugCompilation bool
toolDir string
soongOutDir string
outDir string
runGoTests bool
useValidations bool
debugCompilation bool
subninjas []string
primaryBuilderInvocations []bootstrap.PrimaryBuilderInvocation
}
func (c BlueprintConfig) HostToolDir() string {
@@ -89,10 +93,26 @@ func (c BlueprintConfig) OutDir() string {
return c.outDir
}
func (c BlueprintConfig) RunGoTests() bool {
return c.runGoTests
}
func (c BlueprintConfig) UseValidationsForGoTests() bool {
return c.useValidations
}
func (c BlueprintConfig) DebugCompilation() bool {
return c.debugCompilation
}
func (c BlueprintConfig) Subninjas() []string {
return c.subninjas
}
func (c BlueprintConfig) PrimaryBuilderInvocations() []bootstrap.PrimaryBuilderInvocation {
return c.primaryBuilderInvocations
}
func environmentArgs(config Config, suffix string) []string {
return []string{
"--available_env", shared.JoinPath(config.SoongOutDir(), availableEnvFile),
@@ -211,10 +231,14 @@ func bootstrapBlueprint(ctx Context, config Config) {
blueprintCtx := blueprint.NewContext()
blueprintCtx.SetIgnoreUnknownModuleTypes(true)
blueprintConfig := BlueprintConfig{
soongOutDir: config.SoongOutDir(),
toolDir: config.HostToolDir(),
outDir: config.OutDir(),
debugCompilation: os.Getenv("SOONG_DELVE") != "",
soongOutDir: config.SoongOutDir(),
toolDir: config.HostToolDir(),
outDir: config.OutDir(),
runGoTests: !config.skipSoongTests,
useValidations: true,
debugCompilation: os.Getenv("SOONG_DELVE") != "",
subninjas: args.Subninjas,
primaryBuilderInvocations: args.PrimaryBuilderInvocations,
}
args.EmptyNinjaFile = false