aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorLukacs T. Berki <lberki@google.com>2021-03-10 10:48:39 +0100
committerLukacs T. Berki <lberki@google.com>2021-03-10 11:02:39 +0100
commit73ab928daa3976620b575d9e90ee8497e8ae70ea (patch)
tree28e13c7b3fd99c7db4cdc1f8d8c2ec52737aa1fc /ui
parent533274a2d359ac9e09aea9f56ae21479c4b6f299 (diff)
downloadsoong-73ab928daa3976620b575d9e90ee8497e8ae70ea.tar.gz
Make $PATH available when building soong_build.
This is exclusively used by tests so it's awful, but Darwin builds are currently broken so let's unbreak them first then start thinking. Test: "m nothing" on Linux (I don't have access to a mac OS machine) Change-Id: I1ea9ca71a5aff36a3454282a4c87ad368138baaa
Diffstat (limited to 'ui')
-rw-r--r--ui/build/soong.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/ui/build/soong.go b/ui/build/soong.go
index 37f7b9780..5f4a203f7 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -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())