#!/usr/bin/env bash set -euo pipefail # Run final clean configure / build / test in Docker using app/run_docker.sh # Usage: ./final-migration/run_final_migration.sh [--jobs N] # Requires the Docker image from ./app/run_docker.sh to be available (run ./app/run_docker.sh --build once if needed). # Note: Source directory is qt-migration-legatus/qt6-after/qt6-migrated-legatus/ (submodule) JOBS=5 while [[ $# -gt 0 ]]; do case "$1" in --jobs) JOBS="$2"; shift 2;; -j*) JOBS="${1#-j}"; shift;; *) echo "Unknown arg: $1"; exit 1;; esac done # Submodule path containing the migrated Qt6 code SUBMODULE_PATH="qt-migration-legatus/qt6-after/qt6-migrated-legatus" # Run inside Docker: perform clean build directory, configure with Qt6, build and run ctest # Note: Pass HOST path (pwd) which gets mounted to /repo in container HOST_REPO_PATH="$(cd "$(dirname "$0")/.." && pwd)" ./app/run_docker.sh "$HOST_REPO_PATH" -- bash -lc \ "set -euo pipefail && \ export LD_LIBRARY_PATH=/opt/Qt/6.8.3/gcc_64/lib:\${LD_LIBRARY_PATH:-} && \ export QT_QPA_PLATFORM=offscreen && \ export RTI_LICENSE_FILE=/repo/rti_license.dat && \ export DDS_PATH=/repo/external/rti_connext_dds-7.7.0 && \ export CMAKE_CXX_STANDARD=17 && \ unset MIGRATE_MODULE && \ (rm -rf /repo/build || sudo rm -rf /repo/build) && \ mkdir -p /repo/build/bin && \ if [ -f /repo/build_rti_off/bin/ngl_codegen ]; then \ cp /repo/build_rti_off/bin/ngl_codegen /repo/build/bin/ngl_codegen && \ echo 'Copied pre-built ngl_codegen to build/bin'; \ else \ echo 'Warning: Pre-built ngl_codegen not found, build may fail if codegen is needed'; \ fi && \ cmake -S /repo/${SUBMODULE_PATH} -B /repo/build -G Ninja -DCMAKE_PREFIX_PATH=/opt/Qt/6.8.3/gcc_64 -DBUILD_WS=ON -DBUILD_TESTING=ON -DBUILD_RTI=ON && \ if [ -f /repo/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/DDS/Core/core_json.cpp ]; then \ echo 'Patching core_json.cpp for Qt6/C++17 compatibility...' && \ /repo/patch_core_json.sh; \ fi && \ if [ -f /repo/qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/DDS/Core/core_dtc.h ]; then \ echo 'Patching core_dtc.h for DTC type aliases...' && \ /repo/patch_core_dtc_h.sh; \ fi && \ cmake --build /repo/build -- -j${JOBS} && \ ctest --test-dir /repo/build --output-on-failure" echo "Final migration build + tests complete. See ./build for artifacts and test logs in ./build/Testing/Temporary."