diff options
Diffstat (limited to 'xmake/modules')
52 files changed, 73 insertions, 0 deletions
diff --git a/xmake/modules/cli/amalgamate.lua b/xmake/modules/cli/amalgamate.lua index 72c7e8f2f..4f771807c 100644 --- a/xmake/modules/cli/amalgamate.lua +++ b/xmake/modules/cli/amalgamate.lua @@ -89,6 +89,7 @@ function _generate_file(target, inputpaths, outputpath, uniqueid) -- generate include graph local gh = graph.new(true) for idx, inputpath in ipairs(inputpaths) do + local inputpath = inputpath inputpath = path.normalize(path.absolute(inputpath, os.projectdir())) inputpaths[idx] = inputpath gh:add_edge("__root__", inputpath) diff --git a/xmake/modules/core/tools/armcc/parse_deps.lua b/xmake/modules/core/tools/armcc/parse_deps.lua index 560bca40b..28a4f797c 100644 --- a/xmake/modules/core/tools/armcc/parse_deps.lua +++ b/xmake/modules/core/tools/armcc/parse_deps.lua @@ -59,6 +59,7 @@ function main(depsdata) local plain = {plain = true} line = line:replace("\\ ", space_placeholder, plain) for _, includefile in ipairs(line:split('\n', plain)) do + local includefile = includefile if is_host("windows") and includefile:match("^%w\\:") then includefile = includefile:replace("\\:", ":", plain) end diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua index a28d049c3..c945e163b 100644 --- a/xmake/modules/core/tools/cl.lua +++ b/xmake/modules/core/tools/cl.lua @@ -536,6 +536,7 @@ function _preprocess(program, argv, opt) local sourcefile = argv[#argv] local extension = path.extension(sourcefile) for _, flag in ipairs(argv) do + local flag = flag if flag:startswith("-Fo") or flag:startswith("/Fo") then objectfile = flag:sub(4) break @@ -703,6 +704,7 @@ function _show_warnings(self, output, sourcefile) local has_warnings = false local has_source_dependencies = _has_source_dependencies(self) for _, line in ipairs(output:split("\n", {plain = true})) do + local line = line line = line:rtrim() if #line > 0 then local skip = false @@ -806,6 +808,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt) else -- filter includes notes: "Note: including file: xxx.h", @note maybe not english language for _, line in ipairs(tostring(errors):split("\n", {plain = true})) do + local line = line line = line:rtrim() if not parse_include.has_include_note(line) then results = results .. line .. "\r\n" diff --git a/xmake/modules/core/tools/cl/parse_deps_json.lua b/xmake/modules/core/tools/cl/parse_deps_json.lua index 651f795ac..a969fa12e 100644 --- a/xmake/modules/core/tools/cl/parse_deps_json.lua +++ b/xmake/modules/core/tools/cl/parse_deps_json.lua @@ -134,6 +134,7 @@ function main(depsdata) local results = hashset.new() local projectdir = os.projectdir():lower() -- we need to generate lower string, because json values are all lower for _, includefile in ipairs(includes) do + local includefile = includefile includefile = _normailize_dep(includefile, projectdir) if includefile then results:insert(includefile) diff --git a/xmake/modules/core/tools/cl6x/parse_deps.lua b/xmake/modules/core/tools/cl6x/parse_deps.lua index 301d696aa..94a23bd9d 100644 --- a/xmake/modules/core/tools/cl6x/parse_deps.lua +++ b/xmake/modules/core/tools/cl6x/parse_deps.lua @@ -65,6 +65,7 @@ function main(depsdata, opt) local line = depsdata:rtrim() -- maybe there will be an empty newline at the end. so we trim it first local plain = {plain = true} for _, includefile in ipairs(line:split('\n', plain)) do -- it will trim all internal spaces without `{strict = true}` + local includefile = includefile includefile = includefile:split(": ", plain)[2] if includefile and #includefile > 0 then includefile = _normailize_dep(includefile, projectdir) diff --git a/xmake/modules/core/tools/cl_json/parse_deps.lua b/xmake/modules/core/tools/cl_json/parse_deps.lua index 2b84122b3..0dff3cf11 100644 --- a/xmake/modules/core/tools/cl_json/parse_deps.lua +++ b/xmake/modules/core/tools/cl_json/parse_deps.lua @@ -134,6 +134,7 @@ function main(depsdata) local results = hashset.new() local projectdir = os.projectdir():lower() -- we need to generate lower string, because json values are all lower for _, includefile in ipairs(includes) do + local includefile = includefile includefile = _normailize_dep(includefile, projectdir) if includefile then results:insert(includefile) diff --git a/xmake/modules/core/tools/gcc/parse_deps.lua b/xmake/modules/core/tools/gcc/parse_deps.lua index 5adf69b91..b8d55e844 100644 --- a/xmake/modules/core/tools/gcc/parse_deps.lua +++ b/xmake/modules/core/tools/gcc/parse_deps.lua @@ -92,6 +92,7 @@ function main(depsdata, opt) local plain = {plain = true} line = line:replace("\\ ", space_placeholder, plain) for _, includefile in ipairs(line:split(' ', plain)) do -- it will trim all internal spaces without `{strict = true}` + local includefile = includefile -- some gcc toolchains will some invalid paths (e.g. `d\:\xxx`), we need to fix it -- https://github.com/xmake-io/xmake/issues/1196 if is_host("windows") and includefile:match("^%w\\:") then diff --git a/xmake/modules/core/tools/link/has_flags.lua b/xmake/modules/core/tools/link/has_flags.lua index 9d44b7b1c..372118f39 100644 --- a/xmake/modules/core/tools/link/has_flags.lua +++ b/xmake/modules/core/tools/link/has_flags.lua @@ -88,6 +88,7 @@ end function _ignore_flags(flags) local results = {} for _, flag in ipairs(flags) do + local flag = flag flag = flag:lower() if not flag:find("[%-/]def:.+%.def") and not flag:find("[%-/]export:") then table.insert(results, flag) diff --git a/xmake/modules/core/tools/rc/parse_deps.lua b/xmake/modules/core/tools/rc/parse_deps.lua index bd526823f..66f0dcdc2 100644 --- a/xmake/modules/core/tools/rc/parse_deps.lua +++ b/xmake/modules/core/tools/rc/parse_deps.lua @@ -41,6 +41,7 @@ function main(depsdata) local results = hashset.new() local projectdir = os.projectdir() for _, includefile in ipairs(depsdata:split('\n', {plain = true})) do + local includefile = includefile if #includefile > 0 then includefile = _normailize_dep(includefile, projectdir) if includefile then diff --git a/xmake/modules/detect/sdks/find_cross_toolchain.lua b/xmake/modules/detect/sdks/find_cross_toolchain.lua index 9b7076201..7b5a11af3 100644 --- a/xmake/modules/detect/sdks/find_cross_toolchain.lua +++ b/xmake/modules/detect/sdks/find_cross_toolchain.lua @@ -34,6 +34,7 @@ function _find_bindir(sdkdir, opt) -- attempt to find *-[gcc|clang|ld] for _, toolname in ipairs({"gcc", "clang", "ld"}) do + local toolname = toolname if is_host("windows") then toolname = toolname .. ".exe" end diff --git a/xmake/modules/detect/sdks/find_dotnet.lua b/xmake/modules/detect/sdks/find_dotnet.lua index f64acacd3..3afb06138 100644 --- a/xmake/modules/detect/sdks/find_dotnet.lua +++ b/xmake/modules/detect/sdks/find_dotnet.lua @@ -49,6 +49,7 @@ function _find_dotnet_cli(sdkdir) if sdklist then local sdks = {} for _, line in ipairs(sdklist:split("\n", {plain = true})) do + local line = line line = line:trim() local ver, dir = line:match("^(%S+)%s+%[(.-)%]") if ver and dir then @@ -72,6 +73,7 @@ function _find_dotnet_cli(sdkdir) if runtimelist then local runtimes = {} for _, line in ipairs(runtimelist:split("\n", {plain = true})) do + local line = line line = line:trim() local name, ver = line:match("^(%S+)%s+(%S+)%s+%[") if name and ver then diff --git a/xmake/modules/detect/sdks/find_vstudio.lua b/xmake/modules/detect/sdks/find_vstudio.lua index 8a805aae6..e7699ee0d 100644 --- a/xmake/modules/detect/sdks/find_vstudio.lua +++ b/xmake/modules/detect/sdks/find_vstudio.lua @@ -395,6 +395,7 @@ function _check_vcvarsall_env(vars) if value_org and value_new and #value_org > 0 then local values_new = hashset.from(path.splitenv(value_new)) for _, p in ipairs(value_org) do + local p = p if not values_new:has(p) then if #p > 256 then p = p:sub(1, 256) .. "..." @@ -518,6 +519,7 @@ function _find_vstudio(opt) -- find vs2017 -> vs4.2 local results = {} for _, version in ipairs(order_vsvers) do + local version = version -- find VC install path (and aux build path) using `vswhere` (for version >= 15.0) -- * version > 15.0 eschews registry entries; but `vswhere` (included with version >= 15.2) can be used to find VC install path diff --git a/xmake/modules/lib/detect/check_importfiles.lua b/xmake/modules/lib/detect/check_importfiles.lua index 844939891..d8c12d387 100644 --- a/xmake/modules/lib/detect/check_importfiles.lua +++ b/xmake/modules/lib/detect/check_importfiles.lua @@ -34,6 +34,7 @@ function main(names, opt) verbose = true end for _, name in ipairs(names) do + local name = name local kind local parts = name:split("::") if #parts == 2 then diff --git a/xmake/modules/lib/detect/find_toolname.lua b/xmake/modules/lib/detect/find_toolname.lua index 37f468c73..0b7ad1a9b 100644 --- a/xmake/modules/lib/detect/find_toolname.lua +++ b/xmake/modules/lib/detect/find_toolname.lua @@ -49,6 +49,7 @@ function _find_with_whole_name(program) local partnames = {} local names = path.filename(program):lower():split("%s") for _, name in ipairs(names) do + local name = name -- remove suffix: ".exe", e.g. "zig.exe cc" name = _remove_suffix(name) -- "zig c++" -> zig_cxx diff --git a/xmake/modules/lib/detect/has_flags.lua b/xmake/modules/lib/detect/has_flags.lua index 8ac8e3385..61a44f8c1 100644 --- a/xmake/modules/lib/detect/has_flags.lua +++ b/xmake/modules/lib/detect/has_flags.lua @@ -106,6 +106,7 @@ function main(name, flags, opt) -- split flag group, e.g. "-I /xxx" => {"-I", "/xxx"} local results = {} for _, flag in ipairs(checkflags) do + local flag = flag flag = flag:trim() if #flag > 0 then if flag:find(" ", 1, true) then diff --git a/xmake/modules/net/proxy.lua b/xmake/modules/net/proxy.lua index 812fdc536..7a45da39d 100644 --- a/xmake/modules/net/proxy.lua +++ b/xmake/modules/net/proxy.lua @@ -157,6 +157,7 @@ function config(url) if host and proxy_hosts then host = host:lower() for _, proxy_host in ipairs(proxy_hosts) do + local proxy_host = proxy_host proxy_host = proxy_host:lower() if host == proxy_hosts or host:match(_host_pattern(proxy_host)) then return _global_proxy() diff --git a/xmake/modules/package/manager/apt/find_package.lua b/xmake/modules/package/manager/apt/find_package.lua index f9bec605d..4e9f7b138 100644 --- a/xmake/modules/package/manager/apt/find_package.lua +++ b/xmake/modules/package/manager/apt/find_package.lua @@ -33,6 +33,7 @@ function _find_package(dpkg, name, opt) local listinfo = try {function () return os.iorunv(dpkg.program, {"--listfiles", name}) end} if listinfo then for _, line in ipairs(listinfo:split('\n', {plain = true})) do + local line = line line = line:trim() -- get includedirs diff --git a/xmake/modules/package/manager/cmake/find_package.lua b/xmake/modules/package/manager/cmake/find_package.lua index 7192843a9..dba4cae04 100644 --- a/xmake/modules/package/manager/cmake/find_package.lua +++ b/xmake/modules/package/manager/cmake/find_package.lua @@ -203,6 +203,7 @@ function _find_package(cmake, name, opt) io.write(linkdata .. "\n") end for _, line in ipairs(os.argv(linkdata)) do + local line = line local is_ldflags = false local is_library = false for _, suffix in ipairs({".so", ".dylib", ".dylib", ".tbd", ".lib"}) do diff --git a/xmake/modules/package/manager/conan/v1/install_package.lua b/xmake/modules/package/manager/conan/v1/install_package.lua index d96727eb7..9d36400ac 100644 --- a/xmake/modules/package/manager/conan/v1/install_package.lua +++ b/xmake/modules/package/manager/conan/v1/install_package.lua @@ -77,6 +77,7 @@ function _conan_generate_conanfile(name, configs, opt) if #options > 0 then conanfile:print("[options]") for _, item in ipairs(options) do + local item = item if not item:find(":", 1, true) then item = name .. ":" .. item end diff --git a/xmake/modules/package/manager/conan/v2/install_package.lua b/xmake/modules/package/manager/conan/v2/install_package.lua index ff834e1b6..fae6d7ff4 100644 --- a/xmake/modules/package/manager/conan/v2/install_package.lua +++ b/xmake/modules/package/manager/conan/v2/install_package.lua @@ -77,6 +77,7 @@ function _conan_generate_conanfile(name, configs, opt) if #options > 0 then conanfile:print("[options]") for _, item in ipairs(options) do + local item = item if not item:find(":", 1, true) then item = name .. "/*:" .. item end diff --git a/xmake/modules/package/manager/conda/find_package.lua b/xmake/modules/package/manager/conda/find_package.lua index 608d85f3b..b3f447bed 100644 --- a/xmake/modules/package/manager/conda/find_package.lua +++ b/xmake/modules/package/manager/conda/find_package.lua @@ -107,6 +107,7 @@ function main(name, opt) local result = nil local packagedir = metainfo.extracted_package_dir for _, line in ipairs(metainfo.files) do + local line = line line = line:trim() -- get includedirs diff --git a/xmake/modules/package/manager/nix/search_package.lua b/xmake/modules/package/manager/nix/search_package.lua index 3ad66610c..60acd3ef3 100644 --- a/xmake/modules/package/manager/nix/search_package.lua +++ b/xmake/modules/package/manager/nix/search_package.lua @@ -75,6 +75,7 @@ function _search_with_env(name) -- nixpkgs.cmakeWithGui cmake-3.27.7 for _, line in ipairs(searchdata:split("\n", {plain = true})) do + local line = line line = line:trim() if line ~= "" then local parts = line:split("%s+", {limit = 2}) diff --git a/xmake/modules/package/manager/nuget/find_package.lua b/xmake/modules/package/manager/nuget/find_package.lua index 4a27eed19..c9fa2b712 100644 --- a/xmake/modules/package/manager/nuget/find_package.lua +++ b/xmake/modules/package/manager/nuget/find_package.lua @@ -188,6 +188,7 @@ function _find_package(name, result, opt) local libarch = libarchs[arch] or "x64" local libmode = configs.debug and "Debug" or "Release" for _, file in ipairs(libinfo.files) do + local file = file local filepath = path.join(installdir, file) file = file:trim() diff --git a/xmake/modules/package/manager/pacman/find_package.lua b/xmake/modules/package/manager/pacman/find_package.lua index 3b200db26..cc84b6774 100644 --- a/xmake/modules/package/manager/pacman/find_package.lua +++ b/xmake/modules/package/manager/pacman/find_package.lua @@ -50,6 +50,7 @@ function _find_package_from_list(list, name, pacman, opt) -- iterate over each file path inside the pacman package local result = {} for _, line in ipairs(list:split('\n', {plain = true})) do -- on msys cygpath should be used to convert local path to windows path + local line = line line = line:trim():split('%s+')[2] if line:find("/include/", 1, true) and (line:endswith(".h") or line:endswith(".hpp")) then if not line:startswith("/usr/include/") then @@ -133,6 +134,7 @@ function _find_libfiles_from_list(list, name, pacman, opt) -- iterate over each file path inside the pacman package local libfiles for _, line in ipairs(list:split('\n', {plain = true})) do -- on msys cygpath should be used to convert local path to windows path + local line = line line = line:trim():split('%s+')[2] if line:endswith(".dll.a") then -- only for mingw local apath = path.join(pathtomsys, line) @@ -185,6 +187,7 @@ function main(name, opt) local linkdirs = {} local pkgconfig_files = {} for _, line in ipairs(list:split('\n', {plain = true})) do + local line = line line = line:trim():split('%s+')[2] if line:find("/pkgconfig/", 1, true) and line:endswith(".pc") then table.insert(pkgconfig_files, line) diff --git a/xmake/modules/package/manager/portage/find_package.lua b/xmake/modules/package/manager/portage/find_package.lua index 4f6ae5d32..7fb560a28 100644 --- a/xmake/modules/package/manager/portage/find_package.lua +++ b/xmake/modules/package/manager/portage/find_package.lua @@ -63,6 +63,7 @@ function main(name, opt) local has_includes = false local pkgconfig_files = {} for _, line in ipairs(list) do + local line = line line = line:trim():split('%s+')[1] if line:find("/pkgconfig/", 1, true) and line:endswith(".pc") then pkgconfig_files[path.basename(line)] = line diff --git a/xmake/modules/package/manager/vcpkg/find_package.lua b/xmake/modules/package/manager/vcpkg/find_package.lua index f3dc740bd..7d0f44e12 100644 --- a/xmake/modules/package/manager/vcpkg/find_package.lua +++ b/xmake/modules/package/manager/vcpkg/find_package.lua @@ -35,6 +35,7 @@ function _required_features(name, configs) local features_str = name:match("%[(.-)%]") if features_str then for _, feature in ipairs(features_str:split(",", {plain = true})) do + local feature = feature feature = feature:trim() if #feature > 0 then table.insert(features, feature) @@ -42,6 +43,7 @@ function _required_features(name, configs) end end for _, feature in ipairs(table.wrap(configs and configs.features)) do + local feature = feature feature = tostring(feature):trim() if #feature > 0 then table.insert(features, feature) @@ -102,6 +104,7 @@ function _get_package_info(name, triplet, infodirs, arch, plat, mode) local info = io.readfile(infofile) if info then for _, line in ipairs(info:split('\n')) do + local line = line line = line:trim() if plat == "windows" then line = line:lower() diff --git a/xmake/modules/package/manager/zypper/find_package.lua b/xmake/modules/package/manager/zypper/find_package.lua index 2f0d5fc88..e5a05c5ab 100644 --- a/xmake/modules/package/manager/zypper/find_package.lua +++ b/xmake/modules/package/manager/zypper/find_package.lua @@ -38,6 +38,7 @@ function _find_package(rpm, name, opt) end } if listinfo then for _, line in ipairs(listinfo:split('\n', { plain = true })) do + local line = line line = line:trim() -- get includedirs diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua index c2fc26954..43c7d902b 100644 --- a/xmake/modules/package/tools/autoconf.lua +++ b/xmake/modules/package/tools/autoconf.lua @@ -667,6 +667,7 @@ function configure(package, configs, opt) -- pass configurations local argv = {} for name, value in pairs(_get_configs(package, configs)) do + local value = value value = tostring(value):trim() if value ~= "" then if type(name) == "number" then @@ -721,6 +722,7 @@ function build(package, configs, opt) end if opt.makeconfigs then for name, value in pairs(opt.makeconfigs) do + local value = value value = tostring(value):trim() if value ~= "" then if type(name) == "number" then @@ -748,6 +750,7 @@ function install(package, configs, opt) end if opt.makeconfigs then for name, value in pairs(opt.makeconfigs) do + local value = value value = tostring(value):trim() if value ~= "" then if type(name) == "number" then diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 1557aebeb..2417a0b8a 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -1307,6 +1307,7 @@ function configure(package, configs, opt) -- pass configurations local argv = {} for name, value in pairs(_get_configs(package, configs, opt)) do + local value = value value = tostring(value):trim() if type(name) == "number" then if value ~= "" then diff --git a/xmake/modules/package/tools/jom.lua b/xmake/modules/package/tools/jom.lua index e712ca8dd..26dbb014e 100644 --- a/xmake/modules/package/tools/jom.lua +++ b/xmake/modules/package/tools/jom.lua @@ -69,6 +69,7 @@ function build(package, configs, opt) end configs = table.join(jom_argv, configs) for name, value in pairs(configs) do + local value = value value = tostring(value):trim() if value ~= "" then if type(name) == "number" then diff --git a/xmake/modules/package/tools/make.lua b/xmake/modules/package/tools/make.lua index 485426119..f7f4f2dd7 100644 --- a/xmake/modules/package/tools/make.lua +++ b/xmake/modules/package/tools/make.lua @@ -138,6 +138,7 @@ function build(package, configs, opt) table.insert(argv, "V=1") end for name, value in pairs(configs) do + local value = value value = tostring(value):trim() if value ~= "" then if type(name) == "number" then diff --git a/xmake/modules/package/tools/meson.lua b/xmake/modules/package/tools/meson.lua index fbc6bbe77..010e410db 100644 --- a/xmake/modules/package/tools/meson.lua +++ b/xmake/modules/package/tools/meson.lua @@ -566,6 +566,7 @@ function generate(package, configs, opt) -- TODO: support more backends https://mesonbuild.com/Commands.html#setup local argv = {"setup"} for name, value in pairs(_get_configs(package, configs, opt)) do + local value = value value = tostring(value):trim() if value ~= "" then if type(name) == "number" then diff --git a/xmake/modules/package/tools/msbuild.lua b/xmake/modules/package/tools/msbuild.lua index 633ce4e14..6152560a2 100644 --- a/xmake/modules/package/tools/msbuild.lua +++ b/xmake/modules/package/tools/msbuild.lua @@ -95,6 +95,7 @@ function build(package, configs, opt) -- pass configurations local argv = {} for name, value in pairs(_get_configs(package, configs, opt)) do + local value = value value = tostring(value):trim() if value ~= "" then if type(name) == "number" then diff --git a/xmake/modules/package/tools/nmake.lua b/xmake/modules/package/tools/nmake.lua index 85182ac61..fe2b96956 100644 --- a/xmake/modules/package/tools/nmake.lua +++ b/xmake/modules/package/tools/nmake.lua @@ -57,6 +57,7 @@ function build(package, configs, opt) table.insert(argv, "VERBOSE=1") end for name, value in pairs(configs) do + local value = value value = tostring(value):trim() if value ~= "" then if type(name) == "number" then diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua index 4ff3c6239..3ccd09298 100644 --- a/xmake/modules/package/tools/xmake.lua +++ b/xmake/modules/package/tools/xmake.lua @@ -539,6 +539,7 @@ function install(package, configs, opt) table.insert(argv, "-y") table.insert(argv, "-c") for name, value in pairs(_get_configs(package, configs, opt)) do + local value = value value = tostring(value):trim() if type(name) == "number" then if value ~= "" then diff --git a/xmake/modules/private/action/require/impl/actions/download.lua b/xmake/modules/private/action/require/impl/actions/download.lua index 84c8d85be..f8a5e1584 100644 --- a/xmake/modules/private/action/require/impl/actions/download.lua +++ b/xmake/modules/private/action/require/impl/actions/download.lua @@ -346,6 +346,7 @@ function main(package, opt) local ok = false local urls_failed = {} for idx, url in ipairs(urls) do + local url = url local url_alias = package:url_alias(url) local url_excludes = package:url_excludes(url) local url_includes = package:url_includes(url) diff --git a/xmake/modules/private/action/require/impl/actions/install.lua b/xmake/modules/private/action/require/impl/actions/install.lua index 94f8007b3..206c2ae52 100644 --- a/xmake/modules/private/action/require/impl/actions/install.lua +++ b/xmake/modules/private/action/require/impl/actions/install.lua @@ -79,6 +79,7 @@ function _patch_pkgconfig(package) -- get libs local libs = "" for _, linkdir in ipairs(fetchinfo.linkdirs) do + local linkdir = linkdir linkdir = path.unix(path.normalize(linkdir)):replace(installdir, "${exec_prefix}", {plain = true}) if linkdir ~= "${exec_prefix}/lib" then libs = libs .. " -L" .. linkdir @@ -95,6 +96,7 @@ function _patch_pkgconfig(package) -- cflags local cflags = "" for _, includedir in ipairs(fetchinfo.includedirs or fetchinfo.sysincludedirs) do + local includedir = includedir includedir = path.unix(path.normalize(includedir)):replace(installdir, "${prefix}", {plain = true}) if includedir ~= "${prefix}/include" then cflags = cflags .. " -I" .. includedir diff --git a/xmake/modules/private/action/require/impl/install_packages.lua b/xmake/modules/private/action/require/impl/install_packages.lua index 359f9ac47..613afd5e8 100644 --- a/xmake/modules/private/action/require/impl/install_packages.lua +++ b/xmake/modules/private/action/require/impl/install_packages.lua @@ -152,6 +152,7 @@ function _get_confirm_from_3rd(packages) local confirmed_extpackages = {} if result and result ~= "n" then for _, idx in ipairs(result:split(',')) do + local idx = idx idx = tonumber(idx) if extpackages_list[idx] then table.insert(confirmed_extpackages, extpackages_list[idx]) diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua index 4e2d70e5f..53c3d627d 100644 --- a/xmake/modules/private/action/require/impl/package.lua +++ b/xmake/modules/private/action/require/impl/package.lua @@ -70,6 +70,7 @@ function _load_require(require_str, requires_extra, opt) packagename = packagename_raw local splitinfo = configs_str:split(",", {plain = true}) for _, v in ipairs(splitinfo) do + local v = v local parts = v:split("=", {plain = true}) local k = parts[1] v = parts[2] @@ -1216,6 +1217,7 @@ function _get_package_compatkey(dep) if configs then local configs_order = {} for k, v in pairs(configs) do + local v = v if type(v) == "table" then v = string.serialize(v, {strip = true, indent = false, orderkeys = true}) end @@ -1594,6 +1596,7 @@ function get_configs_str(package) local ignored_configs_for_buildhash = hashset.from(requireinfo.ignored_configs_for_buildhash or {}) local configs_overrided = requireinfo.configs_overrided or {} for k, v in pairs(requireinfo.configs) do + local v = v if not ignored_configs_for_buildhash:has(k) then v = configs_overrided[k] or v if type(v) == "boolean" then diff --git a/xmake/modules/private/action/require/impl/utils/requirekey.lua b/xmake/modules/private/action/require/impl/utils/requirekey.lua index 5fd228ecf..f86806490 100644 --- a/xmake/modules/private/action/require/impl/utils/requirekey.lua +++ b/xmake/modules/private/action/require/impl/utils/requirekey.lua @@ -66,6 +66,7 @@ function main(requireinfo, opt) if configs then local configs_order = {} for k, v in pairs(configs) do + local v = v if type(v) == "table" then v = string.serialize(v, {strip = true, indent = false, orderkeys = true}) end diff --git a/xmake/modules/private/action/require/info.lua b/xmake/modules/private/action/require/info.lua index f1be7a01b..84247d456 100644 --- a/xmake/modules/private/action/require/info.lua +++ b/xmake/modules/private/action/require/info.lua @@ -165,6 +165,7 @@ function main(requires_raw) cprint(" -> ${color.dump.string_quote}searchdirs${clear}: %s", table.concat(table.wrap(core_package.searchdirs()), path.envsep())) local searchnames = hashset.new() for _, url in ipairs(urls) do + local url = url url = filter.handle(url, instance) if git.checkurl(url) then searchnames:insert(instance:name() .. archive.extension(url) .. " ${dim}(git)${clear}") @@ -193,6 +194,7 @@ function main(requires_raw) local fetchinfo = instance:fetch() if fetchinfo then for name, info in pairs(fetchinfo) do + local info = info info = table.unwrap(info) if type(info) ~= "table" then info = tostring(info) diff --git a/xmake/modules/private/action/run/runenvs.lua b/xmake/modules/private/action/run/runenvs.lua index 43d150e66..32c6141fd 100644 --- a/xmake/modules/private/action/run/runenvs.lua +++ b/xmake/modules/private/action/run/runenvs.lua @@ -98,6 +98,7 @@ function _add_target_pkgenvs(addenvs, target, targets_added) local pkgenvs = target:pkgenvs() if pkgenvs then for name, values in pairs(pkgenvs) do + local values = values values = path.splitenv(values) local oldenvs = addenvs[name] if oldenvs then diff --git a/xmake/modules/private/async/jobpool.lua b/xmake/modules/private/async/jobpool.lua index 3d9bd7819..91c70cd78 100644 --- a/xmake/modules/private/async/jobpool.lua +++ b/xmake/modules/private/async/jobpool.lua @@ -269,6 +269,7 @@ function jobpool:_gentree(job, refs) -- strip tree local smalltree = hashset.new() for _, item in ipairs(tree) do + local item = item item = table.unwrap(item) if smalltree:size() < 16 or type(item) == "table" then smalltree:insert(item) diff --git a/xmake/modules/private/service/remote_build/filesync.lua b/xmake/modules/private/service/remote_build/filesync.lua index e984d3968..0bea69765 100644 --- a/xmake/modules/private/service/remote_build/filesync.lua +++ b/xmake/modules/private/service/remote_build/filesync.lua @@ -137,6 +137,7 @@ function filesync:_ignorefiles_load(ignorefiles) local gitroot = path.directory(gitignore_file) local gitignore = io.open(gitignore_file, "r") for line in gitignore:lines() do + local line = line line = line:trim() if #line > 0 and not line:startswith("#") then local filepath = path.join(gitroot, line) diff --git a/xmake/modules/private/utils/package.lua b/xmake/modules/private/utils/package.lua index 6df309f5f..c964c3ad3 100644 --- a/xmake/modules/private/utils/package.lua +++ b/xmake/modules/private/utils/package.lua @@ -22,6 +22,7 @@ function _concat_packages(a, b) local result = table.copy(a) for k, v in pairs(b) do + local v = v local o = result[k] if o ~= nil then v = table.join(o, v) @@ -29,6 +30,7 @@ function _concat_packages(a, b) result[k] = v end for k, v in pairs(result) do + local v = v if k == "links" or k == "syslinks" or k == "frameworks" or k == "ldflags" or k == "shflags" then if type(v) == "table" and #v > 1 then -- we need to ensure link orders when removing repeat values diff --git a/xmake/modules/private/utils/target.lua b/xmake/modules/private/utils/target.lua index 56fb6faeb..501916832 100644 --- a/xmake/modules/private/utils/target.lua +++ b/xmake/modules/private/utils/target.lua @@ -36,6 +36,7 @@ function has_tool(toolname, tools) trim_xx = true end for _, v in ipairs(tools) do + local v = v if trim_xx then v = v:rtrim("xx") end @@ -113,6 +114,7 @@ function translate_flags_in_tool(target, flagkind, flags) -- local result = {} for _, flag in ipairs(flags) do + local flag = flag flag = flag_belong_to_tool(flag, toolinst, extraconf) if flag then table.insert(result, flag) diff --git a/xmake/modules/private/utils/trim_trailing_spaces.lua b/xmake/modules/private/utils/trim_trailing_spaces.lua index a0279a261..5f879bb22 100644 --- a/xmake/modules/private/utils/trim_trailing_spaces.lua +++ b/xmake/modules/private/utils/trim_trailing_spaces.lua @@ -24,6 +24,7 @@ function main(pattern) if filedata then local filedata2 = {} for _, line in ipairs(filedata:split('\n', {strict = true})) do + local line = line line = line:rtrim() table.insert(filedata2, line) end diff --git a/xmake/modules/private/xrepo/action/env.lua b/xmake/modules/private/xrepo/action/env.lua index 2ba6068df..bff00d57a 100644 --- a/xmake/modules/private/xrepo/action/env.lua +++ b/xmake/modules/private/xrepo/action/env.lua @@ -149,6 +149,7 @@ function _get_boundenvs(opt) if bind then local envfiles = _get_envfiles() for _, binditem in ipairs(bind:split(',', {plain = true})) do + local binditem = binditem binditem = binditem:trim() if envfiles[binditem] then table.insert(files, envfiles[binditem]) diff --git a/xmake/modules/target/action/install/pkgconfig_importfiles.lua b/xmake/modules/target/action/install/pkgconfig_importfiles.lua index 9a9b8ee81..77b6a21ec 100644 --- a/xmake/modules/target/action/install/pkgconfig_importfiles.lua +++ b/xmake/modules/target/action/install/pkgconfig_importfiles.lua @@ -46,6 +46,7 @@ function main(target, opt) -- get libs local libs = "" for _, linkdir in ipairs(linkdirs) do + local linkdir = linkdir linkdir = path.unix(path.normalize(linkdir)):replace(installdir, "${exec_prefix}", {plain = true}) if linkdir ~= "${exec_prefix}/lib" then libs = libs .. " -L" .. linkdir @@ -62,6 +63,7 @@ function main(target, opt) -- get cflags local cflags = "" for _, includedir in ipairs(includedirs) do + local includedir = includedir includedir = path.unix(path.normalize(includedir)):replace(installdir, "${prefix}", {plain = true}) if includedir ~= "${prefix}/include" then cflags = cflags .. " -I" .. includedir diff --git a/xmake/modules/utils/binary/deplibs.lua b/xmake/modules/utils/binary/deplibs.lua index 1de8056fd..e1a9a776d 100644 --- a/xmake/modules/utils/binary/deplibs.lua +++ b/xmake/modules/utils/binary/deplibs.lua @@ -44,6 +44,7 @@ function _get_depends_by_dumpbin(binaryfile, opt) local result = try { function () return os.iorunv(dumpbin.program, {"/dependents", "/nologo", binaryfile}) end } if result then for _, line in ipairs(result:split("\n")) do + local line = line line = line:trim() if not line:startswith("Dump of file") and line:endswith(".dll") then depends = depends or {} @@ -71,6 +72,7 @@ function _get_depends_by_objdump(binaryfile, opt) local result = try { function () return os.iorunv(objdump.program, argv) end } if result then for _, line in ipairs(result:split("\n")) do + local line = line line = line:trim() if not line:endswith(":") then if plat == "windows" or plat == "mingw" then @@ -126,6 +128,7 @@ function _get_depends_by_ldd(binaryfile, opt) local result = try { function () return os.iorunv(ldd.program, {binaryfile}) end } if result then for _, line in ipairs(result:split("\n")) do + local line = line local splitinfo = line:split("=>") line = splitinfo[2] if not line or line:find("not found", 1, true) then @@ -202,6 +205,7 @@ function _get_depends_by_otool(binaryfile, opt) local result = try { function () return os.iorunv(otool.program, {"-L", binaryfile}) end } if result then for _, line in ipairs(result:split("\n")) do + local line = line line = line:trim() if not line:endswith(":") then local filename = line:match(".-%.dylib") or line:match(".-%.framework") @@ -344,6 +348,7 @@ function _get_plain_depends(binaryfile, opt) if depends and opt.resolve_path then local result = {} for _, dependfile in ipairs(depends) do + local dependfile = dependfile dependfile = _resolve_filepath(binaryfile, dependfile, opt) if dependfile then table.insert(result, dependfile) diff --git a/xmake/modules/utils/binary/rpath.lua b/xmake/modules/utils/binary/rpath.lua index 33cab5a43..6ee17e98d 100644 --- a/xmake/modules/utils/binary/rpath.lua +++ b/xmake/modules/utils/binary/rpath.lua @@ -55,6 +55,7 @@ function _get_rpath_list_by_objdump(binaryfile, opt) if result then local cmd = false for _, line in ipairs(result:split("\n")) do + local line = line line = line:trim() if plat == "macosx" or plat == "iphoneos" or plat == "appletvos" or plat == "watchos" then if not cmd and line:find("cmd LC_RPATH", 1, true) then diff --git a/xmake/modules/utils/run_script.lua b/xmake/modules/utils/run_script.lua index e6f8469f6..057ea57cd 100644 --- a/xmake/modules/utils/run_script.lua +++ b/xmake/modules/utils/run_script.lua @@ -191,6 +191,7 @@ function main(script, opt) if opt.thread then local argv for _, arg in ipairs(opt.arguments) do + local arg = arg argv = argv or {} if path.instance_of(arg) then arg = tostring(arg) |
