Merge "Revert "Sandbox soong_build by changing to root directory"" am: e734832d25
am: 408fab4d25
am: f84fe5fbd4
Change-Id: Iac451a70c28566f8413b2495e8ae8a24b80e2a2f
This commit is contained in:
@@ -36,11 +36,10 @@ type globalConfigAndRaw struct {
|
||||
|
||||
func dexpreoptGlobalConfigRaw(ctx android.PathContext) globalConfigAndRaw {
|
||||
return ctx.Config().Once(dexpreoptGlobalConfigKey, func() interface{} {
|
||||
if data, err := ctx.Config().DexpreoptGlobalConfig(ctx); err != nil {
|
||||
panic(err)
|
||||
} else if data != nil {
|
||||
if f := ctx.Config().DexpreoptGlobalConfig(); f != "" {
|
||||
soongConfig := dexpreopt.CreateGlobalSoongConfig(ctx)
|
||||
globalConfig, err := dexpreopt.LoadGlobalConfig(ctx, data, soongConfig)
|
||||
ctx.AddNinjaFileDeps(f)
|
||||
globalConfig, data, err := dexpreopt.LoadGlobalConfig(ctx, f, soongConfig)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@@ -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