From 25950c4a2cf45ad17fe73d196ae6f309cde098d5 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 15 Jun 2016 13:39:54 +0800 Subject: add plugindirs --- xmake/core/project/project.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua index e30d751ef..35a8dcc9c 100644 --- a/xmake/core/project/project.lua +++ b/xmake/core/project/project.lua @@ -314,6 +314,20 @@ function project._api_add_pkgdirs(interp, ...) interp:api_builtin_add_subdirs(pkgdirs) end +-- load all plugins from the given directories +function project._api_add_plugindirs(interp, ...) + + -- get all directories + local plugindirs = {} + local dirs = table.join(...) + for _, dir in ipairs(dirs) do + table.insert(plugindirs, dir .. "/*") + end + + -- add all plugins + interp:api_builtin_add_subdirs(plugindirs) +end + -- get interpreter function project._interpreter() @@ -478,6 +492,12 @@ function project._interpreter() -- register api: add_pkgs() to root interp:api_register(nil, "add_pkgs", interpreter.api_builtin_add_subdirs) + -- register api: add_plugindirs() to root + interp:api_register(nil, "add_plugindirs", project._api_add_plugindirs) + + -- register api: add_plugins() to root + interp:api_register(nil, "add_plugins", interpreter.api_builtin_add_subdirs) + -- register api: deprecated deprecated_project.api_register(interp) -- cgit v1.3.1