summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2025-11-07 22:46:49 +0100
committerArthur LAURENT <[email protected]>2025-11-07 22:46:49 +0100
commit067f395b418f64b29488184bd6bcec910b94e44d (patch)
tree1043cde2306694be74cb82beb8634f763d3ef2d0
parent0b91f564b00bf22d611a70c17088ba3a155b8a84 (diff)
(modules) don't rescan std and packages modules when using -r
-rw-r--r--xmake/rules/c++/modules/clang/scanner.lua4
-rw-r--r--xmake/rules/c++/modules/gcc/scanner.lua4
-rw-r--r--xmake/rules/c++/modules/msvc/scanner.lua4
-rw-r--r--xmake/rules/c++/modules/scanner.lua6
4 files changed, 11 insertions, 7 deletions
diff --git a/xmake/rules/c++/modules/clang/scanner.lua b/xmake/rules/c++/modules/clang/scanner.lua
index b7988806c..96aa6a7e2 100644
--- a/xmake/rules/c++/modules/clang/scanner.lua
+++ b/xmake/rules/c++/modules/clang/scanner.lua
@@ -28,7 +28,7 @@ import("support")
import(".scanner", {inherit = true})
-- scan module dependencies
-function scan_dependency_for(target, sourcefile, opt)
+function scan_dependency_for(target, sourcefile, rescan, opt)
local compinst = target:compiler("cxx")
local changed = false
@@ -87,7 +87,7 @@ function scan_dependency_for(target, sourcefile, opt)
local rawdependinfo = io.readfile(jsonfile)
return {moduleinfo = rawdependinfo}
- end, {dependfile = dependfile, files = {sourcefile}, changed = target:is_rebuilt(), values = compflags})
+ end, {dependfile = dependfile, files = {sourcefile}, changed = rescan, values = compflags})
return changed
end
diff --git a/xmake/rules/c++/modules/gcc/scanner.lua b/xmake/rules/c++/modules/gcc/scanner.lua
index 862df3c43..b0cdda7af 100644
--- a/xmake/rules/c++/modules/gcc/scanner.lua
+++ b/xmake/rules/c++/modules/gcc/scanner.lua
@@ -28,7 +28,7 @@ import("builder")
import(".scanner", {inherit = true})
-- scan module dependencies
-function scan_dependency_for(target, sourcefile, opt)
+function scan_dependency_for(target, sourcefile, rescan, opt)
local compinst = target:compiler("cxx")
local baselineflags = {"-E", "-x", "c++"}
@@ -77,7 +77,7 @@ function scan_dependency_for(target, sourcefile, opt)
local dependinfo = io.readfile(jsonfile)
return { moduleinfo = dependinfo }
- end, {dependfile = dependfile, files = {sourcefile}, changed = target:is_rebuilt(), values = compflags})
+ end, {dependfile = dependfile, files = {sourcefile}, changed = rescan, values = compflags})
return changed
end
diff --git a/xmake/rules/c++/modules/msvc/scanner.lua b/xmake/rules/c++/modules/msvc/scanner.lua
index 912e643ab..07f7de41e 100644
--- a/xmake/rules/c++/modules/msvc/scanner.lua
+++ b/xmake/rules/c++/modules/msvc/scanner.lua
@@ -29,7 +29,7 @@ import("builder")
import(".scanner", {inherit = true})
-- scan module dependencies
-function scan_dependency_for(target, sourcefile, opt)
+function scan_dependency_for(target, sourcefile, rescan, opt)
local msvc = target:toolchain("msvc")
local compinst = target:compiler("cxx")
@@ -68,7 +68,7 @@ function scan_dependency_for(target, sourcefile, opt)
local dependinfo = io.readfile(jsonfile)
return { moduleinfo = dependinfo }
- end, {dependfile = dependfile, files = {sourcefile}, changed = target:is_rebuilt(), values = compflags})
+ end, {dependfile = dependfile, files = {sourcefile}, changed = rescan, values = compflags})
return changed
end
diff --git a/xmake/rules/c++/modules/scanner.lua b/xmake/rules/c++/modules/scanner.lua
index 3c7a04aa4..12c85e73e 100644
--- a/xmake/rules/c++/modules/scanner.lua
+++ b/xmake/rules/c++/modules/scanner.lua
@@ -510,7 +510,11 @@ end
function _do_scan(target, sourcefile, opt)
profiler.enter(target:fullname(), "c++ modules", "scanner", "scan dependencies for", sourcefile)
- local changed = _scanner(target).scan_dependency_for(target, sourcefile, opt)
+ local fileconfig = target:fileconfig(sourcefile)
+ local from_package = fileconfig and fileconfig.from_package
+ local is_std = path.basename(sourcefile) == "std" or path.basename(sourcefile) == "std.compat"
+ local rescan = target:is_rebuilt() and not from_package and not is_std
+ local changed = _scanner(target).scan_dependency_for(target, sourcefile, rescan, opt)
if changed or not support.localcache():get2(target:fullname(), "module_mapper") then
support.memcache():set2(target:fullname(), "modules.changed", true)
end