summaryrefslogtreecommitdiff
path: root/xmake/scripts/tools/tools.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2015-06-04 13:50:59 +0800
committerruki <[email protected]>2015-06-04 13:50:59 +0800
commit2f468e35a6c681a22308d1c6d1d37764c386c00c (patch)
treefe1da0da8db6d61120ec176577aec8df41081f78 /xmake/scripts/tools/tools.lua
parent9f1d3468c22adabab1ad06cdb0014c4f6ef2caa6 (diff)
add make to tools
Diffstat (limited to 'xmake/scripts/tools/tools.lua')
-rw-r--r--xmake/scripts/tools/tools.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/xmake/scripts/tools/tools.lua b/xmake/scripts/tools/tools.lua
index 089f425e9..09e43dc94 100644
--- a/xmake/scripts/tools/tools.lua
+++ b/xmake/scripts/tools/tools.lua
@@ -98,6 +98,9 @@ end
-- load tool from the given name and directory (optional)
function tools.load(name, root)
+ -- check
+ assert(name)
+
-- find the tool file path
local toolpath = tools.find(name, root)
@@ -106,6 +109,21 @@ function tools.load(name, root)
return
end
+ -- load script
+ local script = loadfile(toolpath)
+ if script then
+
+ -- load tool
+ local tool = script()
+
+ -- init tool
+ if tool and tool.init then
+ tool.init()
+ end
+
+ -- ok?
+ return tool
+ end
end
-- return module: tools