summaryrefslogtreecommitdiff
path: root/xmake/core/tool/builder.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-02-09 22:35:25 +0800
committerruki <[email protected]>2021-02-09 22:35:25 +0800
commit630b8dabbf701ef9b490add3e6def10a74970d00 (patch)
tree68c912ecf3cb234db3b8e6dc839895ce911a797f /xmake/core/tool/builder.lua
parent22bc93e3eac36f077583faa90f515d436e4945df (diff)
improve core/tools and remove os.args
Diffstat (limited to 'xmake/core/tool/builder.lua')
-rw-r--r--xmake/core/tool/builder.lua27
1 files changed, 17 insertions, 10 deletions
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua
index 7175cb7b6..37c55e8cf 100644
--- a/xmake/core/tool/builder.lua
+++ b/xmake/core/tool/builder.lua
@@ -345,14 +345,14 @@ function builder:_add_flags_from_language(flags, target, getters)
local results = mapper(self:_tool(), table.wrap(getter(flagname)), target, self:_targetkind())
for _, flag in ipairs(table.wrap(results)) do
if flag and flag ~= "" and (not checkstate or self:has_flags(flag)) then
- table.join2(flags, flag)
+ table.insert(flags, flag)
end
end
else
for _, flagvalue in ipairs(table.wrap(getter(flagname))) do
local flag = mapper(self:_tool(), flagvalue, target, self:_targetkind())
if flag and flag ~= "" and (not checkstate or self:has_flags(flag)) then
- table.join2(flags, flag)
+ table.insert(flags, flag)
end
end
end
@@ -368,17 +368,24 @@ function builder:_preprocess_flags(flags)
local unique = {}
local results = {}
for _, flag in ipairs(flags) do
- flag = flag:trim()
- if #flag > 0 and not unique[flag] then
- if flag:find(" ", 1, true) then
- table.join2(results, os.argv(flag, {splitonly = true}))
- else
- table.insert(results, flag)
+ if type(flag) == "string" then
+ flag = flag:trim()
+ if #flag > 0 and not unique[flag] then
+ if flag:find(" ", 1, true) then
+ table.join2(results, os.argv(flag, {splitonly = true}))
+ else
+ table.insert(results, flag)
+ end
+ unique[flag] = true
+ end
+ else
+ -- may be a table group? e.g. {"-I", "/xxx"}
+ if #flag > 0 and not unique[flag] then
+ table.join2(results, flag)
+ unique[flag] = true
end
- unique[flag] = true
end
end
--- utils.dump(results)
return results
end