summaryrefslogtreecommitdiff
path: root/xmake/modules/private/action/require/impl/package.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-09-08 00:51:05 +0800
committerruki <[email protected]>2022-09-08 00:51:05 +0800
commit72384b987dc3565a1f37f7e5728db7dd5846394d (patch)
tree330a2f2926e91903f817edf065017adcc619a09b /xmake/modules/private/action/require/impl/package.lua
parent96d2662955aae226e3ff5705ed5f7e2ac98da6d9 (diff)
add package.strict_compatibility
Diffstat (limited to 'xmake/modules/private/action/require/impl/package.lua')
-rw-r--r--xmake/modules/private/action/require/impl/package.lua46
1 files changed, 26 insertions, 20 deletions
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua
index 26f608e3d..e7be7e21b 100644
--- a/xmake/modules/private/action/require/impl/package.lua
+++ b/xmake/modules/private/action/require/impl/package.lua
@@ -956,44 +956,50 @@ function _compatible_with_previous_librarydeps(package, opt)
return true
end
+ -- has been checked?
+ local compatible_checked = package:data("librarydeps.compatible_checked")
+ if compatible_checked then
+ return
+ end
+
-- check strict compatibility for librarydeps?
local strict_compatibility = project.policy("package.librarydeps.strict_compatibility")
if strict_compatibility == nil then
strict_compatibility = package:policy("package.librarydeps.strict_compatibility")
end
- if not strict_compatibility then
- return true
- end
- -- has been checked?
- local compatible_checked = package:data("librarydeps.compatible_checked")
- if compatible_checked then
- return
+ -- compute the buildhash for current librarydeps
+ local depnames = hashset.new()
+ local depinfos_curr = {}
+ for _, dep in ipairs(package:librarydeps()) do
+ if strict_compatibility or dep:policy("package.strict_compatibility") then
+ depinfos_curr[dep:name()] = {
+ version = dep:version_str(),
+ buildhash = dep:buildhash()
+ }
+ depnames:insert(dep:name())
+ end
end
-- compute the buildhash for previous librarydeps
local depinfos_prev = {}
- local depnames = hashset.new()
local manifest = package:manifest_load()
if manifest and manifest.librarydeps then
local deps = manifest.deps or {}
for _, depname in ipairs(manifest.librarydeps) do
- local depinfo = deps[depname]
- if depinfo and depinfo.buildhash then
- depinfos_prev[depname] = depinfo
- depnames:insert(depname)
+ if strict_compatibility or (package:dep(depname) and package:dep(depname):policy("package.strict_compatibility")) then
+ local depinfo = deps[depname]
+ if depinfo and depinfo.buildhash then
+ depinfos_prev[depname] = depinfo
+ depnames:insert(depname)
+ end
end
end
end
- -- compute the buildhash for current librarydeps
- local depinfos_curr = {}
- for _, dep in ipairs(package:librarydeps()) do
- depinfos_curr[dep:name()] = {
- version = dep:version_str(),
- buildhash = dep:buildhash()
- }
- depnames:insert(dep:name())
+ -- no any dependencies
+ if depnames:empty() then
+ return true
end
-- is compatible?