summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-09-28 23:09:23 +0800
committerruki <[email protected]>2020-09-28 23:09:23 +0800
commit0c52f3a6ab4397c5be94c3293f4ae20d6b7a8b94 (patch)
treec6bacf9de25b6af942b5e7ac83bca8aa3cf1e5ce
parent34e395ad9281d17382b1d1c5a4e7828a259720f0 (diff)
rename some pathes to paths
-rw-r--r--xmake/core/sandbox/modules/import/lib/detect/find_program.lua51
-rw-r--r--xmake/core/tool/toolchain.lua8
-rw-r--r--xmake/modules/detect/packages/find_openssl.lua8
-rw-r--r--xmake/modules/detect/tools/find_cmake.lua2
-rw-r--r--xmake/modules/detect/tools/find_ollydbg.lua2
-rw-r--r--xmake/modules/detect/tools/find_python3.lua10
-rw-r--r--xmake/modules/detect/tools/find_rc.lua4
-rw-r--r--xmake/modules/detect/tools/find_sdar.lua12
-rw-r--r--xmake/modules/detect/tools/find_sdcc.lua2
-rw-r--r--xmake/modules/detect/tools/find_vsjitdebugger.lua2
-rw-r--r--xmake/modules/detect/tools/find_vswhere.lua2
-rw-r--r--xmake/modules/detect/tools/find_windbg.lua2
-rw-r--r--xmake/modules/detect/tools/find_x64dbg.lua2
-rw-r--r--xmake/modules/devel/git/submodule/update.lua8
-rw-r--r--xmake/modules/lib/detect/find_tool.lua8
-rw-r--r--xmake/toolchains/tinyc/xmake.lua2
16 files changed, 63 insertions, 62 deletions
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 8958c2035..dc01cfd6e 100644
--- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua
+++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua
@@ -74,12 +74,12 @@ function sandbox_lib_detect_find_program._check(program, opt)
return ok
end
--- find program from the given pathes
-function sandbox_lib_detect_find_program._find_from_pathes(name, pathes, opt)
+-- find program from the given paths
+function sandbox_lib_detect_find_program._find_from_paths(name, paths, opt)
-- attempt to check it from the given directories
if not path.is_absolute(name) then
- for _, _path in ipairs(table.wrap(pathes)) do
+ for _, _path in ipairs(table.wrap(paths)) do
-- format path for builtin variables
if type(_path) == "function" then
@@ -131,27 +131,27 @@ function sandbox_lib_detect_find_program._find_from_packages(name, opt)
-- get install directory of this package
local installdir = path.directory(manifest_file)
- -- init pathes
- local pathes = {}
+ -- init paths
+ local paths = {}
local manifest = io.load(manifest_file)
if manifest and manifest.envs then
local pathenvs = manifest.envs.PATH
if pathenvs then
for _, pathenv in ipairs(pathenvs) do
- table.insert(pathes, path.join(installdir, pathenv))
+ table.insert(paths, path.join(installdir, pathenv))
end
end
end
-- find it
- return sandbox_lib_detect_find_program._find_from_pathes(name, pathes, opt)
+ return sandbox_lib_detect_find_program._find_from_paths(name, paths, opt)
end
-- find program
-function sandbox_lib_detect_find_program._find(name, pathes, opt)
+function sandbox_lib_detect_find_program._find(name, paths, opt)
-- attempt to find it from the given directories
- local program_path = sandbox_lib_detect_find_program._find_from_pathes(name, pathes, opt)
+ local program_path = sandbox_lib_detect_find_program._find_from_paths(name, paths, opt)
if program_path then
return program_path
end
@@ -192,13 +192,13 @@ function sandbox_lib_detect_find_program._find(name, pathes, opt)
end
-- attempt to find it from the some default system directories
- local syspathes = {}
+ local syspaths = {}
if os.host() ~= "windows" then
- table.insert(syspathes, "/usr/local/bin")
- table.insert(syspathes, "/usr/bin")
+ table.insert(syspaths, "/usr/local/bin")
+ table.insert(syspaths, "/usr/bin")
end
- if #syspathes > 0 then
- program_path = sandbox_lib_detect_find_program._find_from_pathes(name, syspathes, opt)
+ if #syspaths > 0 then
+ program_path = sandbox_lib_detect_find_program._find_from_paths(name, syspaths, opt)
if program_path then
return program_path
end
@@ -216,8 +216,8 @@ end
-- find program
--
-- @param name the program name
--- @param opt the options, e.g. {pathes = {"/usr/bin"}, check = function (program) os.run("%s -h", program) end, verbose = true, force = true, cachekey = "xxx"}
--- - opt.pathes the program pathes (e.g. dirs, pathes, winreg pathes, script pathes)
+-- @param opt the options, e.g. {paths = {"/usr/bin"}, check = function (program) os.run("%s -h", program) end, verbose = true, force = true, cachekey = "xxx"}
+-- - opt.paths the program paths (e.g. dirs, paths, winreg paths, script paths)
-- - opt.check the check script or command
-- - opt.norun do not attempt to run program to check program fastly
--
@@ -226,11 +226,11 @@ end
-- @code
--
-- local program = find_program("ccache")
--- local program = find_program("ccache", {pathes = {"/usr/bin", "/usr/local/bin"}})
--- local program = find_program("ccache", {pathes = {"/usr/bin", "/usr/local/bin"}, check = "--help"}) -- simple check command: ccache --help
--- local program = find_program("ccache", {pathes = {"/usr/bin", "/usr/local/bin"}, check = function (program) os.run("%s -h", program) end})
--- local program = find_program("ccache", {pathes = {"$(env PATH)", "$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger)"}})
--- local program = find_program("ccache", {pathes = {"$(env PATH)", function () return "/usr/local/bin" end}})
+-- local program = find_program("ccache", {paths = {"/usr/bin", "/usr/local/bin"}})
+-- local program = find_program("ccache", {paths = {"/usr/bin", "/usr/local/bin"}, check = "--help"}) -- simple check command: ccache --help
+-- local program = find_program("ccache", {paths = {"/usr/bin", "/usr/local/bin"}, check = function (program) os.run("%s -h", program) end})
+-- local program = find_program("ccache", {paths = {"$(env PATH)", "$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger)"}})
+-- local program = find_program("ccache", {paths = {"$(env PATH)", function () return "/usr/local/bin" end}})
-- local program = find_program("ccache", {envs = {PATH = "xxx"}})
--
-- @endcode
@@ -261,20 +261,21 @@ function sandbox_lib_detect_find_program.main(name, opt)
return result and result or nil
end
- -- get pathes from the opt.envs.PATH
+ -- get paths from the opt.envs.PATH
+ -- @note the wrong `pathes` word will be discarded, but the interface parameters will still be compatible
local envs = opt.envs
- local pathes = opt.pathes
+ local paths = opt.paths or opt.pathes
if envs and (envs.PATH or envs.path) then
local pathenv = envs.PATH or envs.path
if type(pathenv) == "string" then
pathenv = path.splitenv(pathenv)
end
- pathes = table.join(table.wrap(opt.pathes), pathenv)
+ paths = table.join(table.wrap(opt.paths or opt.pathes), pathenv)
end
-- find executable program
checking = coroutine_running and name or nil
- result = sandbox_lib_detect_find_program._find(name, pathes, opt)
+ result = sandbox_lib_detect_find_program._find(name, paths, opt)
checking = nil
-- cache result
diff --git a/xmake/core/tool/toolchain.lua b/xmake/core/tool/toolchain.lua
index c3373b27d..d8de03f8c 100644
--- a/xmake/core/tool/toolchain.lua
+++ b/xmake/core/tool/toolchain.lua
@@ -155,9 +155,9 @@ end
-- get the program and name of the given tool kind
function _instance:tool(toolkind)
- local toolpathes = self:get("toolset." .. toolkind)
- if toolpathes then
- for _, toolpath in ipairs(table.wrap(toolpathes)) do
+ local toolpaths = self:get("toolset." .. toolkind)
+ if toolpaths then
+ for _, toolpath in ipairs(table.wrap(toolpaths)) do
local program, toolname = self:_checktool(toolkind, toolpath)
if program then
return program, toolname
@@ -290,7 +290,7 @@ function _instance:_checktool(toolkind, toolpath)
-- find tool program
local program, toolname
- local tool = find_tool(toolpath, {program = toolpath, pathes = self:bindir(), envs = self:get("runenvs")})
+ local tool = find_tool(toolpath, {program = toolpath, paths = self:bindir(), envs = self:get("runenvs")})
if tool then
program = tool.program
toolname = tool.name
diff --git a/xmake/modules/detect/packages/find_openssl.lua b/xmake/modules/detect/packages/find_openssl.lua
index 7c27ebd85..e56503c23 100644
--- a/xmake/modules/detect/packages/find_openssl.lua
+++ b/xmake/modules/detect/packages/find_openssl.lua
@@ -39,8 +39,8 @@ function main(opt)
-- init bits
local bits = (opt.arch == "x64" and "64" or "32")
- -- init search pathes
- local pathes = {"$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL %(" .. bits .. "-bit%)_is1;Inno Setup: App Path)",
+ -- init search paths
+ local paths = {"$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL %(" .. bits .. "-bit%)_is1;Inno Setup: App Path)",
"$(env PROGRAMFILES)/OpenSSL",
"$(env PROGRAMFILES)/OpenSSL-Win" .. bits,
"C:/OpenSSL",
@@ -49,7 +49,7 @@ function main(opt)
-- find library
local result = {links = {}, linkdirs = {}, includedirs = {}}
for _, name in ipairs({"libssl", "libcrypto"}) do
- local linkinfo = find_library(name, pathes, {suffixes = "lib"})
+ local linkinfo = find_library(name, paths, {suffixes = "lib"})
if linkinfo then
table.insert(result.links, linkinfo.link)
table.insert(result.linkdirs, linkinfo.linkdir)
@@ -62,7 +62,7 @@ function main(opt)
end
-- find include
- table.insert(result.includedirs, find_path("openssl/ssl.h", pathes, {suffixes = "include"}))
+ table.insert(result.includedirs, find_path("openssl/ssl.h", paths, {suffixes = "include"}))
-- ok
return result
diff --git a/xmake/modules/detect/tools/find_cmake.lua b/xmake/modules/detect/tools/find_cmake.lua
index ba9ad615e..49a8b6e42 100644
--- a/xmake/modules/detect/tools/find_cmake.lua
+++ b/xmake/modules/detect/tools/find_cmake.lua
@@ -40,7 +40,7 @@ function main(opt)
-- init options
opt = opt or {}
if is_host("windows") then
- opt.pathes = "$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Kitware\\CMake;InstallDir)\\bin"
+ opt.paths = "$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Kitware\\CMake;InstallDir)\\bin"
end
-- find program
diff --git a/xmake/modules/detect/tools/find_ollydbg.lua b/xmake/modules/detect/tools/find_ollydbg.lua
index 3d2c33cd9..4a2da3621 100644
--- a/xmake/modules/detect/tools/find_ollydbg.lua
+++ b/xmake/modules/detect/tools/find_ollydbg.lua
@@ -45,7 +45,7 @@ function main(opt)
-- init options
opt = opt or {}
- opt.pathes = opt.pathes or function ()
+ opt.paths = opt.paths or function ()
for _, reg in ipairs({"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger"}) do
return (val("reg " .. reg) or ""):match("\"(.-)\"")
end
diff --git a/xmake/modules/detect/tools/find_python3.lua b/xmake/modules/detect/tools/find_python3.lua
index df3daff49..3e5642aef 100644
--- a/xmake/modules/detect/tools/find_python3.lua
+++ b/xmake/modules/detect/tools/find_python3.lua
@@ -40,11 +40,11 @@ function main(opt)
-- init options
opt = opt or {}
if is_host("windows") then
- opt.pathes = opt.pathes or {}
- table.insert(opt.pathes, "$(reg HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\3.7\\InstallPath;ExecutablePath)")
- table.insert(opt.pathes, "$(reg HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\3.7-32\\InstallPath;ExecutablePath)")
- table.insert(opt.pathes, "$(reg HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\3.6\\InstallPath;ExecutablePath)")
- table.insert(opt.pathes, "$(reg HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\3.6-32\\InstallPath;ExecutablePath)")
+ opt.paths = opt.paths or {}
+ table.insert(opt.paths, "$(reg HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\3.7\\InstallPath;ExecutablePath)")
+ table.insert(opt.paths, "$(reg HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\3.7-32\\InstallPath;ExecutablePath)")
+ table.insert(opt.paths, "$(reg HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\3.6\\InstallPath;ExecutablePath)")
+ table.insert(opt.paths, "$(reg HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\3.6-32\\InstallPath;ExecutablePath)")
end
-- find program
diff --git a/xmake/modules/detect/tools/find_rc.lua b/xmake/modules/detect/tools/find_rc.lua
index 0fcef12f8..5edd8d69c 100644
--- a/xmake/modules/detect/tools/find_rc.lua
+++ b/xmake/modules/detect/tools/find_rc.lua
@@ -64,8 +64,8 @@ function main(opt)
if vcvars and vcvars.WindowsSdkDir and vcvars.WindowsSDKVersion then
local bindir = path.join(vcvars.WindowsSdkDir, "bin", vcvars.WindowsSDKVersion, arch)
if os.isdir(bindir) then
- opt.pathes = opt.pathes or {}
- table.insert(opt.pathes, bindir)
+ opt.paths = opt.paths or {}
+ table.insert(opt.paths, bindir)
end
end
end
diff --git a/xmake/modules/detect/tools/find_sdar.lua b/xmake/modules/detect/tools/find_sdar.lua
index 48d055bdf..eafa1a5da 100644
--- a/xmake/modules/detect/tools/find_sdar.lua
+++ b/xmake/modules/detect/tools/find_sdar.lua
@@ -40,17 +40,17 @@ function main(opt)
opt = opt or {}
opt.command = opt.command or "--version"
- -- add search pathes
- local pathes = {}
+ -- add search paths
+ local paths = {}
local bindir = get_config("bin")
if bindir and os.isdir(bindir) then
- table.insert(pathes, bindir)
+ table.insert(paths, bindir)
end
if is_host("windows") then
- table.insert(pathes, "$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\SDCC)\\bin")
+ table.insert(paths, "$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\SDCC)\\bin")
end
- if #pathes > 0 then
- opt.pathes = pathes
+ if #paths > 0 then
+ opt.paths = paths
end
-- find program
diff --git a/xmake/modules/detect/tools/find_sdcc.lua b/xmake/modules/detect/tools/find_sdcc.lua
index 5c2867d02..f5db20b32 100644
--- a/xmake/modules/detect/tools/find_sdcc.lua
+++ b/xmake/modules/detect/tools/find_sdcc.lua
@@ -50,7 +50,7 @@ function main(opt)
table.insert(paths, "$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\SDCC)\\bin")
end
if #paths > 0 then
- opt.pathes = paths
+ opt.paths = paths
end
-- find program
diff --git a/xmake/modules/detect/tools/find_vsjitdebugger.lua b/xmake/modules/detect/tools/find_vsjitdebugger.lua
index 2025557e0..aaf7fcf9d 100644
--- a/xmake/modules/detect/tools/find_vsjitdebugger.lua
+++ b/xmake/modules/detect/tools/find_vsjitdebugger.lua
@@ -45,7 +45,7 @@ function main(opt)
-- init options
opt = opt or {}
- opt.pathes = opt.pathes or function ()
+ opt.paths = opt.paths or function ()
for _, reg in ipairs({"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger"}) do
return (val("reg " .. reg) or ""):match("\"(.-)\"")
end
diff --git a/xmake/modules/detect/tools/find_vswhere.lua b/xmake/modules/detect/tools/find_vswhere.lua
index 40c00bf25..ec0ad3986 100644
--- a/xmake/modules/detect/tools/find_vswhere.lua
+++ b/xmake/modules/detect/tools/find_vswhere.lua
@@ -49,7 +49,7 @@ function main(opt)
-- find program
opt.check = opt.check or "-?"
opt.command = opt.command or "-?"
- opt.pathes = opt.pathes or
+ opt.paths = opt.paths or
{
"$(env ProgramFiles%(x86%))\\Microsoft Visual Studio\\Installer",
"$(env ProgramFiles)\\Microsoft Visual Studio\\Installer"
diff --git a/xmake/modules/detect/tools/find_windbg.lua b/xmake/modules/detect/tools/find_windbg.lua
index 7bb6d2453..f1c335faa 100644
--- a/xmake/modules/detect/tools/find_windbg.lua
+++ b/xmake/modules/detect/tools/find_windbg.lua
@@ -45,7 +45,7 @@ function main(opt)
-- init options
opt = opt or {}
- opt.pathes = opt.pathes or function ()
+ opt.paths = opt.paths or function ()
for _, reg in ipairs({"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger"}) do
return (val("reg " .. reg) or ""):match("\"(.-)\"")
end
diff --git a/xmake/modules/detect/tools/find_x64dbg.lua b/xmake/modules/detect/tools/find_x64dbg.lua
index 4f265c99d..06015c011 100644
--- a/xmake/modules/detect/tools/find_x64dbg.lua
+++ b/xmake/modules/detect/tools/find_x64dbg.lua
@@ -45,7 +45,7 @@ function main(opt)
-- init options
opt = opt or {}
- opt.pathes = opt.pathes or function ()
+ opt.paths = opt.paths or function ()
for _, reg in ipairs({"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger"}) do
return (val("reg " .. reg) or ""):match("\"(.-)\"")
end
diff --git a/xmake/modules/devel/git/submodule/update.lua b/xmake/modules/devel/git/submodule/update.lua
index 15ff08950..106b4ef62 100644
--- a/xmake/modules/devel/git/submodule/update.lua
+++ b/xmake/modules/devel/git/submodule/update.lua
@@ -24,14 +24,14 @@ import("lib.detect.find_tool")
-- update submodule
--
--- @param opt the argument options, e.g. repodir, init, remote, force, checkout, merge, rebase, recursive, reference, pathes
+-- @param opt the argument options, e.g. repodir, init, remote, force, checkout, merge, rebase, recursive, reference, paths
--
-- @code
--
-- import("devel.git.submodule")
--
-- submodule.update("master", {repodir = "/tmp/xmake", init = true, remote = true})
--- submodule.update("v1.0.1", {repodir = "/tmp/xmake", recursive = true, reference = "xxx", pathes = "xxx"})
+-- submodule.update("v1.0.1", {repodir = "/tmp/xmake", recursive = true, reference = "xxx", paths = "xxx"})
--
-- @endcode
--
@@ -54,8 +54,8 @@ function main(opt)
table.insert(argv, "--reference")
table.insert(argv, opt.reference)
end
- if opt.pathes then
- table.join2(argv, opt.pathes)
+ if opt.paths or opt.pathes then
+ table.join2(argv, opt.paths or opt.pathes)
end
-- enter repository directory
diff --git a/xmake/modules/lib/detect/find_tool.lua b/xmake/modules/lib/detect/find_tool.lua
index ada6f3a27..34ad0c20c 100644
--- a/xmake/modules/lib/detect/find_tool.lua
+++ b/xmake/modules/lib/detect/find_tool.lua
@@ -39,7 +39,7 @@ end
-- find tool
--
-- @param name the tool name
--- @param opt the options, e.g. {program = "xcrun -sdk macosx clang", pathes = {"/usr/bin"},
+-- @param opt the options, e.g. {program = "xcrun -sdk macosx clang", paths = {"/usr/bin"},
-- check = function (tool) os.run("%s -h", tool) end, version = true
-- force = true, cachekey = "xxx", envs = {PATH = "xxx"}}
--
@@ -49,11 +49,11 @@ end
--
-- local tool = find_tool("clang")
-- local tool = find_tool("clang", {program = "xcrun -sdk macosx clang"})
--- local tool = find_tool("clang", {pathes = {"/usr/bin", "/usr/local/bin"}})
+-- local tool = find_tool("clang", {paths = {"/usr/bin", "/usr/local/bin"}})
-- local tool = find_tool("clang", {check = "--help"}) -- simple check command: ccache --help
-- local tool = find_tool("clang", {check = function (tool) os.run("%s -h", tool) end})
--- local tool = find_tool("clang", {pathes = {"$(env PATH)", "$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger)"}})
--- local tool = find_tool("clang", {pathes = {"$(env PATH)", function () return "/usr/bin"end}})
+-- local tool = find_tool("clang", {paths = {"$(env PATH)", "$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger)"}})
+-- local tool = find_tool("clang", {paths = {"$(env PATH)", function () return "/usr/bin"end}})
-- local tool = find_tool("ccache", {version = true})
--
-- @endcode
diff --git a/xmake/toolchains/tinyc/xmake.lua b/xmake/toolchains/tinyc/xmake.lua
index 7327969d5..8eb6f79f4 100644
--- a/xmake/toolchains/tinyc/xmake.lua
+++ b/xmake/toolchains/tinyc/xmake.lua
@@ -49,7 +49,7 @@ toolchain("tinyc")
sdkdir = winenv_tccsdk
end
end
- if find_tool("tcc", {pathes = config.get("bin") or sdkdir}) then
+ if find_tool("tcc", {paths = config.get("bin") or sdkdir}) then
config.set("__tcc_sdkdir", sdkdir)
return true
end