summaryrefslogtreecommitdiff
path: root/xmake/core
diff options
context:
space:
mode:
authorruki <[email protected]>2022-02-17 22:41:01 +0800
committerruki <[email protected]>2022-02-17 22:41:01 +0800
commit54efc65b6ed2dfc86c28ba7cc3f40a6084785026 (patch)
treefebf2f4fcc2b80a5e8fb8c372f52742fad3dcd87 /xmake/core
parentfe5673d0291653137c3ecc53c2abba5c162a6779 (diff)
...
Diffstat (limited to 'xmake/core')
-rw-r--r--xmake/core/base/interpreter.lua8
-rw-r--r--xmake/core/base/scopeinfo.lua8
-rw-r--r--xmake/core/base/table.lua18
-rw-r--r--xmake/core/tool/builder.lua6
4 files changed, 36 insertions, 4 deletions
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua
index 6f5f0360b..506d8cdad 100644
--- a/xmake/core/base/interpreter.lua
+++ b/xmake/core/base/interpreter.lua
@@ -1060,7 +1060,9 @@ function interpreter:api_register_set_values(scope_kind, ...)
end
-- expand values
- values = table.join(table.unpack(values))
+ if not extra_config or extra_config.expand ~= false then
+ values = table.join(table.unpack(values))
+ end
-- save values
if #values > 0 then
@@ -1100,7 +1102,9 @@ function interpreter:api_register_add_values(scope_kind, ...)
end
-- expand values
- values = table.join(table.unpack(values))
+ if not extra_config or extra_config.expand ~= false then
+ values = table.join(table.unpack(values))
+ end
-- save values
scope[name] = table.join2(scope[name] or {}, values)
diff --git a/xmake/core/base/scopeinfo.lua b/xmake/core/base/scopeinfo.lua
index 26be325eb..8a69a9299 100644
--- a/xmake/core/base/scopeinfo.lua
+++ b/xmake/core/base/scopeinfo.lua
@@ -114,7 +114,9 @@ function _instance:_api_set_values(name, ...)
end
-- expand values
- values = table.join(table.unpack(values))
+ if not extra_config or extra_config.expand ~= false then
+ values = table.join(table.unpack(values))
+ end
-- handle values
local handled_values = self:_api_handle(name, values)
@@ -153,7 +155,9 @@ function _instance:_api_add_values(name, ...)
end
-- expand values
- values = table.join(table.unpack(values))
+ if not extra_config or extra_config.expand ~= false then
+ values = table.join(table.unpack(values))
+ end
-- save values
scope[name] = self:_api_handle(name, table.join2(table.wrap(scope[name]), values))
diff --git a/xmake/core/base/table.lua b/xmake/core/base/table.lua
index 2bf776151..9868c93d5 100644
--- a/xmake/core/base/table.lua
+++ b/xmake/core/base/table.lua
@@ -120,6 +120,24 @@ function table.join2(self, ...)
return self
end
+-- shallow join all objects, it will not expand all table values
+function table.shallow_join(...)
+ local result = {}
+ for _, t in ipairs({...}) do
+ table.insert(result, t)
+ end
+ return result
+end
+
+
+-- shallow join all objects, it will not expand all table values
+function table.shallow_join2(self, ...)
+ for _, t in ipairs({...}) do
+ table.insert(self, t)
+ end
+ return self
+end
+
-- swap items in array
function table.swap(array, i, j)
local val = array[i]
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua
index 343eec0ae..8685c34b7 100644
--- a/xmake/core/tool/builder.lua
+++ b/xmake/core/tool/builder.lua
@@ -136,12 +136,16 @@ function builder:_add_flags_from_flagkind(flags, target, flagkind, opt)
local flagconf = extraconf[flag]
if flagconf and flagconf.force then
table.join2(flags, flag)
+ print("111")
else
table.join2(flags, self:_mapflags(flag, flagkind, target))
+ print("222")
+ utils.dump(self:_mapflags(flag, flagkind, target))
end
end
else
table.join2(flags, self:_mapflags(targetflags, flagkind, target))
+ print("xxxx")
end
end
@@ -213,11 +217,13 @@ function builder:_add_flags_from_target(flags, target)
self:_inherit_flags_from_targetdeps(targetflags, target)
end
+ utils.dump(targetflags)
-- add the target flags
for _, flagkind in ipairs(self:_flagkinds()) do
self:_add_flags_from_flagkind(targetflags, target, flagkind)
end
cache[key] = targetflags
+ utils.dump(targetflags)
end
table.join2(flags, targetflags)
end