diff options
| author | ruki <[email protected]> | 2026-08-11 00:46:53 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-08-11 00:46:53 +0800 |
| commit | d699ee8188196a7e77bc1e2912f9b5dc6bd47416 (patch) | |
| tree | 6a56f694b067bca75f32da15ac853e17e226d563 /xmake/actions/addon | |
| parent | 06a00d75a9574bba124877432553e5cc61f0ba99 (diff) | |
add addon.lua
Diffstat (limited to 'xmake/actions/addon')
| -rw-r--r-- | xmake/actions/addon/main.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/xmake/actions/addon/main.lua b/xmake/actions/addon/main.lua index b99df4fe0..e3ed7e5be 100644 --- a/xmake/actions/addon/main.lua +++ b/xmake/actions/addon/main.lua @@ -88,12 +88,34 @@ function _install_from_local(dir, name) local payloadroot = addon.payloadroot(dir) assert(payloadroot, "addon path(%s): no payload directory found, e.g. ${bright}plugins${clear}!", dir) + -- the addon describes itself? its manifest is always authoritative, + -- otherwise we can only guess its name from the directory name + local manifest = addon.manifest(dir) + if manifest then + name = manifest.name + end name = name or path.filename(dir) + local dstdir = _get_addondir(name, LOCALVERSION) assert(not os.isdir(dstdir), "addon(%s) already exists!", name) + + -- the addons which it depends on are not installed by the local installation, + -- so we need to install them from the repositories first + if manifest then + for _, dep in ipairs(manifest.deps) do + if not addon.addons()[addon.dirname(dep)] then + _install_from_repo(dep) + end + end + end + for _, payloaddir in ipairs(addon.payloads_of(payloadroot)) do os.vcp(path.join(payloadroot, payloaddir), path.join(dstdir, payloaddir)) end + local manifestfile = path.join(dir, "addon.lua") + if os.isfile(manifestfile) then + os.vcp(manifestfile, path.join(dstdir, "addon.lua")) + end -- we need to roll back the installed payloads if it cannot be registered, e.g. the name conflicts try { |
