diff options
| author | ruki <[email protected]> | 2026-08-15 19:26:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-08-15 19:26:52 +0800 |
| commit | 65854acd5e7080dae4cac3e3b3ec1ce01e902ae7 (patch) | |
| tree | 5f32e58a6fffc615927833e2e15b077a35ae1e5f /xmake/modules/private/action/addon/impl/install_addons.lua | |
| parent | 4c7c17c10f8a4270b27d90958544ce2886dc6052 (diff) | |
fix upgrade addon
Diffstat (limited to 'xmake/modules/private/action/addon/impl/install_addons.lua')
| -rw-r--r-- | xmake/modules/private/action/addon/impl/install_addons.lua | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/xmake/modules/private/action/addon/impl/install_addons.lua b/xmake/modules/private/action/addon/impl/install_addons.lua index a20ed740b..0a288f1a3 100644 --- a/xmake/modules/private/action/addon/impl/install_addons.lua +++ b/xmake/modules/private/action/addon/impl/install_addons.lua @@ -49,20 +49,21 @@ end function _lock_addons(projectdir, addonsinfo) local lockinfo = {} local locked = addons.locked(projectdir) or {} - -- @note we need to reload the registry, they have been installed by another process - local installed = addon.addons({force = true}) + + -- @note we need to reload the registry, they have been installed by another process, + -- and we must not see them through the locked versions, we are locking them right now, + -- e.g. `xmake addon --upgrade` pins the old ones before loading this project + local installed = addon.addons({force = true, unpinned = true}) for _, requirestr in ipairs(addonsinfo.addons) do local name = addons.requirename(requirestr) - local addoninfo = installed[addon.dirname(name)] - if addoninfo then - local oldversion = locked[name] and locked[name].version - if oldversion and oldversion ~= addoninfo.version then - cprint("${color.success}upgrade ${bright}%s${clear}: %s -> %s", name, oldversion, addoninfo.version) - end - -- we lock the repository too, so that the other users get it from the same source, - -- @see xmake/modules/private/action/require/impl/lock_packages.lua - lockinfo[name] = {version = addoninfo.version, repo = addoninfo.repo} + local addoninfo = assert(installed[addon.dirname(name)], "addon(%s) is not installed!", name) + local oldversion = locked[name] and locked[name].version + if oldversion and oldversion ~= addoninfo.version then + cprint("${color.success}upgrade ${bright}%s${clear}: %s -> %s", name, oldversion, addoninfo.version) end + -- we lock the repository too, so that the other users get it from the same source, + -- @see xmake/modules/private/action/require/impl/lock_packages.lua + lockinfo[name] = {version = addoninfo.version, repo = addoninfo.repo} end lockinfo.__meta__ = {version = addons.lockfile_version()} |
