Merge "Make $PATH available when building soong_build." am: 5ce36b4a96 am: 0029271ec2

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1625391

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If60f3de615d289a18ad6051fb50e60719643cd33
This commit is contained in:
Lukács T. Berki 2021-03-10 11:01:04 +00:00 committed by Automerger Merge Worker
commit d59e8aaceb
1 changed files with 13 additions and 0 deletions

View File

@ -171,8 +171,21 @@ func runSoong(ctx Context, config Config) {
"-f", filepath.Join(config.SoongOutDir(), file))
var ninjaEnv Environment
// This is currently how the command line to invoke soong_build finds the
// root of the source tree and the output root
ninjaEnv.Set("TOP", os.Getenv("TOP"))
ninjaEnv.Set("SOONG_OUTDIR", config.SoongOutDir())
// Needed for NonHermeticHostSystemTool() and that, only in tests. We should
// probably find a better way of running tests other than making $PATH
// available also to production builds. Note that this is not get same as
// os.Getenv("PATH"): config.Environment() contains the $PATH that redirects
// every binary through the path interposer.
configPath, _ := config.Environment().Get("PATH")
ninjaEnv.Set("PATH", configPath)
// For debugging
if os.Getenv("SOONG_DELVE") != "" {
// SOONG_DELVE is already in cmd.Environment
ninjaEnv.Set("SOONG_DELVE_PATH", shared.ResolveDelveBinary())