Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/docker_build.sh
T

82 lines
2.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
# 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 "
apt-get update -qq && \
apt-get install -y -qq \
build-essential \
cmake \
libkf6texttemplate-dev \
libqt6core6 \
libqt6gui6 \
libqt6widgets6 \
qt6-base-dev \
qt6-tools-dev-tools \
qt6-tools-dev \
qt6-l10n-tools \
libgtest-dev \
libpq-dev \
postgresql-server-dev-all \
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_ARCGIS=OFF \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_BUILD_TYPE=Release
make -j8 ddscore ddsftccore ddsQoS ddsconnector ddsfts migration_tests 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
"