diff options
| author | ruki <[email protected]> | 2022-09-06 00:31:10 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-09-06 00:31:10 +0800 |
| commit | 80ad4a0ad0f0265654e1cf98c059f8d86ac28dc0 (patch) | |
| tree | 1e7c21d90886e842f08075a4d0b731dbc0b2ec81 /xmake/modules/private/action/require/impl/package.lua | |
| parent | 2eabe3a9efd3ca4eaa4cbac769fbca6a6192af81 (diff) | |
check linkdeps compatibility
Diffstat (limited to 'xmake/modules/private/action/require/impl/package.lua')
| -rw-r--r-- | xmake/modules/private/action/require/impl/package.lua | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua index 3a9f4c991..21164e4bf 100644 --- a/xmake/modules/private/action/require/impl/package.lua +++ b/xmake/modules/private/action/require/impl/package.lua @@ -946,6 +946,41 @@ function _must_depend_on(package, dep) end end +-- compatible with all previous link dependencies? +function _compatible_with_previous_linkdeps(package) + + -- check strict compatibility for linkdeps? + local strict_compatibility = project.policy("package.linkdeps.strict_compatibility") + if strict_compatibility == nil then + strict_compatibility = package:policy("package.linkdeps.strict_compatibility") + end + if not strict_compatibility then + return true + end + + -- compute the buildhash for previous linkdeps + local buildhashes_prev = {} + local manifest = package:manifest_load() + if manifest and manifest.linkdeps then + local deps = manifest.deps or {} + for _, depname in ipairs(manifest.linkdeps) do + local depinfo = deps[depname] + if depinfo and depinfo.buildhash then + table.insert(buildhashes_prev, depinfo.buildhash) + end + end + end + + -- compute the buildhash for current linkdeps + local buildhashes_curr = {} + for _, dep in ipairs(package:linkdeps()) do + table.insert(buildhashes_curr, dep:buildhash()) + end + + -- is compatible? + return table.concat(buildhashes_curr, "") == table.concat(buildhashes_prev) +end + -- the cache directory function cachedir() return path.join(global.directory(), "cache", "packages") @@ -953,7 +988,10 @@ end -- this package should be install? function should_install(package) - if package:is_template() or package:exists() then + if package:is_template() then + return false + end + if package:exists() and _compatible_with_previous_linkdeps(package) then return false end -- we need not install it if this package need only be fetched |
