diff options
| author | ruki <[email protected]> | 2026-08-08 16:32:53 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-08-09 18:25:42 +0800 |
| commit | 73a790f3c4810755921350c61cf84d6504a30297 (patch) | |
| tree | 3cf0048aa3545b0667e848273268d2705660a492 /xmake/core/base/task.lua | |
| parent | ced7f2ae519bc9eca92bcf4f177fe177ddd0e747 (diff) | |
add addon support for plugins
Diffstat (limited to 'xmake/core/base/task.lua')
| -rw-r--r-- | xmake/core/base/task.lua | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/xmake/core/base/task.lua b/xmake/core/base/task.lua index d6f581cf9..2488665f5 100644 --- a/xmake/core/base/task.lua +++ b/xmake/core/base/task.lua @@ -81,13 +81,26 @@ end -- the directories of tasks function task._directories() - local dirs = { - path.join(global.directory(), "plugins"), - path.join(os.programdir(), "plugins"), - path.join(os.programdir(), "actions")} - local plugindirs = os.getenv("XMAKE_PLUGIN_DIRS") - if plugindirs then - table.insert(dirs, 1, plugindirs) + local dirs = task._DIRECTORIES + if dirs == nil then + dirs = { + path.join(global.directory(), "plugins"), + path.join(os.programdir(), "plugins"), + path.join(os.programdir(), "actions")} + + -- add the plugins of the installed addons, e.g. ~/.xmake/addons/<name>/<version>/plugins + local addonsdir = path.join(global.directory(), "addons") + if os.isdir(addonsdir) then + for _, plugindir in ipairs(os.dirs(path.join(addonsdir, "*", "*", "plugins"))) do + table.insert(dirs, plugindir) + end + end + + local plugindirs = os.getenv("XMAKE_PLUGIN_DIRS") + if plugindirs then + table.insert(dirs, 1, plugindirs) + end + task._DIRECTORIES = dirs end return dirs end |
