summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-01-27 23:47:12 +0800
committerruki <[email protected]>2024-01-27 23:47:12 +0800
commitcf61b2b9e164b6655cc4ea9b983dddffaf297372 (patch)
treeabc4ca6cf6b77ea58a3838b5b797e6ce62b90f6a
parent97ebae3c85e8bb7cfef13b02415e4a5798b13234 (diff)
fix runtime configs #4477
-rw-r--r--xmake/core/package/package.lua6
-rw-r--r--xmake/modules/private/action/require/impl/package.lua12
2 files changed, 14 insertions, 4 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 5f9524019..ff96e0822 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -1454,8 +1454,9 @@ function _instance:configs()
configs = {}
local requireinfo = self:requireinfo()
local configs_required = requireinfo and requireinfo.configs or {}
+ local configs_overrided = requireinfo and requireinfo.configs_overrided or {}
for _, name in ipairs(table.wrap(configs_defined)) do
- local value = configs_required[name]
+ local value = configs_overrided[name] or configs_required[name]
if value == nil then
value = self:extraconf("configs", name, "default")
-- support for the deprecated vs_runtime in add_configs
@@ -1493,10 +1494,11 @@ function _instance:_configs_for_buildhash()
configs = {}
local requireinfo = self:requireinfo()
local configs_required = requireinfo and requireinfo.configs or {}
+ local configs_overrided = requireinfo and requireinfo.configs_overrided or {}
local ignored_configs_for_buildhash = hashset.from(requireinfo and requireinfo.ignored_configs_for_buildhash or {})
for _, name in ipairs(table.wrap(configs_defined)) do
if not ignored_configs_for_buildhash:has(name) then
- local value = configs_required[name]
+ local value = configs_overrided[name] or configs_required[name]
if value == nil then
value = self:extraconf("configs", name, "default")
-- support for the deprecated vs_runtime in add_configs
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua
index 5d352ee01..4ab054ba6 100644
--- a/xmake/modules/private/action/require/impl/package.lua
+++ b/xmake/modules/private/action/require/impl/package.lua
@@ -828,9 +828,15 @@ function _select_package_runtimes(package)
end
end
-- we need update runtimes for buildhash, configs ...
+ --
+ -- we use configs_overrided to override configs in configs and buildhash,
+ -- but we shouldn't modify requireinfo.configs directly as it affects the package cache key
+ --
+ -- @see https://github.com/xmake-io/xmake/issues/4477#issuecomment-1913185727
local requireinfo = package:requireinfo()
- if requireinfo and requireinfo.configs then
- requireinfo.configs.runtimes = #runtimes_current > 0 and table.concat(runtimes_current, ",") or nil
+ if requireinfo then
+ requireinfo.configs_overrided = requireinfo.configs_overrided or {}
+ requireinfo.configs_overrided.runtimes = #runtimes_current > 0 and table.concat(runtimes_current, ",") or nil
end
end
end
@@ -1266,8 +1272,10 @@ function get_configs_str(package)
table.insert(configs, requireinfo.kind)
end
local ignored_configs_for_buildhash = hashset.from(requireinfo.ignored_configs_for_buildhash or {})
+ local configs_overrided = requireinfo.configs_overrided or {}
for k, v in pairs(requireinfo.configs) do
if not ignored_configs_for_buildhash:has(k) then
+ v = configs_overrided[k] or v
if type(v) == "boolean" then
table.insert(configs, k .. ":" .. (v and "y" or "n"))
else