summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-12-13 22:51:02 +0800
committerruki <[email protected]>2020-12-13 22:51:02 +0800
commit361eda0cd491f887acfb842567f498a553249ad7 (patch)
tree028ed53dd9741d85835f275fbc67b060b4e95118
parent0f7d4ef7bf2c3d9e04fc104defb50e8c7f6583f1 (diff)
fix load toolchain
-rw-r--r--xmake/core/platform/platform.lua2
-rw-r--r--xmake/core/project/target.lua2
-rw-r--r--xmake/core/tool/tool.lua2
-rw-r--r--xmake/core/tool/toolchain.lua11
4 files changed, 10 insertions, 7 deletions
diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua
index 4b366fceb..0c2565099 100644
--- a/xmake/core/platform/platform.lua
+++ b/xmake/core/platform/platform.lua
@@ -195,7 +195,7 @@ function _instance:tool(toolkind)
for idx, toolchain_inst in ipairs(toolchains) do
program, toolname = toolchain_inst:tool(toolkind)
if program then
- toolchain_info = {name = toolchain_inst:name(), plat = toolchain_inst:plat(), arch = toolchain_inst:arch()}
+ toolchain_info = {name = toolchain_inst:name(), plat = toolchain_inst:plat(), arch = toolchain_inst:arch(), cachekey = toolchain_inst:cachekey()}
toolinfo[1] = program
toolinfo[2] = toolname
toolinfo[3] = toolchain_info
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 257e1b93b..dab501131 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -1773,7 +1773,7 @@ function _instance:tool(toolkind)
for idx, toolchain_inst in ipairs(toolchains) do
program, toolname = toolchain_inst:tool(toolkind)
if program then
- toolchain_info = {name = toolchain_inst:name(), plat = toolchain_inst:plat(), arch = toolchain_inst:arch()}
+ toolchain_info = {name = toolchain_inst:name(), plat = toolchain_inst:plat(), arch = toolchain_inst:arch(), cachekey = toolchain_inst:cachekey()}
break
end
end
diff --git a/xmake/core/tool/tool.lua b/xmake/core/tool/tool.lua
index 2bd0ed7ca..5e674fc5d 100644
--- a/xmake/core/tool/tool.lua
+++ b/xmake/core/tool/tool.lua
@@ -221,7 +221,7 @@ function tool.load(kind, opt)
-- load toolchain instance
local toolchain_inst
if toolchain_info and toolchain_info.name then
- toolchain_inst = toolchain.load(toolchain_info.name, {plat = plat, arch = arch})
+ toolchain_inst = toolchain.load(toolchain_info.name, {plat = plat, arch = arch, cachekey = toolchain_info.cachekey})
end
-- new an instance
diff --git a/xmake/core/tool/toolchain.lua b/xmake/core/tool/toolchain.lua
index 4eaa525b0..8775090a3 100644
--- a/xmake/core/tool/toolchain.lua
+++ b/xmake/core/tool/toolchain.lua
@@ -404,10 +404,13 @@ end
-- get cache key
function toolchain._cachekey(name, opt)
- local cachekey = name
- for _, k in ipairs(table.orderkeys(opt)) do
- local v = opt[k]
- cachekey = cachekey .. "_" .. k .. "_" .. tostring(v)
+ local cachekey = opt.cachekey
+ if not cachekey then
+ cachekey = name
+ for _, k in ipairs(table.orderkeys(opt)) do
+ local v = opt[k]
+ cachekey = cachekey .. "_" .. k .. "_" .. tostring(v)
+ end
end
return cachekey
end