diff options
| author | ruki <[email protected]> | 2026-04-01 21:02:03 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-04-01 21:02:03 +0800 |
| commit | 39fd35ea9d5d14079e4669b85423d488c9097cd4 (patch) | |
| tree | 7d4452174422931fe8a56f49b2d349b4b7cc90b3 /xmake/rules | |
| parent | 75b084fa57f2fe00f369d9cac3878c03da43a68a (diff) | |
| parent | c63ac2d50545f2f58872c5be9a46d8fb5b3e8016 (diff) | |
Merge pull request #7437 from xmake-io/lua55
update to lua5.5
Diffstat (limited to 'xmake/rules')
| -rw-r--r-- | xmake/rules/c++/modules/builder.lua | 4 | ||||
| -rw-r--r-- | xmake/rules/c++/modules/clang/builder.lua | 1 | ||||
| -rw-r--r-- | xmake/rules/c++/modules/clang/support.lua | 4 | ||||
| -rw-r--r-- | xmake/rules/c++/modules/gcc/support.lua | 4 | ||||
| -rw-r--r-- | xmake/rules/c++/modules/msvc/builder.lua | 1 | ||||
| -rw-r--r-- | xmake/rules/c++/unity_build/unity_build.lua | 2 | ||||
| -rw-r--r-- | xmake/rules/nim/build/target.lua | 2 | ||||
| -rw-r--r-- | xmake/rules/platform/linux/module/driver_modules.lua | 4 | ||||
| -rw-r--r-- | xmake/rules/qt/load.lua | 1 | ||||
| -rw-r--r-- | xmake/rules/qt/moc/xmake.lua | 1 | ||||
| -rw-r--r-- | xmake/rules/swift/xmake.lua | 1 | ||||
| -rw-r--r-- | xmake/rules/utils/symbols/export_all/export_all.lua | 2 | ||||
| -rw-r--r-- | xmake/rules/utils/symbols/export_list/xmake.lua | 1 | ||||
| -rw-r--r-- | xmake/rules/verilator/verilator.lua | 3 | ||||
| -rw-r--r-- | xmake/rules/wdk/load.lua | 3 | ||||
| -rw-r--r-- | xmake/rules/winsdk/mfc/mfc.lua | 2 | ||||
| -rw-r--r-- | xmake/rules/xcode/application/run.lua | 1 |
17 files changed, 27 insertions, 10 deletions
diff --git a/xmake/rules/c++/modules/builder.lua b/xmake/rules/c++/modules/builder.lua index 761b2cf6c..6d82cca0b 100644 --- a/xmake/rules/c++/modules/builder.lua +++ b/xmake/rules/c++/modules/builder.lua @@ -91,6 +91,7 @@ function _get_jobdeps(target, module, jobgraph, buildfilejob) local jobdeps = {} local moduletype = support.has_two_phase_compilation_support(target) and "bmi" or "onephase" for dep_name, dep in pairs(module.deps) do + local dep_name = dep_name if dep.headerunit then dep_name = dep_name .. dep.key end @@ -347,6 +348,7 @@ function build_modules_for_batchjobs(target, batchjobs, built_modules, opt) local jobs local moduletype = has_two_phase_compilation_support and "bmi" or "onephase" for _, sourcefile in ipairs(_built_modules) do + local sourcefile = sourcefile jobs = jobs or {} local bmionly = support.is_bmionly(target, sourcefile) local module = mapper.get(target, sourcefile) @@ -354,6 +356,7 @@ function build_modules_for_batchjobs(target, batchjobs, built_modules, opt) local buildfilejob = _get_module_buildfilejob_for(target, sourcefile, moduletype) local deps = {} for dep_name, dep in pairs(module.deps) do + local dep_name = dep_name if dep.headerunit then dep_name = dep_name .. dep.key end @@ -409,6 +412,7 @@ function build_objectfiles_for_batchjobs(target, batchjobs, built_modules, opt) local jobs for _, sourcefile in ipairs(_built_modules) do + local sourcefile = sourcefile if not support.is_bmionly(target, sourcefile) then jobs = jobs or {} local module = mapper.get(target, sourcefile) diff --git a/xmake/rules/c++/modules/clang/builder.lua b/xmake/rules/c++/modules/clang/builder.lua index 60f2186e5..4839733e0 100644 --- a/xmake/rules/c++/modules/clang/builder.lua +++ b/xmake/rules/c++/modules/clang/builder.lua @@ -234,6 +234,7 @@ function _get_requiresflags(target, module) if not requiresflags or requires_changed then requiresflags = {} for required, dep in table.orderpairs(module.deps) do + local required = required if dep.headerunit then required = required .. dep.key end diff --git a/xmake/rules/c++/modules/clang/support.lua b/xmake/rules/c++/modules/clang/support.lua index 4bf5832a6..b1699d21a 100644 --- a/xmake/rules/c++/modules/clang/support.lua +++ b/xmake/rules/c++/modules/clang/support.lua @@ -49,7 +49,7 @@ function _get_toolchain_includedirs_for_stlheaders(target, includedirs, clang) local result = try {function () return os.iorunv(clang, argv, {envs = compinst:runenvs()}) end} if result then for _, line in ipairs(result:split("\n", {plain = true})) do - line = line:trim() + local line = line:trim() if line:startswith("#") and line:find("/vector\"", 1, true) then local includedir = line:match("\"(.+)/vector\"") if includedir and os.isdir(includedir) then @@ -164,7 +164,7 @@ function toolchain_includedirs(target) local _, result = try {function () return os.iorunv(clang, table.join({"-E", "-Wp,-v", "-xc++", os.nuldev()}, runtime_flag or {})) end} if result then for _, line in ipairs(result:split("\n", {plain = true})) do - line = line:trim() + local line = line:trim() if os.isdir(line) then table.insert(includedirs, path.normalize(line)) elseif line:startswith("End") then diff --git a/xmake/rules/c++/modules/gcc/support.lua b/xmake/rules/c++/modules/gcc/support.lua index 4de7d6eab..1204d207d 100644 --- a/xmake/rules/c++/modules/gcc/support.lua +++ b/xmake/rules/c++/modules/gcc/support.lua @@ -38,7 +38,7 @@ function _get_toolchain_includedirs_for_stlheaders(includedirs, gcc) local result = try {function () return os.iorunv(gcc, {"-E", "-x", "c++", tmpfile}) end} if result then for _, line in ipairs(result:split("\n", {plain = true})) do - line = line:trim() + local line = line:trim() if line:startswith("#") and line:find("/vector\"", 1, true) then local includedir = line:match("\"(.+)/vector\"") if includedir and os.isdir(includedir) then @@ -114,7 +114,7 @@ function toolchain_includedirs(target) local _, result = try {function () return os.iorunv(gcc, {"-E", "-Wp,-v", "-xc", os.nuldev()}) end} if result then for _, line in ipairs(result:split("\n", {plain = true})) do - line = line:trim() + local line = line:trim() if os.isdir(line) then table.insert(includedirs, path.normalize(line)) elseif line:startswith("End") then diff --git a/xmake/rules/c++/modules/msvc/builder.lua b/xmake/rules/c++/modules/msvc/builder.lua index b59115477..46496609c 100644 --- a/xmake/rules/c++/modules/msvc/builder.lua +++ b/xmake/rules/c++/modules/msvc/builder.lua @@ -189,6 +189,7 @@ function _get_requiresflags(target, module) if not requiresflags or requires_changed then local deps_flags = {} for required, dep in pairs(module.deps) do + local required = required if dep.headerunit then required = required .. dep.key end diff --git a/xmake/rules/c++/unity_build/unity_build.lua b/xmake/rules/c++/unity_build/unity_build.lua index d5f5b060c..bf5ee55b3 100644 --- a/xmake/rules/c++/unity_build/unity_build.lua +++ b/xmake/rules/c++/unity_build/unity_build.lua @@ -32,7 +32,7 @@ function _merge_unityfile(target, sourcefile_unity, sourcefiles, opt) local uniqueid = target:data("unity_build.uniqueid") local unityfile = io.open(sourcefile_unity, "w") for _, sourcefile in ipairs(sourcefiles) do - sourcefile = path.absolute(sourcefile) + local sourcefile = path.absolute(sourcefile) sourcefile_unity = path.absolute(sourcefile_unity) sourcefile = path.relative(sourcefile, path.directory(sourcefile_unity)) if uniqueid then diff --git a/xmake/rules/nim/build/target.lua b/xmake/rules/nim/build/target.lua index 52599b74d..6fe58be80 100644 --- a/xmake/rules/nim/build/target.lua +++ b/xmake/rules/nim/build/target.lua @@ -53,7 +53,7 @@ function _generate_dependinfo(compinst, compflags, sourcefiles, dependinfo) local depsdata = io.readfile(depsfile) if depsdata then for _, line in ipairs(depsdata:split("\n")) do - line = line:trim() + local line = line:trim() if #line > 0 then table.insert(dependinfo.files, line) end diff --git a/xmake/rules/platform/linux/module/driver_modules.lua b/xmake/rules/platform/linux/module/driver_modules.lua index 689e3d0c7..e7a0dda49 100644 --- a/xmake/rules/platform/linux/module/driver_modules.lua +++ b/xmake/rules/platform/linux/module/driver_modules.lua @@ -117,10 +117,11 @@ module_exit(hello_exit); if result then -- we can also split ';' for the muliple commands for _, line in ipairs(result:split("[\n;]")) do - line = line:trim() + local line = line:trim() if line:endswith("stub.c") then local include_cflag = false for _, cflag in ipairs(line:split("%s+")) do + local cflag = cflag local has_cflag = false if cflag:startswith("-fplugin=") then -- @see https://github.com/xmake-io/xmake/issues/3279 @@ -172,6 +173,7 @@ module_exit(hello_exit); if ldflags then local ko = ldflags:find("-T ", 1, true) for _, ldflag in ipairs(os.argv(ldflags)) do + local ldflag = ldflag if ldflag:endswith(".lds") then if not path.is_absolute(ldflag) then ldflag = path.absolute(ldflag, builddir or sdkdir) diff --git a/xmake/rules/qt/load.lua b/xmake/rules/qt/load.lua index dff70f52e..6b362e306 100644 --- a/xmake/rules/qt/load.lua +++ b/xmake/rules/qt/load.lua @@ -180,6 +180,7 @@ function _add_qmakeprllibs(target, prlfile, qt) end if envs.QMAKE_PRL_LIBS_FOR_CMAKE then for _, lib in ipairs(envs.QMAKE_PRL_LIBS_FOR_CMAKE:split(';', {plain = true})) do + local lib = lib if lib:startswith("-L") then local libdir = lib:sub(3) target:add("linkdirs", libdir) diff --git a/xmake/rules/qt/moc/xmake.lua b/xmake/rules/qt/moc/xmake.lua index dfd194ffe..509770576 100644 --- a/xmake/rules/qt/moc/xmake.lua +++ b/xmake/rules/qt/moc/xmake.lua @@ -87,6 +87,7 @@ rule("qt.moc") } for _, pathmap in ipairs(pathmaps) do for _, item in ipairs(_get_values_from_target(target, pathmap[1])) do + local item = item local pathitem = path(item, function (p) local item = table.unwrap(compiler.map_flags("cxx", pathmap[2], p)) if item then diff --git a/xmake/rules/swift/xmake.lua b/xmake/rules/swift/xmake.lua index e124865f2..0e8821c63 100644 --- a/xmake/rules/swift/xmake.lua +++ b/xmake/rules/swift/xmake.lua @@ -80,6 +80,7 @@ rule("swift.interop") if cpp_langflags == nil then local languages = target:get("languages") for _, language in ipairs(languages) do + local language = language if language:startswith("c++") or language:startswith("cxx") or language:startswith("gnu++") diff --git a/xmake/rules/utils/symbols/export_all/export_all.lua b/xmake/rules/utils/symbols/export_all/export_all.lua index 851450371..8c3a5b241 100644 --- a/xmake/rules/utils/symbols/export_all/export_all.lua +++ b/xmake/rules/utils/symbols/export_all/export_all.lua @@ -90,6 +90,7 @@ function _get_allsymbols_by_dumpbin(target, dumpbin, opt) _get_sourcefiles_map(target, sourcefiles_map) end for _, objectfile in ipairs(target:objectfiles()) do + local objectfile = objectfile local objectsymbols = try { function () return os.iorunv(dumpbin, {"/symbols", "/nologo", objectfile}) end } if objectsymbols then local sourcefile = sourcefiles_map[objectfile] @@ -125,6 +126,7 @@ function _get_allsymbols_by_objdump(target, objdump, opt) _get_sourcefiles_map(target, sourcefiles_map) end for _, objectfile in ipairs(target:objectfiles()) do + local objectfile = objectfile local objectsymbols = try { function () return os.iorunv(objdump, {"--syms", objectfile}) end } if objectsymbols then local sourcefile = sourcefiles_map[objectfile] diff --git a/xmake/rules/utils/symbols/export_list/xmake.lua b/xmake/rules/utils/symbols/export_list/xmake.lua index 84878fe7b..6759ee3ec 100644 --- a/xmake/rules/utils/symbols/export_list/xmake.lua +++ b/xmake/rules/utils/symbols/export_list/xmake.lua @@ -115,6 +115,7 @@ rule("utils.symbols.export_list") elseif exportkind == "apple" then local file = io.open(exportfile_tmp, 'w') for _, symbol in ipairs(exportsymbols) do + local symbol = symbol if not symbol:startswith("_") then symbol = "_" .. symbol end diff --git a/xmake/rules/verilator/verilator.lua b/xmake/rules/verilator/verilator.lua index 25ee1968f..e1535ecd8 100644 --- a/xmake/rules/verilator/verilator.lua +++ b/xmake/rules/verilator/verilator.lua @@ -40,7 +40,7 @@ function _get_sourcefiles_from_cmake(target, cmakefile) -- get global class source files -- set(hello_GLOBAL "${VERILATOR_ROOT}/include/verilated.cpp" "${VERILATOR_ROOT}/include/verilated_threads.cpp") for classfile in values:gmatch("\"(.-)\"") do - classfile = classfile:gsub("%${VERILATOR_ROOT}", verilator_root) + local classfile = classfile:gsub("%${VERILATOR_ROOT}", verilator_root) if os.isfile(classfile) then table.insert(global_classes, classfile) end @@ -312,6 +312,7 @@ function build_cppfiles(target, jobgraph, sourcebatch, opt) end local sourcefiles = sourcebatch.sourcefiles for _, sourcefile in ipairs(sourcefiles) do + local sourcefile = sourcefile progress.show(opt.progress or 0, "${color.build.object}compiling.verilog %s", sourcefile) -- we need to use slashes to fix it on windows -- @see https://github.com/verilator/verilator/issues/3873 diff --git a/xmake/rules/wdk/load.lua b/xmake/rules/wdk/load.lua index 637ea9f80..4943340d7 100644 --- a/xmake/rules/wdk/load.lua +++ b/xmake/rules/wdk/load.lua @@ -62,7 +62,7 @@ function driver_umdf(target) -- set default driver entry if does not exist local entry = false for _, ldflag in ipairs(target:get("shflags")) do - ldflag = ldflag:lower() + local ldflag = ldflag:lower() if ldflag:find("[/%-]entry:") then entry = true break @@ -111,6 +111,7 @@ function _kernel_driver_base(target, default_entrypoint) -- set default driver entry if does not exist local has_entry = false for _, ldflag in ipairs(target:get("ldflags")) do + local ldflag = ldflag if type(ldflag) == "string" then ldflag = ldflag:lower() if ldflag:find("[/%-]entry:") then diff --git a/xmake/rules/winsdk/mfc/mfc.lua b/xmake/rules/winsdk/mfc/mfc.lua index 671d74f2d..5bcd41072 100644 --- a/xmake/rules/winsdk/mfc/mfc.lua +++ b/xmake/rules/winsdk/mfc/mfc.lua @@ -107,7 +107,7 @@ function application(target, mfc_kind) -- set startup entry local unicode = false for _, define in ipairs(target:get("defines")) do - define = define:lower():trim() + local define = define:lower():trim() if define:find("^[_]?unicode$") then unicode = true break diff --git a/xmake/rules/xcode/application/run.lua b/xmake/rules/xcode/application/run.lua index 249558ffc..7debb8fc4 100644 --- a/xmake/rules/xcode/application/run.lua +++ b/xmake/rules/xcode/application/run.lua @@ -61,6 +61,7 @@ function _run_on_simulator(target, opt) -- find the booted devices local name, deviceid for _, line in ipairs(list:split('\n', {plain = true})) do + local line = line if line:find("(Booted)", 1, true) then line = line:trim() name, deviceid = line:match("(.-)%s+%(([%w%-]+)%)") |
