Skip to content

Commit eb29dc5

Browse files
committed
Merge main: the qrc resource-input fix (#42) lands before this release
Both sides added a `plugin-logic` case at the same point, and the conflict boundary fell inside one of them. The resolution keeps every case from both: the six tool cases of this branch and the qrc case from #42, whose fix in `qrc_files` merged untouched. 29 of 29 cases pass with the released engine.
2 parents e00da73 + 34b7af4 commit eb29dc5

2 files changed

Lines changed: 34 additions & 1 deletion

File tree

‎rules/qt.cppm‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,12 @@ inline std::vector<std::string> qrc_files(const std::filesystem::path& qrc) {
272272
if (!mcpp::plugins::xml::parse(read_file(qrc), doc, error)) return out;
273273
std::function<void(const mcpp::plugins::xml::node&)> walk = [&](const mcpp::plugins::xml::node& n) {
274274
if (n.name == "file") {
275-
std::string text = mcpp::plugins::xml::trim_copy(n.text);
275+
// The XML reader stores element text in unnamed child nodes.
276+
std::string text;
277+
for (auto const& child : n.children) {
278+
if (child.name.empty()) text += child.text;
279+
}
280+
text = mcpp::plugins::xml::trim_copy(text);
276281
if (!text.empty()) out.push_back(generic(qrc.parent_path() / text));
277282
}
278283
for (auto const& c : n.children) walk(c);

‎tests/plugin-logic/build.mcpp‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,34 @@ int main(int argc, char** argv) {
564564
"it names the environment's way");
565565
} },
566566

567+
{ "qt: rcc tracks the resource paths stored in XML text children",
568+
with_qt(t::row::linux_gcc())
569+
.file("qt/bin/rcc").file("qt/bin/rcc.exe")
570+
.file("pkg/res/app.qrc",
571+
"<RCC><qresource prefix=\"/\">\n"
572+
" <file>assets/greeting.txt</file>\n"
573+
" <file alias=\"sample.zip\"> \n"
574+
" data/Sample<!-- split text -->Project.zip \n"
575+
" </file>\n"
576+
"</qresource></RCC>\n")
577+
.file("pkg/res/assets/greeting.txt", "hello\n")
578+
.file("pkg/res/data/SampleProject.zip", "resource contents\n"),
579+
[] {
580+
mcpp::rules::qt::options o;
581+
o.root = "../qt";
582+
o.modules = {"Core"};
583+
o.resources = {"res/app.qrc"};
584+
return mcpp::rules::qt::compile(o) ? 0 : 1;
585+
},
586+
[](const t::result& r, t::checker& c) {
587+
c.expect(r.exit_code == 0, "the member succeeds");
588+
const auto a = r.line("mcpp:action=", {"qt:rcc:app"});
589+
c.expect(a.find("pkg/res/assets/greeting.txt") != std::string::npos,
590+
"rcc tracks a resource relative to the qrc directory");
591+
c.expect(a.find("pkg/res/data/SampleProject.zip") != std::string::npos,
592+
"rcc tracks the aliased source after joining and trimming text children");
593+
} },
594+
567595
// ── compatibility ───────────────────────────────────────────────────
568596
{ "compat: program_compilers keeps its 0.16.0 answer and says until when",
569597
t::row::linux_libcxx().file("llvm/bin/clang").file("llvm/bin/clang++"),

0 commit comments

Comments
 (0)