Revert "Sandbox soong_build by changing to root directory"
This reverts commit 05c25ccb4adb5329add700b533416c226cdbfa96.
Reason for revert: broke absolute OUT_DIR
Bug: 146437378
Change-Id: I523ed79d40e1c1ef040212ba794a7a084abea75d
diff --git a/android/config.go b/android/config.go
index 3c49c1a..101f457 100644
--- a/android/config.go
+++ b/android/config.go
@@ -135,12 +135,12 @@
}
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 @@
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 @@
buildDir: buildDir,
multilibConflicts: make(map[ArchType]bool),
- fs: pathtools.NewOsFs(absSrcDir),
+ fs: pathtools.OsFs,
}
config.deviceConfig = &deviceConfig{
@@ -361,7 +350,7 @@
}
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 @@
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 @@
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 {