diff options
| author | Shiffted <[email protected]> | 2026-03-29 11:22:11 +0200 |
|---|---|---|
| committer | Shiffted <[email protected]> | 2026-03-29 11:36:20 +0200 |
| commit | 6c37e151e982075081ff87841fd65083f1f7bb5a (patch) | |
| tree | dd337fe485490a7fd63bfb937b2ebcef967ca54f | |
| parent | 1df5ac2921a800c766fc64d4db6a85975c171e32 (diff) | |
improve module errors
| -rw-r--r-- | xmake/rules/c++/modules/scanner.lua | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/xmake/rules/c++/modules/scanner.lua b/xmake/rules/c++/modules/scanner.lua index 2bcee1f12..8d848446f 100644 --- a/xmake/rules/c++/modules/scanner.lua +++ b/xmake/rules/c++/modules/scanner.lua @@ -385,7 +385,7 @@ function _patch_sourcebatch(target, sourcebatch) local strict = target:policy("build.c++.modules.reuse.strict") or target:policy("build.c++.modules.tryreuse.discriminate_on_defines") local dep = target:dep(fileconfig.from_dep) - assert(dep, "dep target <%s> for <%s> not found", fileconfig.from_dep, target:fullname()) + assert(dep, "dep target(%s) for target(%s) not found", fileconfig.from_dep, target:fullname()) local can_reuse = nocheck or _are_flags_compatible(target, dep, sourcefile, {strict = strict}) if can_reuse then local _reused, from = support.is_reused(dep, sourcefile) @@ -883,7 +883,15 @@ end function get_modules(target) local modules = support.localcache():get2(target:fullname(), "c++.modules") - assert(modules, "no modules! (" .. target:fullname() .. ")") + if not modules then + local targets = support.memcache():get("targets") + assert(targets, "module scanner did not run, maybe a custom `on_prepare()` script overrides the modules one.") + + local target_fullname = target:fullname() + assert(targets[target_fullname], "module scanner did not run for target(%s), maybe a custom `on_prepare()` script overrides the modules one.", target_fullname) + assert(targets[target_fullname].finished_parsing, "target(%s): tried getting modules before scanner finished parsing.", target_fullname) + assert(false, "target(%s): no modules found!", target_fullname) + end return modules end |
