summaryrefslogtreecommitdiff
path: root/xmake/core/project/package.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-11-22 23:07:42 +0800
committerruki <[email protected]>2024-11-22 23:07:42 +0800
commit6be0e0d88c4bcf3f045a3a499dce8bbd66eb6197 (patch)
tree2ce4e450fdb16bfb0d898363037df1ff4fed92d8 /xmake/core/project/package.lua
parent9b75cbbca9898bf38651bef1feb8caaaf56aaf7d (diff)
fix package linkgroups #5806
Diffstat (limited to 'xmake/core/project/package.lua')
-rw-r--r--xmake/core/project/package.lua31
1 files changed, 29 insertions, 2 deletions
diff --git a/xmake/core/project/package.lua b/xmake/core/project/package.lua
index c253ee0a2..70f89a1f8 100644
--- a/xmake/core/project/package.lua
+++ b/xmake/core/project/package.lua
@@ -216,6 +216,24 @@ function _instance:extraconf(name, item, key)
return value
end
+-- add extra configuration
+function _instance:extraconf_add(name, item)
+ local extraconfs = self:get("extras")
+ if not extraconfs then
+ extraconfs = {}
+ end
+
+ local extraconf = extraconfs[name]
+ if extraconf ~= nil then
+ extraconf = table.wrap(extraconf)
+ table.join2(extraconf, item)
+ else
+ extraconf = item
+ end
+ extraconfs[name] = extraconf
+ self:set("extras", extraconfs)
+end
+
-- get order dependencies of the given component
function _instance:component_orderdeps(name)
local component_orderdeps = self._COMPONENT_ORDERDEPS
@@ -252,8 +270,17 @@ end
-- add the value to the requires info
function _instance:add(name_or_info, ...)
if type(name_or_info) == "string" then
- local info = table.wrap(self._INFO[name_or_info])
- self._INFO[name_or_info] = table.unwrap(table.unique(table.join(info, ...)))
+ local name = name_or_info
+ if name == "extras" then
+ for _, extraconf in ipairs({...}) do
+ for k, v in pairs(extraconf) do
+ self:extraconf_add(k, v)
+ end
+ end
+ else
+ local info = table.wrap(self._INFO[name])
+ self._INFO[name] = table.unwrap(table.unique(table.join(info, ...)))
+ end
elseif table.is_dictionary(name_or_info) then
for name, info in pairs(table.join(name_or_info, ...)) do
self:add(name, info)