summaryrefslogtreecommitdiff
path: root/xmake/actions/run/main.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2019-03-17 22:46:36 +0800
committerruki <[email protected]>2019-03-17 22:46:36 +0800
commitecdb953daa77c74a7475c7486d8df6d96d0d0c4d (patch)
tree5720d5b5de715400591fc18a9417a9da2a189e28 /xmake/actions/run/main.lua
parente35215c72fa78df798a88ca1cd9bed9bb36013d5 (diff)
bind package envs to run
Diffstat (limited to 'xmake/actions/run/main.lua')
-rw-r--r--xmake/actions/run/main.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/xmake/actions/run/main.lua b/xmake/actions/run/main.lua
index 21783a125..156170871 100644
--- a/xmake/actions/run/main.lua
+++ b/xmake/actions/run/main.lua
@@ -103,6 +103,13 @@ end
-- run the given target
function _run(target)
+ -- enter the environments of the target packages
+ local oldenvs = {}
+ for name, values in pairs(target:pkgenvs()) do
+ oldenvs[name] = os.getenv(name)
+ os.addenv(name, unpack(values))
+ end
+
-- the target scripts
local scripts =
{
@@ -148,6 +155,11 @@ function _run(target)
script(target, {origin = (i == 3 and _do_run_target or nil)})
end
end
+
+ -- leave the environments of the target packages
+ for name, values in pairs(oldenvs) do
+ os.setenv(name, values)
+ end
end
-- run the all dependent targets