diff options
| author | ruki <[email protected]> | 2025-09-13 22:38:59 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-09-13 22:38:59 +0800 |
| commit | 8241b150316595df554dfeab99efca618eef7412 (patch) | |
| tree | 681003a1bf7313c6b1ba2a2a3999e0941ce5abe6 /xmake/rules/c++/modules/builder.lua | |
| parent | 422bb3af1076cc0998ce0deb7a04247da316840a (diff) | |
| parent | c71d77375c51440a4a5a743709e4945c00859990 (diff) | |
Merge pull request #6788 from Arthapz/improve-incremental-build-clang
feat(C++ modules) Improve incremental build clang
Diffstat (limited to 'xmake/rules/c++/modules/builder.lua')
| -rw-r--r-- | xmake/rules/c++/modules/builder.lua | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/xmake/rules/c++/modules/builder.lua b/xmake/rules/c++/modules/builder.lua index b84d5d23e..a1c93a35f 100644 --- a/xmake/rules/c++/modules/builder.lua +++ b/xmake/rules/c++/modules/builder.lua @@ -180,6 +180,15 @@ function should_build(target, module) local old_dependinfo = target:is_rebuilt() and {} or (depend.load(dependfile) or {}) old_dependinfo.files = {module.sourcefile} + -- need build this object? + local dryrun = option.get("dry-run") + if dryrun or depend.is_changed(old_dependinfo, dependinfo) then + depend.save(dependinfo, dependfile) + memcache:set2(target:fullname(), "should_build_" .. module.sourcefile, true) + profiler.leave(target:fullname(), "c++ modules", "builder", "check if " .. (module.name or module.sourcefile) .. " should be rebuilt") + return true + end + -- force rebuild a module if any of its module dependency is rebuilt for dep_name, dep_module in table.orderpairs(module.deps) do local mapped_dep = mapper.get(target, dep_module.headerunit and dep_name .. dep_module.key or dep_name) @@ -188,18 +197,10 @@ function should_build(target, module) depend.save(dependinfo, dependfile) memcache:set2(target:fullname(), "should_build_" .. module.sourcefile, true) profiler.leave(target:fullname(), "c++ modules", "builder", "check if " .. (module.name or module.sourcefile) .. " should be rebuilt") - return true + return true, true end end - -- need build this object? - local dryrun = option.get("dry-run") - if dryrun or depend.is_changed(old_dependinfo, dependinfo) then - depend.save(dependinfo, dependfile) - memcache:set2(target:fullname(), "should_build_" .. module.sourcefile, true) - profiler.leave(target:fullname(), "c++ modules", "builder", "check if " .. (module.name or module.sourcefile) .. " should be rebuilt") - return true - end memcache:set2(target:fullname(), "should_build_" .. module.sourcefile, false) profiler.leave(target:fullname(), "c++ modules", "builder", "check if " .. (module.name or module.sourcefile) .. " should be rebuilt") return false |
