summaryrefslogtreecommitdiff
path: root/xmake/core/package/addon.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2026-08-08 22:16:02 +0800
committerruki <[email protected]>2026-08-09 18:28:59 +0800
commit4fc05750f6da0568df7a0fa836e114128d3ba849 (patch)
tree98f6f401a2c6629464dcd393ddb5879483b4555e /xmake/core/package/addon.lua
parent6a024e442cf6e3a1fe55ab63b3385be592bb1e1e (diff)
rewrite template dist
Diffstat (limited to 'xmake/core/package/addon.lua')
-rw-r--r--xmake/core/package/addon.lua21
1 files changed, 19 insertions, 2 deletions
diff --git a/xmake/core/package/addon.lua b/xmake/core/package/addon.lua
index e40a83a47..35966853d 100644
--- a/xmake/core/package/addon.lua
+++ b/xmake/core/package/addon.lua
@@ -97,12 +97,29 @@ end
--
function addon.payloads(kind)
local payloads = {}
+ for _, payloadinfo in ipairs(addon.payloadinfos(kind)) do
+ table.insert(payloads, payloadinfo.dir)
+ end
+ return payloads
+end
+
+-- get the payload information of the given kind from all installed addons
+--
+-- @param kind the payload kind, e.g. "plugins", "rules"
+-- @return the payload infos, e.g. {{name = "hello-world", version = "latest", dir = "~/.xmake/addons/hello-world/latest/plugins"}}
+--
+function addon.payloadinfos(kind)
+ local payloadinfos = {}
for name, addoninfo in pairs(addon.addons()) do
if table.contains(addoninfo.payloads or {}, kind) then
- table.insert(payloads, path.join(addon.installdir(), name, addoninfo.version, kind))
+ table.insert(payloadinfos, {
+ name = name,
+ version = addoninfo.version,
+ dir = path.join(addon.installdir(), name, addoninfo.version, kind)})
end
end
- return payloads
+ table.sort(payloadinfos, function (a, b) return a.name < b.name end)
+ return payloadinfos
end
-- get the payload directories of the given addon directory, e.g. {"plugins", "rules"}