Sandbox soong_build by changing to root directory
Store the current working directory and then change to the root directory so that all file accesses must go through helpers in the android package that properly track dependencies. Fixes: 146437378 Test: m checkbuild Change-Id: I12a0f907753fefd1997ab8b4ea2ac331234093cf
This commit is contained in:
@@ -323,7 +323,7 @@ func (c *androidMkSingleton) GenerateBuildActions(ctx SingletonContext) {
|
||||
return
|
||||
}
|
||||
|
||||
err := translateAndroidMk(ctx, transMk.String(), androidMkModulesList)
|
||||
err := translateAndroidMk(ctx, absolutePath(transMk.String()), androidMkModulesList)
|
||||
if err != nil {
|
||||
ctx.Errorf(err.Error())
|
||||
}
|
||||
@@ -364,8 +364,8 @@ func translateAndroidMk(ctx SingletonContext, mkFile string, mods []blueprint.Mo
|
||||
}
|
||||
|
||||
// Don't write to the file if it hasn't changed
|
||||
if _, err := os.Stat(mkFile); !os.IsNotExist(err) {
|
||||
if data, err := ioutil.ReadFile(mkFile); err == nil {
|
||||
if _, err := os.Stat(absolutePath(mkFile)); !os.IsNotExist(err) {
|
||||
if data, err := ioutil.ReadFile(absolutePath(mkFile)); err == nil {
|
||||
matches := buf.Len() == len(data)
|
||||
|
||||
if matches {
|
||||
@@ -383,7 +383,7 @@ func translateAndroidMk(ctx SingletonContext, mkFile string, mods []blueprint.Mo
|
||||
}
|
||||
}
|
||||
|
||||
return ioutil.WriteFile(mkFile, buf.Bytes(), 0666)
|
||||
return ioutil.WriteFile(absolutePath(mkFile), buf.Bytes(), 0666)
|
||||
}
|
||||
|
||||
func translateAndroidMkModule(ctx SingletonContext, w io.Writer, mod blueprint.Module) error {
|
||||
|
Reference in New Issue
Block a user