From 566d33d6be83884239cce7df0655e60ec00bd836 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 16 Mar 2016 10:41:57 +0800 Subject: load project --- xmake/core/platform/tool.lua | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'xmake/core/platform/tool.lua') diff --git a/xmake/core/platform/tool.lua b/xmake/core/platform/tool.lua index 36047f410..479d7a38e 100644 --- a/xmake/core/platform/tool.lua +++ b/xmake/core/platform/tool.lua @@ -157,19 +157,24 @@ function tool.load(name, root) local script, errors = loadfile(toolpath) if script then - -- load tool - local tool = script() + -- load tool + local ok, result = pcall(script) + if not ok then + utils.error(result) + utils.error("load %s failed!", toolpath) + assert(false) + end -- init tool - if tool and tool.init then - tool:init(name) + if result and result.init then + result:init(name) end -- save tool to the cache - tool._TOOLS[name] = tool + tool._TOOLS[name] = result -- ok? - return tool + return result else utils.error(errors) utils.error("load %s failed!", toolpath) -- cgit v1.3.1