From a70ab06ee775f7d5c868a94e0e42605a0229d688 Mon Sep 17 00:00:00 2001 From: Arthur LAURENT Date: Wed, 24 Jul 2024 03:55:17 +0200 Subject: [PATCH] improve warning when modules get culled --- .../modules_support/dependency_scanner.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/xmake/rules/c++/modules/modules_support/dependency_scanner.lua b/xmake/rules/c++/modules/modules_support/dependency_scanner.lua index c2dce12036b..38bf3453b92 100644 --- a/xmake/rules/c++/modules/modules_support/dependency_scanner.lua +++ b/xmake/rules/c++/modules/modules_support/dependency_scanner.lua @@ -435,6 +435,7 @@ function sort_modules_by_dependencies(target, objectfiles, modules, opt) objectfiles_sorted_set:insert(objectfile) end end + local culleds for _, objectfile in ipairs(objectfiles_sorted) do local name, provide, cppfile = compiler_support.get_provided_module(modules[objectfile]) local fileconfig = target:fileconfig(cppfile) @@ -470,13 +471,28 @@ function sort_modules_by_dependencies(target, objectfiles, modules, opt) elseif external and not external.from_moduleonly then table.insert(build_objectfiles, objectfile) else + culleds = culleds or {} objectfiles_sorted_set:remove(objectfile) if name ~= "std" and name ~= "std.compat" then - wprint("%s has been culled because it's not consumed by its target (%s) nor flagged as a public module (add_files(\"%s\", {public = true}))", name, target:name(), path.filename(cppfile)) + culleds[target:name()] = culleds[target:name()] or {} + table.insert(culleds[target:name()], format("%s -> %s", name, cppfile)) end end end + if culleds then + if option.get("verbose") then + local culled_strs = {} + for target_name, m in pairs(culleds) do + table.insert(culled_strs, format("%s:\n %s", target_name, table.concat(m, "\n "))) + end + wprint("some modules have got culled, because it is not consumed by its target nor flagged as a public module with add_files(\"xxx.mpp\", {public = true})\n %s", + table.concat(culled_strs, "\n ")) + else + wprint("some modules have got culled, use verbose (-v) mode to more informations") + end + end + return build_objectfiles, link_objectfiles end