diff options
| author | ruki <[email protected]> | 2017-11-09 22:41:13 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-11-09 10:07:18 +0800 |
| commit | aa332adff92a4d51ec02b884276cded3ba9ec83c (patch) | |
| tree | 46476171b7a637504dd1871dcfb9b51de548cfbe | |
| parent | 31b1517d8303402f34f70fec8a7d6d644b1a10db (diff) | |
improve to configure cross-toolchains
| -rw-r--r-- | CHANGELOG.md | 12 | ||||
| -rw-r--r-- | xmake/core/platform/platform.lua | 19 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/lib/detect/find_program.lua | 2 | ||||
| -rw-r--r-- | xmake/core/tool/tool.lua | 6 |
4 files changed, 31 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 253d874c8..225a5b038 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## master (unreleased) +## v2.1.9 + +### Changes + +* Improve to configure cross-toolchains, add tool alias to support unknown tool name, .e.g `xmake f [email protected]` + ## v2.1.8 ### New features @@ -391,6 +397,12 @@ ## master (开发中) +## v2.1.9 + +### 改进 + +* 改进交叉工具链配置,通过指定工具别名定向到已知的工具链来支持未知编译工具名配置, 例如: `xmake f [email protected]` + ## v2.1.8 ### 新特性 diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua index 9b546fad7..e23946515 100644 --- a/xmake/core/platform/platform.lua +++ b/xmake/core/platform/platform.lua @@ -243,9 +243,7 @@ function platform.tool(toolkind) -- attempt to get program from config first local program = config.get(toolkind) - if program then - return program - else + if program == nil then -- check it first local check = platform.get("check") @@ -254,8 +252,21 @@ function platform.tool(toolkind) end -- get it again - return config.get(toolkind) + program = config.get(toolkind) end + + -- contain toolname? parse it, .e.g '[email protected]' + local toolname = nil + if program then + local pos = program:find('@', 1, true) + if pos then + toolname = program:sub(1, pos - 1) + program = program:sub(pos + 1) + end + end + + -- ok + return program, toolname end -- get the all platforms diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua index 2182f4d90..7c37ab665 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua @@ -191,7 +191,7 @@ function sandbox_lib_detect_find_program.main(name, opt) -- trace if option.get("verbose") or opt.verbose then if result then - utils.cprint("checking for the %s ... ${green}%s", name, result) + utils.cprint("checking for the %s ... ${green}%s", name, utils.ifelse(name == result, "ok", result)) else utils.cprint("checking for the %s ... ${red}no", name) end diff --git a/xmake/core/tool/tool.lua b/xmake/core/tool/tool.lua index ba7388526..0cd02120f 100644 --- a/xmake/core/tool/tool.lua +++ b/xmake/core/tool/tool.lua @@ -109,8 +109,8 @@ function tool.load(kind) return tool._TOOLS[kind] end - -- get the tool program - local program = platform.tool(kind) + -- get the tool program and name + local program, toolname = platform.tool(kind) if not program then return nil, string.format("cannot get tool for %s", kind) end @@ -119,7 +119,7 @@ function tool.load(kind) tool._find_toolname = tool._find_toolname or import("lib.detect.find_toolname") -- get the tool name from the program - local ok, name_or_errors = sandbox.load(tool._find_toolname, program) + local ok, name_or_errors = sandbox.load(tool._find_toolname, toolname or program, {program = program}) if not ok then return nil, name_or_errors end |
