diff options
| author | ruki <[email protected]> | 2024-06-04 22:34:27 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-06-04 22:34:27 +0800 |
| commit | 1883b6b9f69dddac3c19806014d135ebd9d18e67 (patch) | |
| tree | bfe9ae37eef3c4599cc14518c560743a5255d408 | |
| parent | 0f43f1c1503410ad099420954e6f4a701e885f60 (diff) | |
deduplicate envs #5184
| -rw-r--r-- | xmake/modules/private/action/run/runenvs.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/xmake/modules/private/action/run/runenvs.lua b/xmake/modules/private/action/run/runenvs.lua index da22f6c72..aaa253e0d 100644 --- a/xmake/modules/private/action/run/runenvs.lua +++ b/xmake/modules/private/action/run/runenvs.lua @@ -112,6 +112,20 @@ function _add_target_pkgenvs(addenvs, target, targets_added) end end +-- deduplicate envs +-- @see https://github.com/xmake-io/xmake/issues/5184 +function _dedup_envs(envs) + local envs_new = {} + for k, v in pairs(envs) do + if type(v) == "table" then + envs_new[k] = table.unique(v) + else + envs_new[k] = v + end + end + return envs_new +end + function make(target) -- add run environments @@ -147,5 +161,13 @@ function make(target) table.join2(pathenv, runpath) end end + + -- deduplicate envs + if addenvs then + addenvs = _dedup_envs(addenvs) + end + if setenvs then + setenvs = _dedup_envs(setenvs) + end return addenvs, setenvs end |
