summaryrefslogtreecommitdiff
path: root/xmake/scripts/tools
diff options
context:
space:
mode:
authorruki <[email protected]>2015-12-05 22:28:02 +0800
committerruki <[email protected]>2015-12-05 22:28:02 +0800
commit82fc443c84a02c7cf19248c5f9a70ef9f3a2032f (patch)
tree07189e5fefd41e23475c831d539d45e8b0e3af9c /xmake/scripts/tools
parentf77eb028a770969a3e87af41e41fe1e66b3b7842 (diff)
impl add_files *.lib for windows
Diffstat (limited to 'xmake/scripts/tools')
-rw-r--r--xmake/scripts/tools/dispatcher.lua34
1 files changed, 12 insertions, 22 deletions
diff --git a/xmake/scripts/tools/dispatcher.lua b/xmake/scripts/tools/dispatcher.lua
index 768c03017..d019937ec 100644
--- a/xmake/scripts/tools/dispatcher.lua
+++ b/xmake/scripts/tools/dispatcher.lua
@@ -28,6 +28,7 @@ local os = require("base/os")
local path = require("base/path")
local utils = require("base/utils")
local string = require("base/string")
+local tools = require("tools/tools")
-- the main function
--
@@ -36,49 +37,38 @@ function dispatcher.main(self, ...)
-- check
local args = ...
- assert(#args >= 3)
+ assert(#args >= 2)
- -- get toolpath
- local toolname = args[1]:decode()
- local toolpath = args[2]:decode()
- local action_name = args[3]
- assert(toolname and toolpath and action_name)
+ -- get tool kind and action name
+ local tool_kind = args[1]
+ local action_name = args[2]
+ assert(tool_kind and action_name)
- -- load script
- local script, errors = loadfile(toolpath)
- if script then
+ -- get the tool
+ local tool = tools.get(tool_kind)
+ if tool then
- -- load tool
- local tool = script()
-
- -- init tool
- if tool and tool.init then
- tool:init(toolname)
- end
-
-- load action
local action = tool[action_name]
if action then
-- init arguments for action
local action_args = {}
- for i = 4, #args do
+ for i = 3, #args do
table.insert(action_args, args[i]:decode())
end
-- done action
if not action(tool, action_args) then
- utils.error("run action %s for '%s' failed!", action_name, toolname)
+ utils.error("run action %s failed!", action_name)
assert(false)
end
else
- utils.error("load action %s for '%s' failed!", action_name, toolname)
+ utils.error("load action %s failed!", action_name)
assert(false)
end
else
- utils.error(errors)
- utils.error("load %s failed!", toolpath)
assert(false)
end