Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/docker_build.sh
T
berrux-dev 5381c65fee Merge feature/qt6-migration-basis-modules-services into feature/qt6-migration-basis-modules
Resolves 17 conflicts against legacy Qt5 semantics; validates with BUILD_RTI=ON BUILD_GRANTLEE=ON.
2026-09-24 10:10:25 +02:00

181 lines
7.3 KiB
Bash
Executable File

#!/bin/bash
set -e
# Check if .envrc exists
if [ ! -f .envrc ]; then
echo "ERROR: .envrc not found in current directory"
echo "Please create .envrc with required environment variables (e.g., MIGRATE_PIPELINE_ROOT)"
exit 1
fi
# Load environment variables from .envrc
set -a
source .envrc
set +a
# Allow BUILD_RTI to be overridden via environment variable or argument
BUILD_RTI="${BUILD_RTI:-ON}"
if [ "$1" = "OFF" ]; then
BUILD_RTI=OFF
elif [ "$1" = "ON" ]; then
BUILD_RTI=ON
fi
# BUILD_GRANTLEE must be ON: codegen (IDL/DTC/FTC/SQL) generation is required
# for the migrated services. Only the ON variant is supported and validated.
BUILD_GRANTLEE="${BUILD_GRANTLEE:-ON}"
# Run CMake configuration and build inside Docker
docker run --rm \
-e MIGRATE_PIPELINE_ROOT \
-e LANG \
-e LC_ALL \
-e BUILD_RTI \
-v ${MIGRATE_PIPELINE_ROOT}:/workspace \
-v ${MIGRATE_PIPELINE_ROOT}/rti_license.dat:/workspace/rti_license.dat \
-w /workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus \
ubuntu:26.04 bash -c "
# Fail the container on any command error and on failing pipeline
# stages (the make call below pipes through tee, which would otherwise
# mask a non-zero make exit code).
set -eo pipefail
apt-get update -qq && \
apt-get install -y -qq \
build-essential \
cmake \
libboost-dev \
libkf6texttemplate-dev \
libqt6core6 \
libqt6gui6 \
libqt6widgets6 \
qt6-base-dev \
qt6-svg-dev \
qt6-websockets-dev \
qt6-serialport-dev \
qt6-tools-dev-tools \
qt6-tools-dev \
qt6-l10n-tools \
libgtest-dev \
libpq-dev \
postgresql-server-dev-all \
libqt6sql6-psql \
libvlc-dev \
vlc-plugin-base \
git > /dev/null 2>&1
# Set RTI license
export RTI_LICENSE_FILE=/workspace/rti_license.dat
# Set Qt platform for headless testing (required for gtest_discover_tests)
export QT_QPA_PLATFORM=offscreen
# Qt6 is installed via apt - CMake finds it automatically in /usr/lib/x86_64-linux-gnu/cmake
# Clean and configure
rm -rf build4
mkdir -p build4
cd build4
cmake .. \
-DBUILD_RTI=${BUILD_RTI} \
-DBUILD_GRANTLEE=${BUILD_GRANTLEE} \
-DBUILD_ARCGIS=OFF \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_BUILD_TYPE=Release
# Validation builds the full service set, not only the two services that
# happened to be migrated first: every service library, the per-service
# test executables, and the shared libraries they need. Targets that are
# known blocked for reasons outside this migration are excluded below, so
# a green run means every migratable service actually compiles.
#
# Excluded, each for a dependency this migration cannot supply:
# svcTargetManagement - needs SituationMap::ElevationMap /
# LineOfSightCalculation, the GDAL module
# whose CMakeLists states it was never
# migrated (main_handler.h:18 includes
# <ElevationMap/elevation_map.h>).
# svcExerciseManagement - needs QStateMachine / QState, moved from
# svcInfrastructureManagement QtCore to the Qt SCXML module in Qt6
# exmStateMachineTest (Qt6::StateMachine). No qt6-scxml-dev in
# the image and qstatemachine.h is absent.
make -j8 \
ddscore ddsftccore ddsQoS ddsconnector ddsfts migration_tests \
NGLLogger nglapplication nglcompression nglcoreapplication ngldb \
nglguiapplication nglsettings nglsingleapplication nglsinglecoreapplication \
ngltools ngltranslator nglwidgets qtsingleapplication qtsinglecoreapplication \
wms_json_ds tcpserver \
svcAesClient svcAesCommon svcAesServer \
svcAlmClient svcAlmCommon svcAlmServer \
svcAreaEffectSimulation \
svcAsmClient svcAsmCommon svcAsmServer svcAssetManagement \
svcAudioVideoManagement \
svcAvmClient svcAvmCommon svcAvmServer \
svcBldClient svcBldCommon svcBldServer svcBuildings \
svcCentralEffectSimulation \
svcCesClient svcCesCommon svcCesDDSCommon svcCesGeoPairingImpl svcCesServer \
svcCmoClient svcCmoCommon svcCmoServer \
svcCnrHelper svcCodClient svcCodCommon svcCodServer \
svcCombatNetRadio svcComponentMonitor svcCoreClient svcDifferentialGPS \
svcEemClient svcEemCommon svcEemServer \
svcEffectShowClient \
svcEscClient svcEscCommon svcEscServer \
svcEsmClient svcEsmCommon svcEsmServer \
svcEvlClient svcEvlCommon svcEvlServer \
svcExerciseEventManagement \
svcExmClient svcExmCommon svcExmServer \
svcFileManagement svcFilterManagement \
svcFlmClient svcFlmCommon svcFlmServer \
svcFltClient svcFltCommon svcFltServer \
svcGimClient svcGimCommon svcGimServer svcGmpServer \
svcGnaClient svcGnaCommon svcGnaServer \
svcGuezIedManagement \
svcIsmClient svcIsmCommon svcIsmServer \
svcMapDummy \
svcMdmClient svcMdmCommon svcMdmServer \
svcMessaging svcMeteoDataManagement \
svcMrkClient svcMrkCommon svcMrkServer \
svcMsgClient svcMsgCommon svcMsgServer \
svcNomClient svcNomCommon svcNomServer svcNotificationManagement \
svcNmeClient svcNmeCommon svcNmeServer svcNmeaManagement \
svcObdClient svcObdCommon svcObdServer \
svcOcBaseDownload svcOcSituationClient svcOcSituationServer \
svcOperatorManagement \
svcOpmClient svcOpmCommon svcOpmServer \
svcOreDummy \
svcOscClient svcOscCommon svcOscServer \
svcOssClient svcOssCommon svcOssServer \
svcParticipantManagement \
svcPdmClient svcPdmCommon svcPdmServer svcPedDummy \
svcPpmClient svcPpmCommon svcPpmServer \
svcPreClient svcPreCommon svcPreServer svcProjectDataManagement svcPwsCommon \
svcRecCommon svcRecordingManagement \
svcRepClient svcRepCommon svcRepCommonExecutable svcRepServer \
svcReportAnalyzer svcReportGenerator \
svcScmClient svcScmCommon svcScmServer svcScrDummy \
svcServiceManagement svcSituationReplay svcSmoDummy \
svcSomClient svcSomCommon svcSomServer svcSoundManagement svcSrmCommon \
svcSrpClient svcSrpCommon svcSrpServer \
svcTabClient svcTabCommon svcTabServer \
svcTabocClient svcTabocCommon svcTabocServer \
svcTgtClient svcTgtCommon svcTgtServer \
svcTrainingAreaBase svcTrainingAreaBaseOC \
svcVideoOverlayManagement \
svcWarehouseGuez svcWarehouseManagement \
svcWhgClient svcWhgCommon svcWhgServer \
asmTests avmFtTests avmTests avmVcaTests cesTests eemTests evlTests \
exmDtUnitTest exmTests flmTests gmpTests ismTests \
mrkTests mvsTests nomTests opmTests pdmTests ppmTests preTests repTests \
scmDtUnitTest srpFtTests tgtTests whgTests \
2>&1 | tee build.log
# Run the CTest unit tests as an explicit validation step.
# We are already inside build4 (cd build4 above), so --test-dir is the
# current directory. --output-on-failure surfaces failing test output; a
# non-zero exit propagates through set -e and fails the container validation.
# Set QT_QPA_PLATFORM for headless testing (no display required)
export QT_QPA_PLATFORM=offscreen
ctest --test-dir . --output-on-failure
"