summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/core/cache/localcache.lua2
-rw-r--r--xmake/core/cache/memcache.lua2
-rw-r--r--xmake/core/tool/toolchain.lua10
3 files changed, 11 insertions, 3 deletions
diff --git a/xmake/core/cache/localcache.lua b/xmake/core/cache/localcache.lua
index 8f99a16d7..fc68533f5 100644
--- a/xmake/core/cache/localcache.lua
+++ b/xmake/core/cache/localcache.lua
@@ -84,7 +84,7 @@ end
-- get cache value in level/3
function _instance:get3(key1, key2, key3)
- local value2 = self:get2(key1)
+ local value2 = self:get2(key1, key2)
if value2 ~= nil then
return value2[key3]
end
diff --git a/xmake/core/cache/memcache.lua b/xmake/core/cache/memcache.lua
index 2a3b9802e..ffdcd25f3 100644
--- a/xmake/core/cache/memcache.lua
+++ b/xmake/core/cache/memcache.lua
@@ -58,7 +58,7 @@ end
-- get cache value in level/3
function _instance:get3(key1, key2, key3)
- local value2 = self:get2(key1)
+ local value2 = self:get2(key1, key2)
if value2 ~= nil then
return value2[key3]
end
diff --git a/xmake/core/tool/toolchain.lua b/xmake/core/tool/toolchain.lua
index 5f6f9ccc2..ac0363d3d 100644
--- a/xmake/core/tool/toolchain.lua
+++ b/xmake/core/tool/toolchain.lua
@@ -378,6 +378,13 @@ end
-- check the given tool path
function _instance:_checktool(toolkind, toolpath)
+ -- get result from cache first
+ local cachekey = self:cachekey() .. "_checktool" .. toolkind
+ local result = toolchain._memcache():get3(cachekey, toolkind, toolpath)
+ if result then
+ return result[1], result[2]
+ end
+
-- get find_tool
local find_tool = self._find_tool
if not find_tool then
@@ -401,7 +408,7 @@ function _instance:_checktool(toolkind, toolpath)
-- find tool program
local program, toolname
- local tool = find_tool(toolpath, {cachekey = self:cachekey(), program = toolpath, paths = self:bindir(), envs = self:get("runenvs")})
+ local tool = find_tool(toolpath, {cachekey = cachekey, program = toolpath, paths = self:bindir(), envs = self:get("runenvs")})
if tool then
program = tool.program
toolname = tool.name
@@ -418,6 +425,7 @@ function _instance:_checktool(toolkind, toolpath)
utils.cprint("${dim}checking for %s (%s: ${bright}%s${clear}) ... ${color.nothing}${text.nothing}", description, toolkind, toolpath)
end
end
+ toolchain._memcache():set3(cachekey, toolkind, toolpath, {program, toolname})
return program, toolname
end