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

@@ -17,6 +17,7 @@ package java
import (
"encoding/json"
"fmt"
"os"
"android/soong/android"
)
@@ -91,21 +92,23 @@ func (j *jdepsGeneratorSingleton) GenerateBuildActions(ctx android.SingletonCont
moduleInfos[name] = dpInfo
})
jfpath := android.PathForOutput(ctx, jdepsJsonFileName)
jfpath := android.PathForOutput(ctx, jdepsJsonFileName).String()
err := createJsonFile(moduleInfos, jfpath)
if err != nil {
ctx.Errorf(err.Error())
}
}
func createJsonFile(moduleInfos map[string]android.IdeInfo, jfpath android.WritablePath) error {
func createJsonFile(moduleInfos map[string]android.IdeInfo, jfpath string) error {
file, err := os.Create(jfpath)
if err != nil {
return fmt.Errorf("Failed to create file: %s, relative: %v", jdepsJsonFileName, err)
}
defer file.Close()
buf, err := json.MarshalIndent(moduleInfos, "", "\t")
if err != nil {
return fmt.Errorf("JSON marshal of java deps failed: %s", err)
}
err = android.WriteFileToOutputDir(jfpath, buf, 0666)
if err != nil {
return fmt.Errorf("Writing java deps to %s failed: %s", jfpath.String(), err)
return fmt.Errorf("Write file failed: %s, relative: %v", jdepsJsonFileName, err)
}
fmt.Fprintf(file, string(buf))
return nil
}