diff options
| author | ruki <[email protected]> | 2022-09-06 00:35:04 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-09-06 00:35:04 +0800 |
| commit | d84e652a4c03267357235ce258fdd6c5f6815f96 (patch) | |
| tree | ba724bf92ed9425c930b5b6c9d9a647cdb4ee72d | |
| parent | 80ad4a0ad0f0265654e1cf98c059f8d86ac28dc0 (diff) | |
add compatible_tips
| -rw-r--r-- | xmake/modules/private/action/require/impl/package.lua | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua index 21164e4bf..746f56ba1 100644 --- a/xmake/modules/private/action/require/impl/package.lua +++ b/xmake/modules/private/action/require/impl/package.lua @@ -959,26 +959,53 @@ function _compatible_with_previous_linkdeps(package) end -- compute the buildhash for previous linkdeps - local buildhashes_prev = {} + local depinfos_prev = {} + local depnames = hashset.new() 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) + depinfos_prev[depname] = depinfo + depnames:insert(depname) end end end -- compute the buildhash for current linkdeps - local buildhashes_curr = {} + local depinfos_curr = {} for _, dep in ipairs(package:linkdeps()) do - table.insert(buildhashes_curr, dep:buildhash()) + depinfos_curr[dep:name()] = { + version = dep:version_str(), + buildhash = dep:buildhash() + } + depnames:insert(dep:name()) end -- is compatible? - return table.concat(buildhashes_curr, "") == table.concat(buildhashes_prev) + local is_compatible = true + local compatible_tips = {} + for _, depname in depnames:keys() do + local depinfo_prev = depinfos_prev[depname] + local depinfo_curr = depinfos_curr[depname] + if depinfo_prev and depinfo_curr then + if depinfo_prev.buildhash ~= depinfo_curr.buildhash then + is_compatible = false + table.insert(compatible_tips, ("*%s"):format(depname)) + end + elseif depinfo_prev then + is_compatible = false + table.insert(compatible_tips, ("-%s"):format(depname)) + elseif depinfo_curr then + is_compatible = false + table.insert(compatible_tips, ("+%s"):format(depname)) + end + end + if not is_compatible and #compatible_tips > 0 then + package:data_set("linkdeps.compatible_tips", compatible_tips) + end + return is_compatible end -- the cache directory @@ -1060,6 +1087,10 @@ function get_configs_str(package) end end end + local compatible_tips = package:data("linkdeps.compatible_tips") + if compatible_tips then + table.insert(configs, "deps:" .. table.concat(compatible_tips, ",")) + end local parents_str = _get_parents_str(package) if parents_str then table.insert(configs, "from:" .. parents_str) |
