Have Soong try to enforce that genrules declare all their outputs.

This causes Soong to put the outputs of each genrule into a temporary
location and copy the declared outputs back to the output directory.
This gets the process closer to having an actual sandbox.

Bug: 35562758
Test: make

Change-Id: I8048fbf1a3899a86fb99d71b60669b6633b07b3e
This commit is contained in:
Jeff Gaston
2017-03-29 17:29:06 -07:00
parent 6b78fa8c01
commit efc1b412f1
10 changed files with 254 additions and 21 deletions

View File

@@ -50,6 +50,19 @@ func ensureDirectoriesExist(ctx Context, dirs ...string) {
}
}
// ensureEmptyDirectoriesExist ensures that the given directories exist and are empty
func ensureEmptyDirectoriesExist(ctx Context, dirs ...string) {
// remove all the directories
for _, dir := range dirs {
err := os.RemoveAll(dir)
if err != nil {
ctx.Fatalf("Error removing %s: %q\n", dir, err)
}
}
// recreate all the directories
ensureDirectoriesExist(ctx, dirs...)
}
// ensureEmptyFileExists ensures that the containing directory exists, and the
// specified file exists. If it doesn't exist, it will write an empty file.
func ensureEmptyFileExists(ctx Context, file string) {