|
34 | 34 | // declares nothing, so the plan succeeds and the build is where it fails. |
35 | 35 | // |
36 | 36 | // `lupdate` REWRITES SOURCES, so it is off unless `translations::update_sources` |
37 | | -// asks for it; then it is a `prepare` action whose stamp `lrelease` waits for, |
38 | | -// the order Qt's Visual Studio integration runs them in. |
| 37 | +// asks for it; then it is an action whose output is the `.ts` file itself, and |
| 38 | +// `lrelease` reads that file, the order Qt's Visual Studio integration runs |
| 39 | +// them in. |
39 | 40 |
|
40 | 41 | module; |
41 | 42 | #include <cctype> |
@@ -447,7 +448,7 @@ inline bool compile(options opt = {}) { |
447 | 448 | const std::string desc = "MOC " + in.filename().string(); |
448 | 449 | mcpp::action a; |
449 | 450 | a.id = id.c_str(); |
450 | | - a.role = "source"; |
| 451 | + a.role = mcpp::roles::source; |
451 | 452 | a.description = desc.c_str(); |
452 | 453 | a.depfile = dep.c_str(); |
453 | 454 | a.arg(moc.c_str()).arg(src.c_str()).arg("-o").arg(out.c_str()) |
@@ -477,7 +478,7 @@ inline bool compile(options opt = {}) { |
477 | 478 | const std::string desc = "UIC " + fs::path(f).filename().string(); |
478 | 479 | mcpp::action a; |
479 | 480 | a.id = id.c_str(); |
480 | | - a.role = "source"; |
| 481 | + a.role = mcpp::roles::source; |
481 | 482 | a.description = desc.c_str(); |
482 | 483 | a.arg(uic.c_str()).arg(in.c_str()).arg("-o").arg(out.c_str()) |
483 | 484 | .input(in.c_str()).output(out.c_str()).submit(); |
@@ -505,7 +506,7 @@ inline bool compile(options opt = {}) { |
505 | 506 | mcpp::rerun_if_changed(in.c_str()); |
506 | 507 | mcpp::action a; |
507 | 508 | a.id = id.c_str(); |
508 | | - a.role = "source"; |
| 509 | + a.role = mcpp::roles::source; |
509 | 510 | a.description = desc.c_str(); |
510 | 511 | a.arg(rcc.c_str()).arg("--name").arg(stem.c_str()).arg(in.c_str()).arg("-o").arg(out.c_str()) |
511 | 512 | .input(in.c_str()); |
@@ -545,37 +546,29 @@ inline bool compile(options opt = {}) { |
545 | 546 | const fs::path qmDir = opt.i18n.out_dir.empty() ? gen / "translations" |
546 | 547 | : detail::absolute_from_root(opt.i18n.out_dir); |
547 | 548 | const std::string qm = generic(qmDir / (stem + ".qm")); |
548 | | - std::string stamp; |
549 | 549 | if (opt.i18n.update_sources) { |
550 | | - stamp = generic(gen / (stem + ".lupdate.stamp")); |
551 | 550 | const std::string id = "qt:lupdate:" + stem; |
552 | 551 | const std::string desc = "LUPDATE " + file.filename().string(); |
553 | 552 | mcpp::action u; |
554 | 553 | u.id = id.c_str(); |
555 | | - // Construction, not validation (SPEC-007 R3.4): lupdate |
556 | | - // rewrites the `.ts` files in their directory, which lrelease |
557 | | - // reads, so it is a `prepare` whose output directory is theirs. |
558 | | - u.role = mcpp::roles::prepare; |
| 554 | + // The file lupdate writes is named before it runs, so the action |
| 555 | + // names it as its output (SPEC-007 R3.2) and needs neither a |
| 556 | + // stamp nor a `prepare` directory. `lrelease` takes the same file |
| 557 | + // as its input, which orders the two. |
| 558 | + u.role = mcpp::roles::source; |
559 | 559 | u.description = desc.c_str(); |
560 | 560 | u.arg(lupdate.c_str()).arg("-silent").arg("-extensions").arg("cpp,h,hpp,ixx,cppm"); |
561 | 561 | for (auto const& a : opt.i18n.tr_function_alias) u.arg("-tr-function-alias").arg(a.c_str()); |
562 | 562 | for (auto const& s : sources) u.arg(s.c_str()).input(s.c_str()); |
563 | | - // The stamp is written by mcpp when lupdate succeeds (a |
564 | | - // prepare's command need not write its own); `lrelease` takes it as an |
565 | | - // input, so it reads the `.ts` lupdate has rewritten. |
566 | | - // `output_dir` keeps the pointer it is given, unlike `arg()`, |
567 | | - // so the string is a local that outlives `submit()`. |
568 | | - const std::string tsDir = generic(file.parent_path()); |
569 | | - u.arg("-ts").arg(in.c_str()).output(stamp.c_str()).output_dir(tsDir.c_str()).submit(); |
| 563 | + u.arg("-ts").arg(in.c_str()).output(in.c_str()).submit(); |
570 | 564 | } |
571 | 565 | const std::string id = "qt:lrelease:" + stem; |
572 | 566 | const std::string desc = "LRELEASE " + file.filename().string(); |
573 | 567 | mcpp::action r; |
574 | 568 | r.id = id.c_str(); |
575 | | - r.role = "source"; |
| 569 | + r.role = mcpp::roles::source; |
576 | 570 | r.description = desc.c_str(); |
577 | 571 | r.arg(lrelease.c_str()).arg("-silent").arg(in.c_str()).arg("-qm").arg(qm.c_str()).input(in.c_str()); |
578 | | - if (!stamp.empty()) r.input(stamp.c_str()); |
579 | 572 | r.output(qm.c_str()).submit(); |
580 | 573 | mcpp::deploy(qm.c_str(), opt.i18n.deploy_to.c_str()); |
581 | 574 | } |
|
0 commit comments