summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-08-09 23:49:51 +0800
committerruki <[email protected]>2025-08-09 23:49:51 +0800
commitd9af634da2cbbe29c1e185890255db39a4d5f60b (patch)
treeddd34ebd56d339ce0fc55ecd2e3107b3cda3e122
parent9dda4775ad3113086a42e611e590b215e35e0404 (diff)
fix tool cache
-rw-r--r--xmake/core/tool/compiler.lua14
-rw-r--r--xmake/core/tool/tool.lua5
2 files changed, 5 insertions, 14 deletions
diff --git a/xmake/core/tool/compiler.lua b/xmake/core/tool/compiler.lua
index 2d305dcf9..541a172b6 100644
--- a/xmake/core/tool/compiler.lua
+++ b/xmake/core/tool/compiler.lua
@@ -93,8 +93,6 @@ end
-- load compiler tool
function compiler._load_tool(sourcekind, target)
-
- -- get program from target
local program, toolname, toolchain_info
if target and target.tool then
program, toolname, toolchain_info = target:tool(sourcekind)
@@ -144,11 +142,7 @@ function compiler.load(sourcekind, target)
compiler._INSTANCES = compiler._INSTANCES or {}
local instance = compiler._INSTANCES[cachekey]
if not instance then
-
- -- new instance
instance = table.inherit(compiler, builder)
-
- -- save the compiler tool
instance._TOOL = compiler_tool
-- load the compiler language from the source kind
@@ -203,8 +197,6 @@ end
-- build the source files (compile and link)
function compiler:build(sourcefiles, targetfile, opt)
-
- -- init options
opt = opt or {}
-- get compile flags
@@ -228,15 +220,11 @@ function compiler:build(sourcefiles, targetfile, opt)
if not targetkind and opt.target and opt.target.targetkind then
targetkind = opt.target:kind()
end
-
- -- get it
return sandbox.load(self:_tool().build, self:_tool(), sourcefiles, targetkind or "binary", targetfile, flags)
end
-- get the build arguments list (compile and link)
function compiler:buildargv(sourcefiles, targetfile, opt)
-
- -- init options
opt = opt or {}
-- get compile flags
@@ -260,8 +248,6 @@ function compiler:buildargv(sourcefiles, targetfile, opt)
if not targetkind and opt.target and opt.target.targetkind then
targetkind = opt.target:kind()
end
-
- -- get it
return self:_tool():buildargv(sourcefiles, targetkind or "binary", targetfile, flags)
end
diff --git a/xmake/core/tool/tool.lua b/xmake/core/tool/tool.lua
index 0443498fe..06a5ca3ad 100644
--- a/xmake/core/tool/tool.lua
+++ b/xmake/core/tool/tool.lua
@@ -246,6 +246,11 @@ function tool.load(kind, opt)
-- init cachekey
local cachekey = kind .. (program or "") .. plat .. arch .. (opt.host and "host" or "")
+ if toolchain_info and toolchain_info.cachekey then
+ -- it maybe contains target key
+ -- @see https://github.com/xmake-io/xmake/issues/6672
+ cachekey = cachekey .. toolchain_info.cachekey
+ end
-- get it directly from cache dirst
tool._TOOLS = tool._TOOLS or {}