diff options
| author | ruki <[email protected]> | 2015-06-04 14:08:40 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-04 14:08:40 +0800 |
| commit | 1481ec887abef9ce33f4cff93f7a0e6ab04b5741 (patch) | |
| tree | 609560fefb90242fb8deabd525201e00cd078b12 /xmake/scripts/tools/tools.lua | |
| parent | 2f468e35a6c681a22308d1c6d1d37764c386c00c (diff) | |
modify some tool interfaces
Diffstat (limited to 'xmake/scripts/tools/tools.lua')
| -rw-r--r-- | xmake/scripts/tools/tools.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/xmake/scripts/tools/tools.lua b/xmake/scripts/tools/tools.lua index 09e43dc94..4c0d0da14 100644 --- a/xmake/scripts/tools/tools.lua +++ b/xmake/scripts/tools/tools.lua @@ -101,6 +101,12 @@ function tools.load(name, root) -- check assert(name) + -- get it directly from cache dirst + tools._TOOLS = tools._TOOLS or {} + if tools._TOOLS[name] then + return tools._TOOLS[name] + end + -- find the tool file path local toolpath = tools.find(name, root) @@ -121,10 +127,18 @@ function tools.load(name, root) tool.init() end + -- save tool to the cache + tools._TOOLS[name] = tool + -- ok? return tool end end +-- get the given tool from the current platform +function tools.get(name) + return tools.load(platform.tool(name)) +end + -- return module: tools return tools |
