diff options
| author | ruki <[email protected]> | 2016-03-16 10:41:57 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-03-16 10:41:57 +0800 |
| commit | 566d33d6be83884239cce7df0655e60ec00bd836 (patch) | |
| tree | 79409e657888768fe28fa2ad3af0a52cb7d355ee /xmake/core/platform/tool.lua | |
| parent | 5862427be483f6747d88d3a79121e2a4f2a27670 (diff) | |
load project
Diffstat (limited to 'xmake/core/platform/tool.lua')
| -rw-r--r-- | xmake/core/platform/tool.lua | 17 |
1 files changed, 11 insertions, 6 deletions
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) |
