diff options
| author | ruki <[email protected]> | 2022-04-27 22:29:53 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-04-27 22:29:53 +0800 |
| commit | bd67f2b5493a079d43da820b1d09d486ce94d66d (patch) | |
| tree | 4a94b923727238d566001b25b9bc754293a87424 | |
| parent | 48744c514a5d109d2127a401e37234300330e866 (diff) | |
fix toolname
| -rw-r--r-- | xmake/core/project/target.lua | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 88ba324f4..67e9cd08a 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -1975,6 +1975,7 @@ function _instance:tool(toolkind) return toolchain.tool(self:toolchains(), toolkind, {cachekey = "target_" .. self:name(), plat = self:plat(), arch = self:arch(), before_get = function() -- get program from set_toolchain/set_tools (deprecated) + local toolname local program = self:get("toolset." .. toolkind) or self:get("toolchain." .. toolkind) if not program then local tools = self:get("tools") -- TODO: deprecated @@ -1986,7 +1987,23 @@ function _instance:tool(toolkind) if not program and not self:get("toolchains") then program = config.get(toolkind) end - return program + + -- contain toolname? parse it, e.g. '[email protected]' + -- https://github.com/xmake-io/xmake/issues/1361 + if program and not toolname then + local pos = program:find('@', 1, true) + if pos then + toolname = program:sub(1, pos - 1) + program = program:sub(pos + 1) + end + end + + -- find toolname + if program and not toolname then + local find_toolname = sandbox_module.import("lib.detect.find_toolname", {anonymous = true}) + toolname = find_toolname(program) + end + return program, toolname end}) end |
