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

@@ -75,10 +75,26 @@ func (c Config) OutDir() string {
return c.soongOutDir
}
func (c Config) RunGoTests() bool {
return c.runGoTests
}
func (c Config) UseValidationsForGoTests() bool {
return c.useValidationsForGoTests
}
func (c Config) DebugCompilation() bool {
return false // Never compile Go code in the main build for debugging
}
func (c Config) Subninjas() []string {
return []string{}
}
func (c Config) PrimaryBuilderInvocations() []bootstrap.PrimaryBuilderInvocation {
return []bootstrap.PrimaryBuilderInvocation{}
}
// A DeviceConfig object represents the configuration for a particular device
// being built. For now there will only be one of these, but in the future there
// may be multiple devices being built.
@@ -125,6 +141,9 @@ type config struct {
soongOutDir string // the path of the build output directory
moduleListFile string // the path to the file which lists blueprint files to parse.
runGoTests bool
useValidationsForGoTests bool
env map[string]string
envLock sync.Mutex
envDeps map[string]string
@@ -396,8 +415,8 @@ func TestArchConfig(buildDir string, env map[string]string, bp string, fs map[st
// bootstrap run. Only per-run data is reset. Data which needs to persist across
// multiple runs in the same program execution is carried over (such as Bazel
// context or environment deps).
func ConfigForAdditionalRun(c Config) (Config, error) {
newConfig, err := NewConfig(c.soongOutDir, c.moduleListFile, c.env)
func ConfigForAdditionalRun(cmdlineArgs bootstrap.Args, c Config) (Config, error) {
newConfig, err := NewConfig(cmdlineArgs, c.soongOutDir, c.env)
if err != nil {
return Config{}, err
}
@@ -408,17 +427,19 @@ func ConfigForAdditionalRun(c Config) (Config, error) {
// NewConfig creates a new Config object. The srcDir argument specifies the path
// to the root source directory. It also loads the config file, if found.
func NewConfig(soongOutDir string, moduleListFile string, availableEnv map[string]string) (Config, error) {
func NewConfig(cmdlineArgs bootstrap.Args, soongOutDir string, availableEnv map[string]string) (Config, error) {
// Make a config with default options.
config := &config{
ProductVariablesFileName: filepath.Join(soongOutDir, productVariablesFileName),
env: availableEnv,
soongOutDir: soongOutDir,
multilibConflicts: make(map[ArchType]bool),
soongOutDir: soongOutDir,
runGoTests: cmdlineArgs.RunGoTests,
useValidationsForGoTests: cmdlineArgs.UseValidations,
multilibConflicts: make(map[ArchType]bool),
moduleListFile: moduleListFile,
moduleListFile: cmdlineArgs.ModuleListFile,
fs: pathtools.NewOsFs(absSrcDir),
}