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:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user