Qt6 Migration CI / migrate (push) Waiting to run
- Updated MIGRATION_STATUS.md with current build status and blockers - Updated combined-migration-compact.prompt.md with latest instructions - Updated Dockerfile for migration pipeline with RTI 7.7 support - Updated build scripts for Docker-based migration workflow Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Entire-Checkpoint: 01M1BQ6VBZ20E1WJ29NYGT8EWJ
7.3 KiB
7.3 KiB
GitHub Copilot Instructions: Qt5/C++11 to Qt6/C++17 Migration
Mission
Migrate the legacy Qt5/C++11 desktop application to Qt6/C++17, preserve behavior unless change is strictly required, and validate the result completely in the repository’s Docker-based CI workflow.
Operating Mode
- Work autonomously from analysis through validation.
- Do not stop after editing code.
- Continue until configure, build, tests, and policy checks have been attempted in Docker.
- Do not ask for confirmation during normal implementation.
- Stop early only if required source material is missing, the task is impossible, or a destructive action would be required.
Boundaries
- Read the legacy project from
./qt-migration-legatus/qt5-before/qt5-legatus-legacy. - Write the migrated project to
./qt-migration-legatus/qt6-after/qt6-migrated-legatus. - Do not modify the legacy source tree in place.
- Limit changes to the target tree and only the CI/build/test files needed to support migration and validation.
Main Migration Targets
- Upgrade Qt5 to Qt6.
- Upgrade C++11/14/17 code to C++17.
- Keep Qt Core, Gui, and Widgets explicitly linked.
- Replace
QRegExpwithQRegularExpression. - Replace
QDesktopWidgetandQApplication::desktop()withQScreen-based Qt6 APIs. - Remove legacy
QTextCodecusage and adopt Qt6-safe text handling. - Replace old
SIGNAL/SLOTsyntax with function-pointer connect syntax. - Replace
0/NULLpointer literals withnullptr. - Preserve
.uiand.qrcintegration. - Preserve behavior unless Qt6 compatibility requires adaptation.
C++17 Modernization Rules
- Preserve semantics first; modernize second.
- Use
autowhen the type is obvious; avoid it when it hides important type information. - Prefer structured bindings where clearer.
- Replace raw owning pointers/manual
deletewith RAII, usuallystd::unique_ptr. - Use
std::make_unique/std::make_shared; usestd::shared_ptronly for real shared ownership. - Use
std::string_viewonly when lifetime safety is clear. - Prefer
std::spanfor non-owning contiguous data; usestd::mdspanonly when multidimensional access clearly benefits. - Prefer
.contains()overfind(...) != end()where available. - Prefer algorithms and ranges over manual loops when readability improves.
- Use
[[nodiscard]]when ignoring a result is likely a bug. - Prefer early returns over deeply nested control flow.
- Use
std::optionalmonadic operations (and_then,transform,or_else) when clearer. - Prefer
constexpr,if constexpr, concepts, andrequiresover legacystd::enable_if/SFINAE where practical. - Add
noexcept,override,final,= default, and= deletewhere correct and useful. - Prefer
enum classover unscoped enums where practical. - Prefer
std::print/std::printlnwhen supported by the toolchain. - Prefer typed
std::chronodurations andstd::jthreadwhere appropriate.
Safety Rules
- Do not change business logic unless explicitly requested or required for Qt6 compatibility.
- Do not introduce unsupported Qt6/C++17 features.
- Do not silently change ABI, ownership, lifetime, exception behavior, performance, UI behavior, or event ordering.
- Do not worsen readability for the sake of modernization.
- Do not refactor code.
- Avoid dangling references, dangling
std::string_view, and ownership ambiguity. - Keep includes minimal and preserve repository-local formatting/style.
- no code cleanup
- no renaming
- no extraction of functions/classes
- no restructuring of logic
- no stylistic rewrites
- no dependency modernization
- no opportunistic improvements
- no behavior changes beyond path/build necessity
Tests
- For every code change inside a method, add at least three tests covering the changed behavior.
- Place generated tests in
./qt-migration-legatus/qt6-after/qt6-migrated-legatus/tests. - Use policy-compatible test filenames such as:
test_<name>.cpp<name>_test.cpp<name>test.cpp<name>gtest.cppas searched for in./qt-migration-legatus/ci/check_pr_policies.py
- Update CMake so the migrated app and all tests build and run with CTest.
- Ensure all tests are registered with CTest.
Docker-First Validation
Use lifemaps/ci-cpp:latest as the authoritative environment. Do not substitute host tools for missing container tools. Treat ./qt-migration-legatus/ci/Dockerfile.ci as the source of truth for CI dependencies.
Required validation sequence
- Configure in Docker
- Build in Docker
- Run tests in Docker
- If tests pass, run
python3 ci/check_pr_policies.pyin Docker
Recommended commands
- Configure:
cmake -S ./qt-migration-legatus/qt6-after/qt6-migrated-legatus -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug - Build:
cmake --build build --parallel - Test:
ctest --test-dir build --output-on-failure - Policy:
python3 ./qt-migration-legatus/ci/check_pr_policies.py
Adapt paths/flags only if repository inspection proves they must differ.
Missing-Tool Remediation
If Docker validation fails because a required tool/package is missing:
- identify the exact missing dependency
- update
./qt-migration-legatus/ci/Dockerfile.ciminimally - rebuild
lifemaps/ci-cpp:latest - rerun the full validation sequence
Continue until:
- validation succeeds, or
- the next blocker is a genuine project/code issue
Failure Classification
Environment failures:
- command not found
- missing compiler/toolchain utility
- missing Qt dev package
- missing CMake/Ninja/CTest support tool
- missing dependency required by
./qt-migration-legatus/ci/check_pr_policies.py
Project failures:
- compile errors
- linker errors
- failing tests
- formatting/policy failures caused by migration changes
Policy Awareness
./qt-migration-legatus/ci/check_pr_policies.pychecks formatting for changed C/C++ files, expects related tests, and verifies commit-signature conditions in its diff range.- Ensure Docker validation runs with mounted workspace and git metadata available.
- Do not claim success unless the policy script passes.
Execution Plan
- Inspect
./qt-migration-legatus/and the target tree. - Identify Qt5 and legacy C++ constructs to migrate.
- Migrate incrementally in
qt6-after/qt6-migrated-legatus. - Add/update tests with each behavior-relevant change.
- Update CMake/test registration.
- Validate in Docker.
- If missing dependencies are found, update
./qt-migration-legatus/ci/Dockerfile.ci, rebuild, and rerun. - Repeat until success or a real project defect remains.
Reporting
Group change explanations by:
- CMake / build-system migration
- Qt API replacements
- C++ modernization
- UI/resource preservation
- tests added
./qt-migration-legatus/ci/Dockerfile.ci/ container updates
Also provide a concise changed-files summary.
Completion Criteria
Success requires:
- migrated project exists under
./qt-migration-legatus/qt6-after/qt6-migrated-legatus - configure succeeds in Docker
- build succeeds in Docker
- tests succeed in Docker
python3 ci/check_pr_policies.pysucceeds in Docker after tests pass
Final Response
- State whether migration is fully validated or which blocker remains.
- List the exact Docker commands used for image rebuild, configure, build, test, and policy check.
- For every failed attempt, include:
- exact command
- key error
- environment vs project classification
- fix applied
- End with a short summary of any remaining blocker.