summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-06-15 13:39:54 +0800
committerruki <[email protected]>2016-06-15 13:39:54 +0800
commit25950c4a2cf45ad17fe73d196ae6f309cde098d5 (patch)
treeece62f7a4a5cd595591b06a00cf99605f0477362
parent83311b186787d8af24fd818d864a047066193e8e (diff)
add plugindirs
-rw-r--r--xmake/core/project/project.lua20
1 files changed, 20 insertions, 0 deletions
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)