Revert "Sandbox soong_build by changing to root directory"

This reverts commit 05c25ccb4a.

Reason for revert: broke absolute OUT_DIR
Bug: 146437378

Change-Id: I523ed79d40e1c1ef040212ba794a7a084abea75d
This commit is contained in:
Colin Cross
2020-01-10 18:51:04 +00:00
parent 05c25ccb4a
commit 47e4f9e1e8
23 changed files with 130 additions and 208 deletions

View File

@@ -135,12 +135,12 @@ type jsonConfigurable interface {
}
func loadConfig(config *config) error {
err := loadFromConfigFile(&config.FileConfigurableOptions, absolutePath(config.ConfigFileName))
err := loadFromConfigFile(&config.FileConfigurableOptions, config.ConfigFileName)
if err != nil {
return err
}
return loadFromConfigFile(&config.productVariables, absolutePath(config.ProductVariablesFileName))
return loadFromConfigFile(&config.productVariables, config.ProductVariablesFileName)
}
// loads configuration options from a JSON file in the cwd.
@@ -204,17 +204,6 @@ func saveToConfigFile(config jsonConfigurable, filename string) error {
return nil
}
// NullConfig returns a mostly empty Config for use by standalone tools like dexpreopt_gen that
// use the android package.
func NullConfig(buildDir string) Config {
return Config{
config: &config{
buildDir: buildDir,
fs: pathtools.OsFs,
},
}
}
// TestConfig returns a Config object suitable for using for tests
func TestConfig(buildDir string, env map[string]string, bp string, fs map[string][]byte) Config {
envCopy := make(map[string]string)
@@ -331,7 +320,7 @@ func NewConfig(srcDir, buildDir string) (Config, error) {
buildDir: buildDir,
multilibConflicts: make(map[ArchType]bool),
fs: pathtools.NewOsFs(absSrcDir),
fs: pathtools.OsFs,
}
config.deviceConfig = &deviceConfig{
@@ -361,7 +350,7 @@ func NewConfig(srcDir, buildDir string) (Config, error) {
}
inMakeFile := filepath.Join(buildDir, ".soong.in_make")
if _, err := os.Stat(absolutePath(inMakeFile)); err == nil {
if _, err := os.Stat(inMakeFile); err == nil {
config.inMake = true
}
@@ -409,8 +398,6 @@ func NewConfig(srcDir, buildDir string) (Config, error) {
return Config{config}, nil
}
var TestConfigOsFs = map[string][]byte{}
// mockFileSystem replaces all reads with accesses to the provided map of
// filenames to contents stored as a byte slice.
func (c *config) mockFileSystem(bp string, fs map[string][]byte) {
@@ -914,13 +901,8 @@ func (c *config) BootJars() []string {
return c.productVariables.BootJars
}
func (c *config) DexpreoptGlobalConfig(ctx PathContext) ([]byte, error) {
if c.productVariables.DexpreoptGlobalConfig == nil {
return nil, nil
}
path := absolutePath(*c.productVariables.DexpreoptGlobalConfig)
ctx.AddNinjaFileDeps(path)
return ioutil.ReadFile(path)
func (c *config) DexpreoptGlobalConfig() string {
return String(c.productVariables.DexpreoptGlobalConfig)
}
func (c *config) FrameworksBaseDirExists(ctx PathContext) bool {