diff options
| author | ruki <[email protected]> | 2025-09-11 14:31:18 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-09-11 14:31:18 +0800 |
| commit | c74b86b5306b7069931394971f18ee299094f57f (patch) | |
| tree | 311fcad5eb044acfc1579fa32af871bf0b9698a9 | |
| parent | 9ac44c13a82a49abfd37e425b967efebbbb9ab7c (diff) | |
| parent | 95892966e3e0c9a6b5c427ef52662088e7ae2def (diff) | |
Merge pull request #6784 from xmake-io/opti
Continue to optimize building targets speed
54 files changed, 54 insertions, 88 deletions
diff --git a/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x/has_flags.lua b/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x/has_flags.lua index bb2d955a5..629f25c12 100644 --- a/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x/has_flags.lua +++ b/tests/apis/custom_toolchain/xmake/modules/core/tools/cl6x/has_flags.lua @@ -60,7 +60,6 @@ function _check_from_arglist(flags, opt, islinker) end end detectcache:set2(key, flagskey, allflags) - detectcache:save() end local flag = flags[1] return allflags[flag] diff --git a/tests/benchmarks/build_targets/test.lua b/tests/benchmarks/build_targets/test.lua index 1804dd59c..ec9f1bcf1 100644 --- a/tests/benchmarks/build_targets/test.lua +++ b/tests/benchmarks/build_targets/test.lua @@ -7,10 +7,13 @@ function test_build(t) return end + local jobs = tostring(os.default_njob()) + -- xmake os.tryrm("build") + os.tryrm(".xmake") local xmake_dt = os.mclock() - os.run("xmake") + os.runv("xmake", {"-j" .. jobs}) xmake_dt = os.mclock() - xmake_dt print("build targets/30: xmake: %d ms", xmake_dt) @@ -21,10 +24,10 @@ function test_build(t) os.mkdir("build") local cmake_default_dt = os.mclock() os.runv(cmake.program, {".."}, {curdir = "build"}) - os.runv(cmake.program, {"--build", "."}, {curdir = "build"}) + os.runv(cmake.program, {"--build", ".", "-j" .. jobs}, {curdir = "build"}) cmake_default_dt = os.mclock() - cmake_default_dt print("build targets/30: cmake/default: %d ms", cmake_default_dt) - --t:require((cmake_default_dt > xmake_dt) or (cmake_default_dt + 2000 > xmake_dt)) + t:require((cmake_default_dt > xmake_dt) or (cmake_default_dt + 2000 > xmake_dt)) local ninja = find_tool("ninja") if ninja then @@ -43,11 +46,10 @@ function test_build(t) end local cmake_ninja_dt = os.mclock() os.runv(cmake.program, table.join("..", "-G", "Ninja", configs), {curdir = "build", envs = envs}) - os.runv(cmake.program, {"--build", "."}, {curdir = "build", envs = envs}) + os.runv(cmake.program, {"--build", ".", "-j" .. jobs}, {curdir = "build", envs = envs}) cmake_ninja_dt = os.mclock() - cmake_ninja_dt print("build targets/30: cmake/ninja: %d ms", cmake_ninja_dt) - -- TODO we need to improve it - --t:require((cmake_ninja_dt > xmake_dt) or (cmake_ninja_dt + 2000 > xmake_dt)) + t:require((cmake_ninja_dt > xmake_dt) or (cmake_ninja_dt + 2000 > xmake_dt)) end local make = find_tool("make") @@ -56,7 +58,7 @@ function test_build(t) os.mkdir("build") local cmake_makefile_dt = os.mclock() os.runv(cmake.program, {"..", "-G", "Unix Makefiles"}, {curdir = "build"}) - os.runv(cmake.program, {"--build", "."}, {curdir = "build"}) + os.runv(cmake.program, {"--build", ".", "-j" .. jobs}, {curdir = "build"}) cmake_makefile_dt = os.mclock() - cmake_makefile_dt print("build targets/30: cmake/makefile: %d ms", cmake_makefile_dt) t:require((cmake_makefile_dt > xmake_dt) or (cmake_makefile_dt + 2000 > xmake_dt)) @@ -67,12 +69,19 @@ function test_build(t) local meson = find_tool("meson") if meson then os.tryrm("build") - local meson_dt = os.mclock() + local meson_setup_dt = os.mclock() os.runv(meson.program, {"setup", "build"}) - os.runv(meson.program, {"compile", "-C", "build"}) - meson_dt = os.mclock() - meson_dt + meson_setup_dt = os.mclock() - meson_setup_dt + + -- ccache will cache object files globally, which may affect the results of the second run. + io.replace("build/build.ninja", "ccache", "") + + local meson_build_dt = os.mclock() + os.runv(meson.program, {"compile", "-j", jobs, "-C", "build"}) + meson_build_dt = os.mclock() - meson_build_dt + local meson_dt = meson_setup_dt + meson_build_dt print("build targets/30: meson: %d ms", meson_dt) - --t:require((meson_dt > xmake_dt) or (meson_dt + 2000 > xmake_dt)) + t:require((meson_dt > xmake_dt) or (meson_dt + 2000 > xmake_dt)) end end diff --git a/tests/benchmarks/config_targets/test.lua b/tests/benchmarks/config_targets/test.lua index 983f7f952..d5eb8b227 100644 --- a/tests/benchmarks/config_targets/test.lua +++ b/tests/benchmarks/config_targets/test.lua @@ -9,6 +9,7 @@ function test_config(t) -- xmake os.tryrm("build") + os.tryrm(".xmake") local xmake_dt = os.mclock() os.runv("xmake", {"config", "-c"}) xmake_dt = os.mclock() - xmake_dt diff --git a/xmake/actions/build/main.lua b/xmake/actions/build/main.lua index 8560cb1bd..c0d3761df 100644 --- a/xmake/actions/build/main.lua +++ b/xmake/actions/build/main.lua @@ -23,6 +23,7 @@ import("core.base.option") import("core.base.global") import("core.base.task") import("core.tool.toolchain") +import("core.cache.detectcache") import("core.project.rule") import("core.project.config") import("core.project.project") @@ -130,6 +131,9 @@ function build_targets(targetnames, opt) -- save toolchain configs toolchain.save() + -- save detect cache + detectcache:save() + -- dump cache stats if option.get("diagnosis") then build_cache.dump_stats() @@ -148,6 +152,9 @@ function build_targets(targetnames, opt) -- save toolchain configs toolchain.save() + -- save detect cache + detectcache:save() + -- raise if errors then raise(errors) diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua index 9a03c2992..8f6640881 100644 --- a/xmake/actions/config/main.lua +++ b/xmake/actions/config/main.lua @@ -28,6 +28,7 @@ import("core.project.project") import("core.platform.platform") import("private.detect.find_platform") import("core.cache.localcache") +import("core.cache.detectcache") import("scangen") import("menuconf", {alias = "menuconf_show"}) import("configfiles", {alias = "generate_configfiles"}) @@ -448,6 +449,9 @@ force to build in current directory via run `xmake -P .`]], os.projectdir()) -- save toolchain cache toolchain.save() + -- save detect cache + detectcache:save() + -- unlock the whole project project.unlock() end 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 b0c65071a..68fbc59ae 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua @@ -338,7 +338,6 @@ function sandbox_lib_detect_find_program.main(name, opt) -- cache result detectcache:set2(cachekey, name, result and result or false) - detectcache:save() -- trace if option.get("verbose") or opt.verbose then diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_programver.lua b/xmake/core/sandbox/modules/import/lib/detect/find_programver.lua index 45dd4488b..0d76526e5 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_programver.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_programver.lua @@ -109,7 +109,6 @@ function sandbox_lib_detect_find_programver.main(program, opt) -- save result detectcache:set2(cachekey, program, result and result or false) - detectcache:save() scheduler.co_unlock(lockname) return result end diff --git a/xmake/core/tool/compiler.lua b/xmake/core/tool/compiler.lua index 541a172b6..e78710a8d 100644 --- a/xmake/core/tool/compiler.lua +++ b/xmake/core/tool/compiler.lua @@ -122,17 +122,18 @@ function compiler.load(sourcekind, target) return nil, "unknown source kind!" end - -- load compiler tool first (with cache) - local compiler_tool, program_or_errors = compiler._load_tool(sourcekind, target) - if not compiler_tool then - return nil, program_or_errors - end - -- init cache key -- @note we need plat/arch, -- because it is possible for the compiler to do cross-compilation with the -target parameter - local plat = compiler_tool:plat() or config.plat() or os.host() - local arch = compiler_tool:arch() or config.arch() or os.arch() + local plat = config.plat() or os.host() + local arch = config.arch() or os.arch() + if target and target.tool then + local _, _, toolchain_info = target:tool(sourcekind) + if toolchain_info then + plat = toolchain_info.plat + arch = toolchain_info.arch + end + end local cachekey = sourcekind .. (program_or_errors or "") .. plat .. arch if target then cachekey = cachekey .. tostring(target) @@ -143,6 +144,13 @@ function compiler.load(sourcekind, target) local instance = compiler._INSTANCES[cachekey] if not instance then instance = table.inherit(compiler, builder) + + -- load compiler tool + -- @NOTE We cannot cache the tool, otherwise it may cause duplicate toolchain flags to be added + local compiler_tool, program_or_errors = compiler._load_tool(sourcekind, target) + if not compiler_tool then + return nil, program_or_errors + end instance._TOOL = compiler_tool -- load the compiler language from the source kind @@ -188,7 +196,7 @@ function compiler.load(sourcekind, target) -- we need to load it at the end because in tool.load(). -- because we may need to call has_flags, which requires the full platform toolchain flags - local ok, errors = compiler_tool:_load_once() + local ok, errors = instance:_tool():_load_once() if not ok then return nil, errors end diff --git a/xmake/core/tool/linker.lua b/xmake/core/tool/linker.lua index 821dfe40d..c34f578df 100644 --- a/xmake/core/tool/linker.lua +++ b/xmake/core/tool/linker.lua @@ -130,7 +130,8 @@ function linker.load(targetkind, sourcekinds, target) end end - -- load linker tool first (with cache) + -- load linker tool first, we need to get the correct plat/arch + -- @NOTE We cannot cache the tool, otherwise it may cause duplicate toolchain flags to be added local linkertool, linkerinfo_or_errors = linker._load_tool(targetkind, sourcekinds, target) if not linkertool then return nil, linkerinfo_or_errors @@ -218,7 +219,7 @@ function linker.load(targetkind, sourcekinds, target) -- we need to load it at the end because in tool.load(). -- because we may need to call has_flags, which requires the full platform toolchain flags - local ok, errors = linkertool:_load_once() + local ok, errors = instance:_tool():_load_once() if not ok then return nil, errors end diff --git a/xmake/core/tool/tool.lua b/xmake/core/tool/tool.lua index 06a5ca3ad..c54e24c93 100644 --- a/xmake/core/tool/tool.lua +++ b/xmake/core/tool/tool.lua @@ -241,22 +241,8 @@ function tool.load(kind, opt) local toolchain_info = opt.toolchain_info or {} -- get platform and architecture - local plat = toolchain_info.plat or config.get("plat") or os.host() - local arch = toolchain_info.arch or config.get("arch") or os.arch() - - -- init cachekey - local cachekey = kind .. (program or "") .. plat .. arch .. (opt.host and "host" or "") - if toolchain_info and toolchain_info.cachekey then - -- it maybe contains target key - -- @see https://github.com/xmake-io/xmake/issues/6672 - cachekey = cachekey .. toolchain_info.cachekey - end - - -- get it directly from cache dirst - tool._TOOLS = tool._TOOLS or {} - if tool._TOOLS[cachekey] then - return tool._TOOLS[cachekey] - end + local plat = toolchain_info.plat or config.plat() or os.host() + local arch = toolchain_info.arch or config.arch() or os.arch() -- contain toolname? parse it, e.g. '[email protected]' if program then @@ -310,7 +296,6 @@ function tool.load(kind, opt) if not instance then return nil, errors end - tool._TOOLS[cachekey] = instance return instance end diff --git a/xmake/modules/core/tools/ar/has_flags.lua b/xmake/modules/core/tools/ar/has_flags.lua index b716e5080..e02a14b52 100644 --- a/xmake/modules/core/tools/ar/has_flags.lua +++ b/xmake/modules/core/tools/ar/has_flags.lua @@ -63,10 +63,7 @@ function _check_from_arglist(flags, opt) -- save cache detectcache:set2(key, flagskey, allflags) - detectcache:save() end - - -- ok? return allflags[flags[1]] end diff --git a/xmake/modules/core/tools/armasm_msvc/has_flags.lua b/xmake/modules/core/tools/armasm_msvc/has_flags.lua index 67f72e647..938100a0c 100644 --- a/xmake/modules/core/tools/armasm_msvc/has_flags.lua +++ b/xmake/modules/core/tools/armasm_msvc/has_flags.lua @@ -50,7 +50,6 @@ function _check_from_arglist(flags, opt) -- save cache detectcache:set2(key, flagskey, allflags) - detectcache:save() end return allflags[flags[1]:gsub("/", "-")] end diff --git a/xmake/modules/core/tools/armclang/has_flags.lua b/xmake/modules/core/tools/armclang/has_flags.lua index 988393ff8..43e246f36 100644 --- a/xmake/modules/core/tools/armclang/has_flags.lua +++ b/xmake/modules/core/tools/armclang/has_flags.lua @@ -67,7 +67,6 @@ function _check_from_arglist(flags, opt, islinker) end end detectcache:set2(key, flagskey, allflags) - detectcache:save() end local flag = flags[1] if islinker and flag then diff --git a/xmake/modules/core/tools/cl/parse_include.lua b/xmake/modules/core/tools/cl/parse_include.lua index 961ffca95..e53163e8f 100644 --- a/xmake/modules/core/tools/cl/parse_include.lua +++ b/xmake/modules/core/tools/cl/parse_include.lua @@ -60,7 +60,6 @@ function probe_include_note_from_cl() os.tryrm(projectdir) end detectcache:set(key, note) - detectcache:save() end return note end diff --git a/xmake/modules/core/tools/cl6x/has_flags.lua b/xmake/modules/core/tools/cl6x/has_flags.lua index bb2d955a5..629f25c12 100644 --- a/xmake/modules/core/tools/cl6x/has_flags.lua +++ b/xmake/modules/core/tools/cl6x/has_flags.lua @@ -60,7 +60,6 @@ function _check_from_arglist(flags, opt, islinker) end end detectcache:set2(key, flagskey, allflags) - detectcache:save() end local flag = flags[1] return allflags[flag] diff --git a/xmake/modules/core/tools/clang_cl/has_flags.lua b/xmake/modules/core/tools/clang_cl/has_flags.lua index 9dda7f5fb..2f92a8a37 100644 --- a/xmake/modules/core/tools/clang_cl/has_flags.lua +++ b/xmake/modules/core/tools/clang_cl/has_flags.lua @@ -51,7 +51,6 @@ function _check_from_arglist(flags, opt) -- save cache detectcache:set2(key, flagskey, allflags) - detectcache:save() end return allflags[flags[1]:gsub("/", "-")] end diff --git a/xmake/modules/core/tools/cosmocc/has_flags.lua b/xmake/modules/core/tools/cosmocc/has_flags.lua index b3a788a44..589c1fdc0 100644 --- a/xmake/modules/core/tools/cosmocc/has_flags.lua +++ b/xmake/modules/core/tools/cosmocc/has_flags.lua @@ -71,7 +71,6 @@ function _check_from_arglist(flags, opt, islinker) end end detectcache:set2(key, flagskey, allflags) - detectcache:save() end local flag = flags[1] if islinker and flag then diff --git a/xmake/modules/core/tools/dmd/has_flags.lua b/xmake/modules/core/tools/dmd/has_flags.lua index c2694e3ce..184a70c7f 100644 --- a/xmake/modules/core/tools/dmd/has_flags.lua +++ b/xmake/modules/core/tools/dmd/has_flags.lua @@ -72,7 +72,6 @@ function _check_from_arglist(flags, opt, islinker) -- save cache detectcache:set2(key, flagskey, allflags) - detectcache:save() end return allflags[flags[1]] end diff --git a/xmake/modules/core/tools/fpc/has_flags.lua b/xmake/modules/core/tools/fpc/has_flags.lua index 4a5e29a5a..4d197337a 100644 --- a/xmake/modules/core/tools/fpc/has_flags.lua +++ b/xmake/modules/core/tools/fpc/has_flags.lua @@ -58,7 +58,6 @@ function _check_from_arglist(flags, opt) -- save cache detectcache:set2(key, flagskey, allflags) - detectcache:save() end return allflags[flags[1]] end diff --git a/xmake/modules/core/tools/gcc/has_flags.lua b/xmake/modules/core/tools/gcc/has_flags.lua index 693ce4381..731e5da2f 100644 --- a/xmake/modules/core/tools/gcc/has_flags.lua +++ b/xmake/modules/core/tools/gcc/has_flags.lua @@ -68,7 +68,6 @@ function _check_from_arglist(flags, opt, islinker) end end detectcache:set2(key, flagskey, allflags) - detectcache:save() end local flag = flags[1] if islinker and flag then diff --git a/xmake/modules/core/tools/gdc/has_flags.lua b/xmake/modules/core/tools/gdc/has_flags.lua index 3568defcc..e21fb5804 100644 --- a/xmake/modules/core/tools/gdc/has_flags.lua +++ b/xmake/modules/core/tools/gdc/has_flags.lua @@ -71,7 +71,6 @@ function _check_from_arglist(flags, opt, islinker) -- save cache detectcache:set2(key, flagskey, allflags) - detectcache:save() end return allflags[flags[1]] end diff --git a/xmake/modules/core/tools/gfortran/has_flags.lua b/xmake/modules/core/tools/gfortran/has_flags.lua index c570cdbbd..d01334230 100644 --- a/xmake/modules/core/tools/gfortran/has_flags.lua +++ b/xmake/modules/core/tools/gfortran/has_flags.lua @@ -71,7 +71,6 @@ function _check_from_arglist(flags, opt, islinker) -- save cache detectcache:set2(key, flagskey, allflags) - detectcache:save() end return allflags[flags[1]] end diff --git a/xmake/modules/core/tools/go/has_flags.lua b/xmake/modules/core/tools/go/has_flags.lua index ade118292..1e84ac279 100644 --- a/xmake/modules/core/tools/go/has_flags.lua +++ b/xmake/modules/core/tools/go/has_flags.lua @@ -76,7 +76,6 @@ function _check_from_arglist(flags, opt, islinker) -- save cache detectcache:set2(key, flagskey, allflags) - detectcache:save() end return allflags[flags[1]] end diff --git a/xmake/modules/core/tools/iccarm/has_flags.lua b/xmake/modules/core/tools/iccarm/has_flags.lua index 35ce23c53..c931c5dad 100644 --- a/xmake/modules/core/tools/iccarm/has_flags.lua +++ b/xmake/modules/core/tools/iccarm/has_flags.lua @@ -60,7 +60,6 @@ function _check_from_arglist(flags, opt, islinker) end end detectcache:set2(key, flagskey, allflags) - detectcache:save() end local flag = flags[1] return allflags[flag] diff --git a/xmake/modules/core/tools/kotlinc_native/has_flags.lua b/xmake/modules/core/tools/kotlinc_native/has_flags.lua index b6559a09a..de191166d 100644 --- a/xmake/modules/core/tools/kotlinc_native/has_flags.lua +++ b/xmake/modules/core/tools/kotlinc_native/has_flags.lua @@ -64,7 +64,6 @@ function _check_from_arglist(flags, opt) -- save cache detectcache:set2(key, flagskey, allflags) - detectcache:save() end return allflags[flags[1]] end diff --git a/xmake/modules/core/tools/ml/has_flags.lua b/xmake/modules/core/tools/ml/has_flags.lua index 1b607f496..2980d6051 100644 --- a/xmake/modules/core/tools/ml/has_flags.lua +++ b/xmake/modules/core/tools/ml/has_flags.lua @@ -50,7 +50,6 @@ function _check_from_arglist(flags, opt) -- save cache detectcache:set2(key, flagskey, allflags) - detectcache:save() end return allflags[flags[1]:gsub("/", "-")] end diff --git a/xmake/modules/core/tools/nim/has_flags.lua b/xmake/modules/core/tools/nim/has_flags.lua index 74173f0f5..41e2dba84 100644 --- a/xmake/modules/core/tools/nim/has_flags.lua +++ b/xmake/modules/core/tools/nim/has_flags.lua @@ -58,7 +58,6 @@ function _check_from_arglist(flags, opt) -- save cache detectcache:set2(key, flagskey, allflags) - detectcache:save() end return allflags[flags[1]] end diff --git a/xmake/modules/core/tools/nvcc/has_flags.lua b/xmake/modules/core/tools/nvcc/has_flags.lua index 3aa33c5c3..c94c5f53e 100644 --- a/xmake/modules/core/tools/nvcc/has_flags.lua +++ b/xmake/modules/core/tools/nvcc/has_flags.lua @@ -92,7 +92,6 @@ function _check_from_arglist(flags, opt, islinker) -- save cache detectcache:set2(key, flagskey, allflags) - detectcache:save() end return allflags[flags[1]] end diff --git a/xmake/modules/core/tools/rc/has_flags.lua b/xmake/modules/core/tools/rc/has_flags.lua index dd584528d..af246d409 100644 --- a/xmake/modules/core/tools/rc/has_flags.lua +++ b/xmake/modules/core/tools/rc/has_flags.lua @@ -51,7 +51,6 @@ function _check_from_arglist(flags, opt) -- save cache detectcache:set2(key, flagskey, allflags) - detectcache:save() end return allflags[flags[1]:gsub("/", "-")] end diff --git a/xmake/modules/core/tools/rustc/has_flags.lua b/xmake/modules/core/tools/rustc/has_flags.lua index ced150618..e2b863561 100644 --- a/xmake/modules/core/tools/rustc/has_flags.lua +++ b/xmake/modules/core/tools/rustc/has_flags.lua @@ -68,7 +68,6 @@ function _check_from_arglist(flags, opt) -- save cache detectcache:set2(key, flagskey, allflags) - detectcache:save() end return allflags[flags[1]] end diff --git a/xmake/modules/core/tools/sdcc/has_flags.lua b/xmake/modules/core/tools/sdcc/has_flags.lua index 5229d8e8c..65e653039 100644 --- a/xmake/modules/core/tools/sdcc/has_flags.lua +++ b/xmake/modules/core/tools/sdcc/has_flags.lua @@ -73,7 +73,6 @@ function _check_from_arglist(flags, opt, islinker) -- save cache detectcache:set2(key, flagskey, allflags) - detectcache:save() end return allflags[flags[1]] end diff --git a/xmake/modules/core/tools/swiftc/has_flags.lua b/xmake/modules/core/tools/swiftc/has_flags.lua index 5df577cdf..290a6de83 100644 --- a/xmake/modules/core/tools/swiftc/has_flags.lua +++ b/xmake/modules/core/tools/swiftc/has_flags.lua @@ -57,7 +57,6 @@ function _check_from_arglist(flags, opt) -- save cache detectcache:set2(key, flagskey, allflags) - detectcache:save() end return allflags[flags[1]] end diff --git a/xmake/modules/core/tools/zig/has_flags.lua b/xmake/modules/core/tools/zig/has_flags.lua index 8fdd611ce..a70d02b54 100644 --- a/xmake/modules/core/tools/zig/has_flags.lua +++ b/xmake/modules/core/tools/zig/has_flags.lua @@ -66,7 +66,6 @@ function _check_from_arglist(flags, opt, islinker) -- save cache detectcache:set2(key, flagskey, allflags) - detectcache:save() end return allflags[flags[1]] end diff --git a/xmake/modules/detect/sdks/find_android_sdk.lua b/xmake/modules/detect/sdks/find_android_sdk.lua index 7bb2e7121..24ea02c4c 100644 --- a/xmake/modules/detect/sdks/find_android_sdk.lua +++ b/xmake/modules/detect/sdks/find_android_sdk.lua @@ -124,6 +124,5 @@ function main(sdkdir, opt) -- save to cache cacheinfo.sdk = sdk or false detectcache:set(key, cacheinfo) - detectcache:save() return sdk end diff --git a/xmake/modules/detect/sdks/find_c51.lua b/xmake/modules/detect/sdks/find_c51.lua index b6f22dd90..4cc7c5d6f 100644 --- a/xmake/modules/detect/sdks/find_c51.lua +++ b/xmake/modules/detect/sdks/find_c51.lua @@ -117,6 +117,5 @@ function main(sdkdir, opt) -- save to cache cacheinfo.c51 = c51 or false detectcache:set(key, cacheinfo) - detectcache:save() return c51 end diff --git a/xmake/modules/detect/sdks/find_cuda.lua b/xmake/modules/detect/sdks/find_cuda.lua index 14b6b42c0..0a4756bee 100644 --- a/xmake/modules/detect/sdks/find_cuda.lua +++ b/xmake/modules/detect/sdks/find_cuda.lua @@ -176,6 +176,5 @@ function main(sdkdir, opt) -- save to cache cacheinfo.cuda = cuda or false detectcache:set(key, cacheinfo) - detectcache:save() return cuda end diff --git a/xmake/modules/detect/sdks/find_dia_sdk.lua b/xmake/modules/detect/sdks/find_dia_sdk.lua index 5a4ffc5a5..e9dd88ca0 100644 --- a/xmake/modules/detect/sdks/find_dia_sdk.lua +++ b/xmake/modules/detect/sdks/find_dia_sdk.lua @@ -155,6 +155,5 @@ function main(sdkdir, opt) -- save to cache cacheinfo.dia_sdk = dia_sdk or false detectcache:set(key, cacheinfo) - detectcache:save() return dia_sdk end diff --git a/xmake/modules/detect/sdks/find_dotnet.lua b/xmake/modules/detect/sdks/find_dotnet.lua index 3b9acc74d..2dfd2a916 100644 --- a/xmake/modules/detect/sdks/find_dotnet.lua +++ b/xmake/modules/detect/sdks/find_dotnet.lua @@ -130,6 +130,5 @@ function main(sdkdir, opt) -- save to cache cacheinfo.dotnet = dotnet or false detectcache:set(key, cacheinfo) - detectcache:save() return dotnet end diff --git a/xmake/modules/detect/sdks/find_emsdk.lua b/xmake/modules/detect/sdks/find_emsdk.lua index 9d49fd969..642e7aeb9 100644 --- a/xmake/modules/detect/sdks/find_emsdk.lua +++ b/xmake/modules/detect/sdks/find_emsdk.lua @@ -110,6 +110,5 @@ function main(sdkdir, opt) -- save to cache cacheinfo.sdk = sdk or false detectcache:set(key, cacheinfo) - detectcache:save() return sdk end diff --git a/xmake/modules/detect/sdks/find_hdk.lua b/xmake/modules/detect/sdks/find_hdk.lua index eac429691..c74a4d880 100644 --- a/xmake/modules/detect/sdks/find_hdk.lua +++ b/xmake/modules/detect/sdks/find_hdk.lua @@ -110,6 +110,5 @@ function main(sdkdir, opt) -- save to cache cacheinfo.hdk = hdk or false detectcache:set(key, cacheinfo) - detectcache:save() return hdk end diff --git a/xmake/modules/detect/sdks/find_iarsdk.lua b/xmake/modules/detect/sdks/find_iarsdk.lua index b75085d81..7fb42874a 100644 --- a/xmake/modules/detect/sdks/find_iarsdk.lua +++ b/xmake/modules/detect/sdks/find_iarsdk.lua @@ -90,6 +90,5 @@ function main(sdkdir, opt) -- save to cache cacheinfo.iarsdk = iarsdk or false detectcache:set(key, cacheinfo) - detectcache:save() return iarsdk end diff --git a/xmake/modules/detect/sdks/find_masm32.lua b/xmake/modules/detect/sdks/find_masm32.lua index b7242ae42..74230aa12 100644 --- a/xmake/modules/detect/sdks/find_masm32.lua +++ b/xmake/modules/detect/sdks/find_masm32.lua @@ -89,6 +89,5 @@ function main(sdkdir, opt) -- save to cache cacheinfo.masm32 = masm32 or false detectcache:set(key, cacheinfo) - detectcache:save() return masm32 end diff --git a/xmake/modules/detect/sdks/find_mdk.lua b/xmake/modules/detect/sdks/find_mdk.lua index 6de275a14..4fb9ef313 100644 --- a/xmake/modules/detect/sdks/find_mdk.lua +++ b/xmake/modules/detect/sdks/find_mdk.lua @@ -118,6 +118,5 @@ function main(sdkdir, opt) -- save to cache cacheinfo.mdk = mdk or false detectcache:set(key, cacheinfo) - detectcache:save() return mdk end diff --git a/xmake/modules/detect/sdks/find_mingw.lua b/xmake/modules/detect/sdks/find_mingw.lua index 88f65ada7..e1b3571ec 100644 --- a/xmake/modules/detect/sdks/find_mingw.lua +++ b/xmake/modules/detect/sdks/find_mingw.lua @@ -158,6 +158,5 @@ function main(sdkdir, opt) -- save to cache cacheinfo.mingw = mingw or false detectcache:set(key, cacheinfo) - detectcache:save() return mingw end diff --git a/xmake/modules/detect/sdks/find_ndk.lua b/xmake/modules/detect/sdks/find_ndk.lua index a388fa294..0ac0a4f83 100644 --- a/xmake/modules/detect/sdks/find_ndk.lua +++ b/xmake/modules/detect/sdks/find_ndk.lua @@ -304,6 +304,5 @@ function main(sdkdir, opt) -- save to cache cacheinfo.ndk = ndk or false detectcache:set(key, cacheinfo) - detectcache:save() return ndk end diff --git a/xmake/modules/detect/sdks/find_qt.lua b/xmake/modules/detect/sdks/find_qt.lua index 8b7cc3207..8935be2c6 100644 --- a/xmake/modules/detect/sdks/find_qt.lua +++ b/xmake/modules/detect/sdks/find_qt.lua @@ -379,6 +379,5 @@ function main(sdkdir, opt) else detectcache:set(key, cacheinfo) end - detectcache:save() return qt end diff --git a/xmake/modules/detect/sdks/find_vcpkgdir.lua b/xmake/modules/detect/sdks/find_vcpkgdir.lua index 260791406..0b1103c8d 100644 --- a/xmake/modules/detect/sdks/find_vcpkgdir.lua +++ b/xmake/modules/detect/sdks/find_vcpkgdir.lua @@ -68,7 +68,6 @@ function main() end end detectcache:set("detect.sdks.find_vcpkgdir", vcpkgdir or false) - detectcache:save() end return vcpkgdir or nil end diff --git a/xmake/modules/detect/sdks/find_wasisdk.lua b/xmake/modules/detect/sdks/find_wasisdk.lua index cae657a32..f85408e0d 100644 --- a/xmake/modules/detect/sdks/find_wasisdk.lua +++ b/xmake/modules/detect/sdks/find_wasisdk.lua @@ -100,6 +100,5 @@ function main(sdkdir, opt) -- save to cache cacheinfo.sdk = sdk or false detectcache:set(key, cacheinfo) - detectcache:save() return sdk end diff --git a/xmake/modules/detect/sdks/find_wdk.lua b/xmake/modules/detect/sdks/find_wdk.lua index 0ac7e06a9..ae380ce8b 100644 --- a/xmake/modules/detect/sdks/find_wdk.lua +++ b/xmake/modules/detect/sdks/find_wdk.lua @@ -182,6 +182,5 @@ function main(sdkdir, opt) -- save to cache cacheinfo.wdk = wdk or false detectcache:set(key, cacheinfo) - detectcache:save() return wdk end diff --git a/xmake/modules/detect/sdks/find_xcode.lua b/xmake/modules/detect/sdks/find_xcode.lua index 3f62f5221..6382ae577 100644 --- a/xmake/modules/detect/sdks/find_xcode.lua +++ b/xmake/modules/detect/sdks/find_xcode.lua @@ -199,6 +199,5 @@ function main(sdkdir, opt) -- save to cache cacheinfo.xcode = xcode or false detectcache:set(key, cacheinfo) - detectcache:save() return xcode end diff --git a/xmake/modules/lib/detect/find_cudadevices.lua b/xmake/modules/lib/detect/find_cudadevices.lua index c780bf311..0f459c711 100644 --- a/xmake/modules/lib/detect/find_cudadevices.lua +++ b/xmake/modules/lib/detect/find_cudadevices.lua @@ -202,7 +202,6 @@ function _get_devices(opt) -- fill cache detectcache:set(cachekey, cachedata) - detectcache:save() return devices end diff --git a/xmake/modules/lib/detect/find_package.lua b/xmake/modules/lib/detect/find_package.lua index f43c4656a..eedce1cec 100644 --- a/xmake/modules/lib/detect/find_package.lua +++ b/xmake/modules/lib/detect/find_package.lua @@ -98,7 +98,6 @@ function main(name, opt) -- cache result detectcache:set2(cachekey, packagekey, result and result or false) - detectcache:save() -- trace if opt.verbose or option.get("verbose") then diff --git a/xmake/modules/lib/detect/has_flags.lua b/xmake/modules/lib/detect/has_flags.lua index af4197e4a..b122bcebb 100644 --- a/xmake/modules/lib/detect/has_flags.lua +++ b/xmake/modules/lib/detect/has_flags.lua @@ -150,7 +150,6 @@ function main(name, flags, opt) -- save result to cache cacheinfo[key] = result detectcache:set("lib.detect.has_flags", cacheinfo) - detectcache:save() scheduler.co_unlock(key) return result end diff --git a/xmake/modules/net/ping.lua b/xmake/modules/net/ping.lua index f9a6d5ff0..b711da60b 100644 --- a/xmake/modules/net/ping.lua +++ b/xmake/modules/net/ping.lua @@ -142,7 +142,6 @@ function main(hosts, opt) if cacheinfo then detectcache:set("net.ping", cacheinfo) - detectcache:save() end return results end |
