summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2026-08-15 00:36:28 +0800
committerruki <[email protected]>2026-08-15 00:36:28 +0800
commitfe6b792385a0b56716d703be3fd024380e1baea0 (patch)
tree12e7e3063c9e33d0aa0e5ebf47d57e093cdf5dd9
parent05bba8214e630028cba5d5ad9497e0ac7266ab25 (diff)
improve lockfile version
-rw-r--r--xmake/core/project/addons.lua8
-rw-r--r--xmake/modules/private/action/addon/impl/install_addons.lua5
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,