summaryrefslogtreecommitdiff
path: root/xmake/core/tool/toolchain.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2025-12-03 22:26:07 +0800
committerruki <[email protected]>2025-12-03 22:26:07 +0800
commit4f5dcfa9e413ebaa3709098bee5c1fbc91cda231 (patch)
tree8b4150640ea8312b46c3e9a979fc2389e9354b72 /xmake/core/tool/toolchain.lua
parent605ce1f6bcfa8bcbe1a1f8151361f2539fb09727 (diff)
mark target/package/toolchain:memcache as public
Diffstat (limited to 'xmake/core/tool/toolchain.lua')
-rw-r--r--xmake/core/tool/toolchain.lua16
1 files changed, 13 insertions, 3 deletions
diff --git a/xmake/core/tool/toolchain.lua b/xmake/core/tool/toolchain.lua
index 2230aae9e..1da1634db 100644
--- a/xmake/core/tool/toolchain.lua
+++ b/xmake/core/tool/toolchain.lua
@@ -98,6 +98,16 @@ function _instance:fullname()
return namespace and namespace .. "::" .. name or name
end
+-- get memcache
+function _instance:memcache()
+ local cache = self._MEMCACHE
+ if not cache then
+ cache = memcache.cache("core.tool.toolchain." .. self:cachekey())
+ self._MEMCACHE = cache
+ end
+ return cache
+end
+
-- get toolchain platform
function _instance:plat()
return self._PLAT or self:config("plat")
@@ -482,8 +492,7 @@ end
function _instance:_checktool(toolkind, toolpath)
-- get result from cache first
- local cachekey = self:cachekey() .. "_checktool" .. toolkind
- local result = toolchain._memcache():get3(cachekey, toolkind, toolpath)
+ local result = self:memcache():get2("checktool_" .. toolkind, toolpath)
if result then
return result[1], result[2]
end
@@ -526,6 +535,7 @@ function _instance:_checktool(toolkind, toolpath)
end
-- find tool program
+ local cachekey = self:cachekey() .. "_checktool" .. toolkind
local tool = find_tool(toolpath, {toolchain = self,
cachekey = cachekey,
program = program or toolpath,
@@ -552,7 +562,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})
+ self:memcache():set2("checktool_" .. toolkind, toolpath, {program, toolname})
return program, toolname
end