diff options
Diffstat (limited to 'android/config.go')
| -rw-r--r-- | android/config.go | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/android/config.go b/android/config.go index d3db68fd2..0767e7b51 100644 --- a/android/config.go +++ b/android/config.go @@ -72,13 +72,25 @@ func (c Config) SoongOutDir() string { } func (c Config) OutDir() string { - return c.soongOutDir + return c.outDir +} + +func (c Config) RunGoTests() bool { + return c.runGoTests } 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. @@ -122,9 +134,12 @@ type config struct { deviceConfig *deviceConfig - soongOutDir string // the path of the build output directory + outDir string // The output directory (usually out/) + soongOutDir string moduleListFile string // the path to the file which lists blueprint files to parse. + runGoTests bool + env map[string]string envLock sync.Mutex envDeps map[string]string @@ -137,8 +152,6 @@ type config struct { captureBuild bool // true for tests, saves build parameters for each module ignoreEnvironment bool // true for tests, returns empty from all Getenv calls - stopBefore bootstrap.StopBefore - fs pathtools.FileSystem mockBpList string @@ -283,9 +296,10 @@ func saveToBazelConfigFile(config *productVariables, outDir string) error { // NullConfig returns a mostly empty Config for use by standalone tools like dexpreopt_gen that // use the android package. -func NullConfig(soongOutDir string) Config { +func NullConfig(outDir, soongOutDir string) Config { return Config{ config: &config{ + outDir: outDir, soongOutDir: soongOutDir, fs: pathtools.OsFs, }, @@ -319,6 +333,9 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string ShippingApiLevel: stringPtr("30"), }, + outDir: buildDir, + // soongOutDir is inconsistent with production (it should be buildDir + "/soong") + // but a lot of tests assume this :( soongOutDir: buildDir, captureBuild: true, env: envCopy, @@ -397,7 +414,7 @@ func TestArchConfig(buildDir string, env map[string]string, bp string, fs map[st // 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) + newConfig, err := NewConfig(c.moduleListFile, c.runGoTests, c.outDir, c.soongOutDir, c.env) if err != nil { return Config{}, err } @@ -408,14 +425,16 @@ 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(moduleListFile string, runGoTests bool, outDir, soongOutDir string, availableEnv map[string]string) (Config, error) { // Make a config with default options. config := &config{ ProductVariablesFileName: filepath.Join(soongOutDir, productVariablesFileName), env: availableEnv, + outDir: outDir, soongOutDir: soongOutDir, + runGoTests: runGoTests, multilibConflicts: make(map[ArchType]bool), moduleListFile: moduleListFile, @@ -525,7 +544,7 @@ func (c *config) mockFileSystem(bp string, fs map[string][]byte) { pathsToParse := []string{} for candidate := range mockFS { base := filepath.Base(candidate) - if base == "Blueprints" || base == "Android.bp" { + if base == "Android.bp" { pathsToParse = append(pathsToParse, candidate) } } @@ -538,29 +557,16 @@ func (c *config) mockFileSystem(bp string, fs map[string][]byte) { c.mockBpList = blueprint.MockModuleListFile } -func (c *config) StopBefore() bootstrap.StopBefore { - return c.stopBefore -} - -// SetStopBefore configures soong_build to exit earlier at a specific point. -func (c *config) SetStopBefore(stopBefore bootstrap.StopBefore) { - c.stopBefore = stopBefore -} - func (c *config) SetAllowMissingDependencies() { c.productVariables.Allow_missing_dependencies = proptools.BoolPtr(true) } -var _ bootstrap.ConfigStopBefore = (*config)(nil) - // BlueprintToolLocation returns the directory containing build system tools // from Blueprint, like soong_zip and merge_zips. -func (c *config) BlueprintToolLocation() string { +func (c *config) HostToolDir() string { return filepath.Join(c.soongOutDir, "host", c.PrebuiltOS(), "bin") } -var _ bootstrap.ConfigBlueprintToolLocation = (*config)(nil) - func (c *config) HostToolPath(ctx PathContext, tool string) Path { return PathForOutput(ctx, "host", c.PrebuiltOS(), "bin", tool) } |