diff options
| author | ruki <[email protected]> | 2026-08-09 17:57:20 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-08-09 18:28:59 +0800 |
| commit | 7caece0cb3ee8ab207130edc17421d604610e686 (patch) | |
| tree | 0c29dff7e79f0b455f707b9dec7de6ea1cabe2f8 /xmake/core/base/task.lua | |
| parent | cf62f410738a7489fe052d183bcf616ecf5f7067 (diff) | |
improve addon to import includes, rules and toolchains
Diffstat (limited to 'xmake/core/base/task.lua')
| -rw-r--r-- | xmake/core/base/task.lua | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/xmake/core/base/task.lua b/xmake/core/base/task.lua index e8d2441b9..eeb2dd8f2 100644 --- a/xmake/core/base/task.lua +++ b/xmake/core/base/task.lua @@ -415,6 +415,8 @@ function task.tasks() -- load tasks local tasks = {} + local taskfiles = {} + local addondir = path.absolute(addon.installdir()) local dirs = task._directories() for _, dir in ipairs(dirs) do local files = os.files(path.join(dir, "*", "xmake.lua")) @@ -422,7 +424,19 @@ function task.tasks() for _, filepath in ipairs(files) do local results, errors = task._load(filepath) if results then - table.join2(tasks, results) + for taskname, taskinfo in pairs(results) do + -- the plugins are not namespaced, so we need to report the conflicts of the addons, + -- otherwise we do not know which plugin will be run + local taskfile = taskfiles[taskname] + if taskfile and (path.absolute(taskfile):startswith(addondir) or path.absolute(filepath):startswith(addondir)) then + -- @note we cannot raise errors here, otherwise all the commands will be broken, + -- and the user cannot even remove the conflicting addons + utils.warning("plugin(%s) conflicts, we will use the first one!\n -> %s\n -> %s", taskname, taskfile, filepath) + else + taskfiles[taskname] = filepath + tasks[taskname] = taskinfo + end + end else os.raise(errors) end |
