Limit environment during ninja

See the change that added ALLOW_NINJA_ENV for more information.

Test: m nothing; check out/soong.log for small list
Test: ALLOW_NINJA_ENV=true m nothing; check out/soong.log
Change-Id: I7761c6a07a7f8b0acee107e9c27c7739dd4b63ab
This commit is contained in:
Dan Willemsen 2020-01-02 20:12:09 -08:00
parent e333635983
commit 260db53da3
1 changed files with 3 additions and 1 deletions

View File

@ -93,7 +93,9 @@ func runNinja(ctx Context, config Config) {
//
// For the majority of cases, either Soong or the makefiles should be replicating any
// necessary environment variables in the command line of each action that needs it.
if cmd.Environment.IsFalse("ALLOW_NINJA_ENV") {
if cmd.Environment.IsEnvTrue("ALLOW_NINJA_ENV") {
ctx.Println("Allowing all environment variables during ninja; incremental builds may be unsafe.")
} else {
cmd.Environment.Allow(append([]string{
"ASAN_SYMBOLIZER_PATH",
"HOME",