From fe6b792385a0b56716d703be3fd024380e1baea0 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 15 Aug 2026 00:36:28 +0800 Subject: improve lockfile version --- xmake/core/project/addons.lua | 8 ++++++++ xmake/modules/private/action/addon/impl/install_addons.lua | 5 +---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/xmake/core/project/addons.lua b/xmake/core/project/addons.lua index 64fde05c0..3b105840e 100644 --- a/xmake/core/project/addons.lua +++ b/xmake/core/project/addons.lua @@ -56,6 +56,14 @@ function addons.lockfile(projectdir) return path.join(projectdir or os.projectdir(), "xmake-addons.lock") end +-- get the format version of the addons lock file +-- +-- @see xmake/core/project/project.lua, project.requireslock_version() +-- +function addons.lockfile_version() + return "1.0" +end + -- get the apis of the addons file -- -- @note it only declares which addons this project needs, the addon resources diff --git a/xmake/modules/private/action/addon/impl/install_addons.lua b/xmake/modules/private/action/addon/impl/install_addons.lua index 02bb87e2f..a20ed740b 100644 --- a/xmake/modules/private/action/addon/impl/install_addons.lua +++ b/xmake/modules/private/action/addon/impl/install_addons.lua @@ -23,9 +23,6 @@ import("core.package.addon") import("core.project.addons") import("private.action.addon.impl.xrepo", {alias = "xrepo_addon"}) --- the format version of the addons lock file -local LOCKVERSION = "1.0" - -- get the requires of the declared addons -- -- @note we install the locked versions, but the declaration is authoritative, so we @@ -67,7 +64,7 @@ function _lock_addons(projectdir, addonsinfo) lockinfo[name] = {version = addoninfo.version, repo = addoninfo.repo} end end - lockinfo.__meta__ = {version = LOCKVERSION} + lockinfo.__meta__ = {version = addons.lockfile_version()} -- @note we need to write it deterministically, the key order of a lua table is random, -- otherwise the lock file would change even if nothing changed, -- cgit v1.3.1