Consolidate the Release 2 driver into new_docker_build.sh
- new_docker_build.sh is now the Release 2 scope driver (4 build groups, 61 targets, Ninja/RelWithDebInfo, /repo mount, 22-test ctest, DEB via rpmbuild/make_rpm_ubuntu26_release2.py); the separate new_docker_build_release2.sh driver is removed. - The Docker image recipe is the in-tree Dockerfile (single source of truth): Ubuntu 26.04 + apt deps (incl. libbz2-dev, libkf6texttemplate-dev) + Qt 6.10.2 via aqtinstall + KDReports from source + ENV PATH/CMAKE_PREFIX_PATH. The driver builds the image from it when it is missing; --no-prebuilt-image now forces a rebuild (the in-container apt path and the inline recipe are gone). Default image: legatus-qt6:1.0. - rpmbuild/make_rpm_ubuntu26_release2.py: bundle new_docker_build.sh in the build-pipeline DEB. - jenkins-ci-rme/release-16-10-2026.sh: drop the --build-prebuilt-image step (no longer an option; the driver auto-builds the image when missing). - README.md: document the Release 2 driver, the 22-test ctest baseline, the real DEB layout, the options and the known quirks.
This commit is contained in:
1 parent
b18ac87565
commit
679e7a8a9c
6 files changed
+356
-1262
No files matched your search
@@ -1,25 +1,43 @@
|
||||
# Prebuilt build image for the release validation-scope branch
|
||||
# (Ubuntu 26.04 + Qt6 + all dependencies for the legatus release build).
|
||||
# Prebuilt build image for the Release 2 scope
|
||||
# (Ubuntu 26.04 + Qt 6.10.2 + all dependencies for the legatus release 2 build).
|
||||
#
|
||||
# Built by new_docker_build.sh --build-prebuilt-image, which passes the
|
||||
# package list and Qt settings as build args (see build_prebuilt_image()).
|
||||
# This is the single source of truth for the image recipe:
|
||||
# new_docker_build.sh builds the image from this file when the image is
|
||||
# missing (--use-prebuilt-image, the default) or must be rebuilt
|
||||
# (--no-prebuilt-image).
|
||||
#
|
||||
# Note: libbz2-dev (BZip2) is required by Z/src/nglcompression.
|
||||
|
||||
FROM ubuntu:26.04
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
ARG APT_PACKAGES
|
||||
ARG QT_VERSION=6.10.2
|
||||
ARG QT_ARCH=linux_gcc_64
|
||||
ARG QT_BASE_DIR=/opt/Qt
|
||||
|
||||
RUN apt-get update -qq && \
|
||||
apt-get install -y -qq \
|
||||
${APT_PACKAGES} \
|
||||
libqt6svg6-dev \
|
||||
build-essential \
|
||||
cmake \
|
||||
ninja-build \
|
||||
git \
|
||||
python3-pip \
|
||||
libboost-dev \
|
||||
libbz2-dev \
|
||||
libgl1-mesa-dev \
|
||||
pkg-config \
|
||||
libkf6texttemplate-dev \
|
||||
libgtest-dev \
|
||||
libgmock-dev \
|
||||
python3-pip && \
|
||||
libpq-dev \
|
||||
postgresql-server-dev-all \
|
||||
libvlc-dev \
|
||||
vlc-plugin-base \
|
||||
libssl-dev \
|
||||
libxml2-dev \
|
||||
libxerces-c-dev \
|
||||
&& \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Qt6 packages via aqtinstall
|
||||
@@ -30,18 +48,19 @@ RUN pip3 install --break-system-packages --quiet aqtinstall && \
|
||||
--outputdir ${QT_BASE_DIR} && \
|
||||
rm -rf /root/.cache/Aqt
|
||||
|
||||
# Install KDReports from source (apt package not available in Ubuntu 22.04/26.04)
|
||||
# Try apt install first (will fail), then build from KDAB GitHub mirror
|
||||
RUN apt-get install -y -qq libkdreports-dev 2>/dev/null || \
|
||||
(git clone --depth 1 https://github.com/KDAB/KDReports.git /tmp/KDReports && \
|
||||
# Install KDReports from source (no apt package on Ubuntu 26.04)
|
||||
RUN git clone --depth 1 https://github.com/KDAB/KDReports.git /tmp/KDReports && \
|
||||
cd /tmp/KDReports && \
|
||||
mkdir build && cd build && \
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_PREFIX_PATH=${QT_BASE_DIR} .. && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
cd / && rm -rf /tmp/KDReports)
|
||||
cd / && rm -rf /tmp/KDReports
|
||||
|
||||
# Legacy sources include <KDReports/...>
|
||||
RUN ln -sfn KDReports-qt6 /usr/local/include/KDReports
|
||||
|
||||
ENV PATH="${QT_BASE_DIR}/${QT_VERSION}/gcc_64/bin:${PATH}"
|
||||
ENV CMAKE_PREFIX_PATH="${QT_BASE_DIR}/${QT_VERSION}/gcc_64"
|
||||
|
||||
CMD ["/bin/bash"]
|
||||
@@ -6,7 +6,7 @@ needs Docker.
|
||||
|
||||
## Scope
|
||||
|
||||
`new_docker_build_release2.sh` builds the Release 2 scope in four
|
||||
`new_docker_build.sh` builds the Release 2 scope in four
|
||||
groups (all ON by default, toggle with `--groupN` / `--no-groupN`):
|
||||
|
||||
| Group | Area | Contents |
|
||||
@@ -21,9 +21,9 @@ groups (all ON by default, toggle with `--groupN` / `--no-groupN`):
|
||||
|
||||
Entries at the tree root:
|
||||
|
||||
- `new_docker_build_release2.sh` — build driver (compile, ctest, DEB packaging)
|
||||
- `new_docker_build.sh` — build driver (compile, ctest, DEB packaging)
|
||||
- `rpmbuild/make_rpm_ubuntu26_release2.py` — in-tree DEB package producer (self-contained)
|
||||
- `Dockerfile` — image recipe kept for the legacy validation-scope driver and for the `qt6-release-build-pipeline` DEB; the Release 2 driver carries the same recipe built in and builds the image automatically when it is missing
|
||||
- `Dockerfile` — the image recipe (single source of truth); the driver builds the image from it when the image is missing or when `--no-prebuilt-image` forces a rebuild (also bundled into the `qt6-release-build-pipeline` DEB)
|
||||
- `rti_license.dat` — RTI Connext DDS license, required by the DDS group (GROUP1)
|
||||
- `jenkins-ci-rme/` — in-tree copy of the Jenkins CI flow (see its own `README.md`; still wired to the legacy driver, see Step 5)
|
||||
- `../build/` — build tree, created by the driver **next to the tree** (`qt6-after/build`), never inside it (git-ignored scratch area)
|
||||
@@ -60,21 +60,23 @@ All commands below are run **from this directory**
|
||||
## Step 1 — Build the prebuilt Docker image (once)
|
||||
|
||||
```bash
|
||||
./new_docker_build_release2.sh --docker-image legatus-qt6:1.0
|
||||
./new_docker_build.sh --docker-image legatus-qt6:1.0
|
||||
```
|
||||
|
||||
`--docker-image` selects the prebuilt-image mode: if the named image
|
||||
does not exist yet, the driver builds it automatically from its
|
||||
built-in recipe (Ubuntu 26.04 base, apt deps, Qt 6.10.2 via
|
||||
does not exist yet, the driver builds it automatically from the
|
||||
in-tree `./Dockerfile` (Ubuntu 26.04 base, apt deps, Qt 6.10.2 via
|
||||
`aqtinstall`, KDReports from source) and continues with the build.
|
||||
The default image name is `qt6-migrated-legatus-release2`. This driver
|
||||
`--no-prebuilt-image` forces a (re)build of the image from
|
||||
`./Dockerfile` before running.
|
||||
The default image name is `legatus-qt6:1.0`. This driver
|
||||
has no `--build-prebuilt-image` / `--delete-prebuilt-image` options —
|
||||
manage the image with plain `docker` if needed.
|
||||
|
||||
## Step 2 — Build the Release 2 scope
|
||||
|
||||
```bash
|
||||
./new_docker_build_release2.sh --docker-image legatus-qt6:1.0 \
|
||||
./new_docker_build.sh --docker-image legatus-qt6:1.0 \
|
||||
> build.log 2>&1
|
||||
```
|
||||
|
||||
@@ -203,7 +205,7 @@ prefix** the configure used (the driver mounts the pipeline root at
|
||||
## Step 4 — Produce the release DEB packages
|
||||
|
||||
```bash
|
||||
./new_docker_build_release2.sh --docker-image legatus-qt6:1.0 \
|
||||
./new_docker_build.sh --docker-image legatus-qt6:1.0 \
|
||||
--run-jenkins-builder \
|
||||
> /path/to/build.log 2>&1
|
||||
```
|
||||
@@ -244,10 +246,9 @@ dpkg -c "<pipeline-root>/rpms/guez/26.04/qt6-release-ctest-runtime_1.0-1_amd64.d
|
||||
## Step 5 — CI / Jenkins flow (optional)
|
||||
|
||||
The in-tree `jenkins-ci-rme/` directory contains the full Jenkins
|
||||
pipeline (`Jenkinsfile`, builder, publisher) adapted to this tree.
|
||||
**Note:** it is still wired to the legacy `new_docker_build.sh`
|
||||
driver and has not been switched to `new_docker_build_release2.sh`
|
||||
yet. See `jenkins-ci-rme/README.md` for the pipeline details.
|
||||
pipeline (`Jenkinsfile`, builder, publisher) adapted to this tree; the
|
||||
in-tree flow calls `new_docker_build.sh` (the Release 2 driver). See
|
||||
`jenkins-ci-rme/README.md` for the pipeline details.
|
||||
|
||||
## Step 6 — Code coverage (lcov)
|
||||
|
||||
@@ -260,7 +261,7 @@ coverage step.
|
||||
|
||||
## Options reference
|
||||
|
||||
`./new_docker_build_release2.sh --help` prints the full option list.
|
||||
`./new_docker_build.sh --help` prints the full option list.
|
||||
The main ones:
|
||||
|
||||
| Option | Default | Purpose |
|
||||
@@ -271,8 +272,8 @@ The main ones:
|
||||
| `--group6` / `--no-group6` | ON | Generators (AP9) |
|
||||
| `--no-ctest` | — | skip the ctest step |
|
||||
| `--tests-only` | — | see Known quirks |
|
||||
| `--use-prebuilt-image` / `--no-prebuilt-image` | off | prebuilt image mode (`--docker-image` turns it on) |
|
||||
| `--docker-image IMAGE` | `qt6-migrated-legatus-release2` | image to use (auto-built if missing) |
|
||||
| `--use-prebuilt-image` / `--no-prebuilt-image` | on | use the image (build from `./Dockerfile` if missing) / force a rebuild from `./Dockerfile` |
|
||||
| `--docker-image IMAGE` | `legatus-qt6:1.0` | image to use (auto-built if missing) |
|
||||
| `--cmake_build_flags FLAGS` | — | extra `-D` flags appended to the configure |
|
||||
| `--docker-mount-root PATH` | `/repo` | container-side mount root |
|
||||
| `--run-jenkins-builder` | off | produce the DEB packages (Step 4) |
|
||||
@@ -318,7 +319,3 @@ Environment overrides: `BUILD_GROUP1/3/5/6`, `RUN_CTEST`, `TESTS_ONLY`,
|
||||
- `--tests-only` is documented in `--help` as "run only ctest, skip all
|
||||
build groups", but the current implementation only skips the ctest
|
||||
step; the group builds still run.
|
||||
- The legacy driver `new_docker_build.sh` (validation scope) is kept in
|
||||
the tree and is still used by `jenkins-ci-rme/`; its in-tree
|
||||
`Dockerfile` recipe does not include `libbz2-dev` (BZip2), which the
|
||||
Release 2 driver's built-in recipe does.
|
||||
@@ -1,11 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Local release pipeline for the Qt6-migrated legatus validation scope
|
||||
# (TetraIF, Z, Lts/Common + Lts/Proxies/TrainingAreaBase).
|
||||
# Local release pipeline for the Qt6-migrated legatus Release 2 scope
|
||||
# (AP3 Lts services + core stack, AP4 DDS, AP9 Viewer/tools/generators).
|
||||
#
|
||||
# Runs the in-tree new_docker_build.sh:
|
||||
# - builds the prebuilt Docker image from the in-tree Dockerfile when the
|
||||
# image is not present yet
|
||||
# Runs the in-tree new_docker_build.sh (Release 2 driver):
|
||||
# - builds the prebuilt Docker image from the in-tree Dockerfile
|
||||
# when the image is not present yet
|
||||
# - builds the release scope, runs ctest and produces the release DEB
|
||||
# packages with the in-tree rpmbuild script
|
||||
# - collects the lcov code-coverage report (--run-coverage; set
|
||||
@@ -45,14 +45,10 @@ log_info "Package output: ${WORKSPACE}/rpms/${PROJECT}/${OS_VERSION}/"
|
||||
|
||||
cd "${LEGATUS_ROOT}"
|
||||
|
||||
# Build the prebuilt image from the in-tree Dockerfile when not present yet
|
||||
# (--build-prebuilt-image builds the image and exits)
|
||||
if ! docker image inspect "${DOCKER_IMAGE}" >/dev/null 2>&1; then
|
||||
log_info "Prebuilt image not found - building it from the in-tree Dockerfile..."
|
||||
bash ./new_docker_build.sh --build-prebuilt-image --docker-image "${DOCKER_IMAGE}"
|
||||
fi
|
||||
# (The driver auto-builds the prebuilt image from the in-tree Dockerfile
|
||||
# when the image is not present yet.)
|
||||
|
||||
# Release scope build + ctest + DEB production (in-tree rpmbuild)
|
||||
# Release 2 scope build + ctest + DEB production (in-tree rpmbuild)
|
||||
bash ./new_docker_build.sh \
|
||||
--docker-image "${DOCKER_IMAGE}" \
|
||||
--run-jenkins-builder \
|
||||
|
||||
@@ -2,565 +2,339 @@
|
||||
set -euo pipefail
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Build helper for the release validation-scope branch of qt-migrated-legatus
|
||||
# Build helper for qt-migrated-legatus inside Docker - RELEASE 2 VERSION
|
||||
#
|
||||
# Builds only the release scope (TetraIF, Z/src, Lts/Common +
|
||||
# Lts/Proxies/TrainingAreaBase) inside the prebuilt Docker image and
|
||||
# optionally runs the Jenkins builder to produce the release DEB packages.
|
||||
# Release 2 Scope:
|
||||
# - AP3: Shared libraries (LtsUtils, Widgets, Session, Krypto, PluginManager)
|
||||
# - AP4: DDS middleware (Core, DDSConnector, Routing, QosProfile, RTI layer)
|
||||
# - AP9: Tools and translations (DdsView, LogViewer, SqlBrowser, generators,
|
||||
# lupdate)
|
||||
#
|
||||
# - Resolves MIGRATE_PIPELINE_ROOT (exported variable, .envrc, or derived
|
||||
# from the script location = repo root) for the workspace mount
|
||||
# - Uses a prebuilt Docker image with all build dependencies installed
|
||||
# (build it from ./Dockerfile via --build-prebuilt-image)
|
||||
# - Optional deletion of the prebuilt Docker image via --delete-prebuilt-image
|
||||
# - Optional DEB package production via the in-tree rpmbuild/
|
||||
# make_rpm_ubuntu26.py (self-contained - no outer-repo dependencies)
|
||||
# - Uses a temporary container-side script for robust execution
|
||||
# The Docker image recipe lives in ./Dockerfile (single source of truth:
|
||||
# Ubuntu 26.04 + apt deps + Qt 6.10.2 via aqtinstall + KDReports from
|
||||
# source). The image is built from it when missing or when
|
||||
# --no-prebuilt-image forces a rebuild.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage: ./new_docker_build.sh [options]
|
||||
|
||||
Builds the release validation scope inside the prebuilt Docker image:
|
||||
RELEASE_BUILD=ON (fixed) - TetraIF, Z, Lts/Common (+ TrainingAreaBase)
|
||||
ctest runs for the release scope test executables (Lts/Common + Z)
|
||||
Build groups (Release 2 scope, all ON by default):
|
||||
--group1 / --no-group1 DDS middleware (AP4)
|
||||
--group3 / --no-group3 Lts services + core stack (AP3)
|
||||
--group5 / --no-group5 Viewer module targets and tests (AP9)
|
||||
--group6 / --no-group6 Tools - generators and lupdate (AP9)
|
||||
|
||||
Options:
|
||||
--docker-image IMAGE Docker image name to use/build/delete
|
||||
(default: legatus-qt6:1.0)
|
||||
--build-prebuilt-image Build the prebuilt Docker image (from ./Dockerfile)
|
||||
and exit. To run the build with it, run the script
|
||||
again with --docker-image
|
||||
--delete-prebuilt-image Delete the configured Docker image and exit
|
||||
Docker image:
|
||||
--use-prebuilt-image Use the image; build it from ./Dockerfile if missing
|
||||
(default)
|
||||
--no-prebuilt-image Force a (re)build of the image from ./Dockerfile
|
||||
--docker-image IMAGE Image name (default: legatus-qt6:1.0);
|
||||
implies --use-prebuilt-image
|
||||
--docker-mount-root PATH Container-side mount root (default: /repo)
|
||||
--cmake_build_flags FLAGS Extra -D flags appended to the configure
|
||||
|
||||
Package production options (RPM/DEB):
|
||||
--run-jenkins-builder Build the release DEB packages inside the container
|
||||
using the in-tree rpmbuild/make_rpm_ubuntu26.py
|
||||
--package-output-dir DIR Directory to mount for package output (default: ./packages-out)
|
||||
--lts-version VERSION LTS version for package (default: 1.0)
|
||||
--project NAME Project name for package (default: guez)
|
||||
--build-number NUM Build number for package (default: 1)
|
||||
--build-tag TAG Build tag for package (default: manual-build)
|
||||
Tests:
|
||||
--no-ctest Skip the ctest step
|
||||
--tests-only See README.md "Known quirks"
|
||||
|
||||
Coverage options (lcov):
|
||||
--run-coverage Build the release scope with -O0 --coverage, run ctest
|
||||
and collect an lcov coverage report (mutually
|
||||
exclusive with --run-jenkins-builder)
|
||||
--coverage-output-dir DIR Directory to mount for coverage output
|
||||
(default: ./coverage-out)
|
||||
Packages (DEB, via in-tree rpmbuild/make_rpm_ubuntu26_release2.py):
|
||||
--run-jenkins-builder Produce the release DEB packages
|
||||
--package-output-dir DIR Directory for package output (default: ./packages-out)
|
||||
--lts-version VERSION LTS version for the package (default: 1.0)
|
||||
--project NAME Project name for the package (default: guez)
|
||||
--build-number NUM Build number for the package (default: 1)
|
||||
--build-tag TAG Build tag for the package (default: manual-build)
|
||||
|
||||
Environment variable overrides:
|
||||
BUILD_PREBUILT_IMAGE=ON|OFF
|
||||
DELETE_PREBUILT_IMAGE=ON|OFF
|
||||
DOCKER_IMAGE=<image-name>
|
||||
RUN_JENKINS_BUILDER=ON|OFF
|
||||
PACKAGE_OUTPUT_DIR=<dir>
|
||||
LTS_VERSION=<version>
|
||||
PROJECT=<name>
|
||||
GUEZ_MODE=ON|OFF
|
||||
BUILD_NUMBER=<num>
|
||||
BUILD_TAG=<tag>
|
||||
RUN_COVERAGE=ON|OFF
|
||||
COVERAGE_OUTPUT_DIR=<dir>
|
||||
Coverage (lcov):
|
||||
--run-coverage Coverage build + lcov report (README.md Step 6)
|
||||
--coverage-output-dir DIR Directory for coverage output (default: ./coverage-out)
|
||||
|
||||
MIGRATE_PIPELINE_ROOT resolution (highest precedence first):
|
||||
1. exported MIGRATE_PIPELINE_ROOT (e.g. from a Jenkinsfile)
|
||||
2. MIGRATE_PIPELINE_ROOT set by .envrc in this directory
|
||||
3. derived from the script location (the DLBO Qt6 repo root)
|
||||
Environment overrides: BUILD_GROUP1/3/5/6, RUN_CTEST, TESTS_ONLY,
|
||||
USE_PREBUILT_IMAGE, DOCKER_IMAGE, CMAKE_BUILD_FLAGS, DOCKER_MOUNT_ROOT,
|
||||
GUEZ_MODE, RUN_JENKINS_BUILDER, PACKAGE_OUTPUT_DIR, LTS_VERSION, PROJECT,
|
||||
BUILD_NUMBER, BUILD_TAG, RUN_COVERAGE, COVERAGE_OUTPUT_DIR.
|
||||
|
||||
Examples:
|
||||
./new_docker_build.sh --build-prebuilt-image --docker-image legatus-qt6:1.0
|
||||
./new_docker_build.sh --docker-image legatus-qt6:1.0
|
||||
./new_docker_build.sh --delete-prebuilt-image --docker-image legatus-qt6:1.0
|
||||
./new_docker_build.sh --docker-image legatus-qt6:1.0 \
|
||||
--run-jenkins-builder \
|
||||
--package-output-dir "${WORKSPACE}/rpms/${PROJECT}/${OS_VERSION}/"
|
||||
./new_docker_build.sh --docker-image legatus-qt6:1.0 \
|
||||
--run-coverage \
|
||||
--coverage-output-dir "${WORKSPACE}/coverage/${PROJECT}/${OS_VERSION}/"
|
||||
MIGRATE_PIPELINE_ROOT (highest precedence first): exported environment
|
||||
variable > .envrc in this directory > the script's own location.
|
||||
EOF
|
||||
}
|
||||
|
||||
log_info() {
|
||||
printf 'INFO: %s\n' "$*"
|
||||
}
|
||||
|
||||
log_error() {
|
||||
printf 'ERROR: %s\n' "$*" >&2
|
||||
}
|
||||
|
||||
die() {
|
||||
log_error "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
require_command() {
|
||||
local cmd="$1"
|
||||
command -v "$cmd" >/dev/null 2>&1 || die "Required command not found: ${cmd}"
|
||||
log_info() {
|
||||
echo "[INFO] $*"
|
||||
}
|
||||
|
||||
require_file() {
|
||||
local path="$1"
|
||||
local label="$2"
|
||||
[[ -f "$path" ]] || die "${label} not found: ${path}"
|
||||
die() {
|
||||
echo "[ERROR] $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
require_directory() {
|
||||
local path="$1"
|
||||
local label="$2"
|
||||
[[ -d "$path" ]] || die "${label} directory not found: ${path}"
|
||||
}
|
||||
# -----------------------------------------------------------------------------
|
||||
# Default values
|
||||
BUILD_GROUP1="${BUILD_GROUP1:-ON}" # AP4: DDS
|
||||
BUILD_GROUP3="${BUILD_GROUP3:-ON}" # AP3: Lts services
|
||||
BUILD_GROUP5="${BUILD_GROUP5:-ON}" # AP9: Viewer
|
||||
BUILD_GROUP6="${BUILD_GROUP6:-ON}" # AP9: Tools/generators
|
||||
RUN_CTEST="${RUN_CTEST:-ON}"
|
||||
TESTS_ONLY="${TESTS_ONLY:-OFF}"
|
||||
USE_PREBUILT_IMAGE="${USE_PREBUILT_IMAGE:-ON}"
|
||||
DOCKER_IMAGE="${DOCKER_IMAGE:-legatus-qt6:1.0}"
|
||||
CMAKE_BUILD_FLAGS="${CMAKE_BUILD_FLAGS:-}"
|
||||
DOCKER_MOUNT_ROOT="${DOCKER_MOUNT_ROOT:-/repo}"
|
||||
export DOCKER_MOUNT_ROOT
|
||||
|
||||
require_non_empty() {
|
||||
local value="$1"
|
||||
local name="$2"
|
||||
[[ -n "$value" ]] || die "Required variable ${name} is not set or empty"
|
||||
}
|
||||
# Jenkins builder options for DEB package production
|
||||
GUEZ_MODE="${GUEZ_MODE:-ON}"
|
||||
RUN_JENKINS_BUILDER="${RUN_JENKINS_BUILDER:-OFF}"
|
||||
PACKAGE_OUTPUT_DIR="${PACKAGE_OUTPUT_DIR:-./packages-out}"
|
||||
LTS_VERSION="${LTS_VERSION:-1.0}"
|
||||
PROJECT="${PROJECT:-guez}"
|
||||
BUILD_NUMBER="${BUILD_NUMBER:-1}"
|
||||
BUILD_TAG="${BUILD_TAG:-manual-build}"
|
||||
|
||||
normalize_on_off() {
|
||||
local value="$1"
|
||||
local name="$2"
|
||||
# Code coverage (lcov)
|
||||
RUN_COVERAGE="${RUN_COVERAGE:-OFF}"
|
||||
COVERAGE_OUTPUT_DIR="${COVERAGE_OUTPUT_DIR:-./coverage-out}"
|
||||
|
||||
case "${value^^}" in
|
||||
ON|OFF)
|
||||
printf '%s\n' "${value^^}"
|
||||
;;
|
||||
*)
|
||||
die "Invalid value for ${name}: ${value}. Expected ON or OFF"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
join_by() {
|
||||
local delimiter="$1"
|
||||
shift || true
|
||||
local first=1
|
||||
local arg
|
||||
|
||||
for arg in "$@"; do
|
||||
if [[ $first -eq 1 ]]; then
|
||||
printf '%s' "$arg"
|
||||
first=0
|
||||
else
|
||||
printf '%s%s' "$delimiter" "$arg"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
cleanup_temp_dir() {
|
||||
local dir="${1:-}"
|
||||
if [[ -n "$dir" && -d "$dir" ]]; then
|
||||
rm -rf "$dir"
|
||||
fi
|
||||
}
|
||||
|
||||
delete_prebuilt_image() {
|
||||
local image_name="$1"
|
||||
|
||||
if docker image inspect "$image_name" >/dev/null 2>&1; then
|
||||
log_info "Deleting Docker image: ${image_name}"
|
||||
docker rmi "$image_name"
|
||||
log_info "Docker image deleted successfully: ${image_name}"
|
||||
else
|
||||
log_info "Docker image does not exist, nothing to delete: ${image_name}"
|
||||
fi
|
||||
}
|
||||
|
||||
APT_PACKAGES=(
|
||||
build-essential
|
||||
cmake
|
||||
libboost-dev
|
||||
libboost-all-dev
|
||||
libjson-glib-dev
|
||||
libgeographiclib-dev
|
||||
ninja-build
|
||||
libkf6texttemplate-dev
|
||||
libpoppler-dev
|
||||
libpoppler-qt6-dev
|
||||
libqt6core6
|
||||
libqt6gui6
|
||||
libqt6widgets6
|
||||
libqt6sql6
|
||||
libqt6sql6-psql
|
||||
libqt6test6
|
||||
qt6-base-dev
|
||||
qt6-l10n-tools
|
||||
qt6-serialport-dev
|
||||
qt6-svg-dev
|
||||
qt6-tools-dev-tools
|
||||
qt6-tools-dev
|
||||
qt6-websockets-dev
|
||||
libgtest-dev
|
||||
libpq-dev
|
||||
postgresql-server-dev-all
|
||||
git
|
||||
python3-pip
|
||||
# Code coverage (genhtml ships in the same package)
|
||||
lcov
|
||||
# Packaging tools for RPM/DEB build
|
||||
rpm
|
||||
debhelper
|
||||
dpkg-dev
|
||||
fakeroot
|
||||
devscripts
|
||||
)
|
||||
|
||||
# Release scope targets: TetraIF + Z components + Lts/Common libraries
|
||||
# and the release-scope test executables (Lts/Common + Z)
|
||||
RELEASE_BUILD_TARGETS=(
|
||||
# TetraIF module targets (CoPrtCnv / LogView / PrtCnv)
|
||||
CoPrtCnv
|
||||
LogViewLogger
|
||||
LogView
|
||||
PrtCnvLib
|
||||
PrtCnv
|
||||
# Z module targets
|
||||
NGLLogger
|
||||
nglapplication
|
||||
nglcompression
|
||||
nglcoreapplication
|
||||
ngldb
|
||||
nglguiapplication
|
||||
nglsettings
|
||||
nglsingleapplication
|
||||
nglsinglecoreapplication
|
||||
ngltools
|
||||
ngltranslator
|
||||
nglwidgets
|
||||
qtsingleapplication
|
||||
qtsinglecoreapplication
|
||||
wms_json_ds
|
||||
tcpserver
|
||||
# Lts/Common library targets (for tests)
|
||||
LtsCoordTrans
|
||||
LtsLicence
|
||||
MockCoordTrans
|
||||
# Test executables for release scope modules
|
||||
# Note: grantlee_parser_smoke excluded - requires ktexttemplate_defaulttags plugin (not in release scope)
|
||||
aes_crypt_test
|
||||
ngltools_qt_smoke
|
||||
lts_coord_trans_unit_test
|
||||
test_nglpdfwidget
|
||||
# TetraIF unit tests (TetraIF/unit-test)
|
||||
coprtcnv_unit_test
|
||||
logview_unit_test
|
||||
prtcnv_unit_test
|
||||
)
|
||||
|
||||
APT_PACKAGES_STRING="$(join_by ' ' "${APT_PACKAGES[@]}")"
|
||||
|
||||
build_prebuilt_image() {
|
||||
local image_name="$1"
|
||||
local dockerfile="Dockerfile"
|
||||
|
||||
require_file "${dockerfile}" "Prebuilt-image Dockerfile"
|
||||
|
||||
# The Dockerfile has no COPY/ADD, so an empty build context is fine -
|
||||
# this avoids tarring the source tree into the build context.
|
||||
local tmp_dir
|
||||
tmp_dir="$(mktemp -d)"
|
||||
|
||||
trap 'cleanup_temp_dir "$tmp_dir"' RETURN
|
||||
|
||||
log_info "Building prebuilt Docker image: ${image_name} (Dockerfile: ${dockerfile})"
|
||||
docker build -t "${image_name}" \
|
||||
-f "${dockerfile}" \
|
||||
--build-arg APT_PACKAGES="${APT_PACKAGES_STRING}" \
|
||||
--build-arg QT_VERSION="${QT_VERSION}" \
|
||||
--build-arg QT_ARCH="${QT_ARCH}" \
|
||||
--build-arg QT_BASE_DIR="${QT_BASE_DIR}" \
|
||||
"${tmp_dir}"
|
||||
log_info "Prebuilt Docker image created successfully: ${image_name}"
|
||||
}
|
||||
|
||||
require_command docker
|
||||
# Export variables for Docker container
|
||||
export BUILD_GROUP1 BUILD_GROUP3 BUILD_GROUP5 BUILD_GROUP6 RUN_CTEST TESTS_ONLY \
|
||||
USE_PREBUILT_IMAGE RUN_JENKINS_BUILDER PACKAGE_OUTPUT_DIR LTS_VERSION \
|
||||
PROJECT BUILD_NUMBER BUILD_TAG RUN_COVERAGE COVERAGE_OUTPUT_DIR
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# MIGRATE_PIPELINE_ROOT resolution (highest precedence first):
|
||||
# 1. exported MIGRATE_PIPELINE_ROOT (e.g. from a Jenkinsfile)
|
||||
# 2. MIGRATE_PIPELINE_ROOT set by .envrc in this directory
|
||||
# 3. derived from the script location (the DLBO Qt6 repo root)
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
MIGRATE_PIPELINE_ROOT_DEFAULT="${SCRIPT_DIR}"
|
||||
PIPELINE_ROOT_EXPORTED="${MIGRATE_PIPELINE_ROOT:-}"
|
||||
|
||||
if [[ -f ".envrc" ]]; then
|
||||
set -a
|
||||
source ".envrc"
|
||||
source .envrc
|
||||
set +a
|
||||
fi
|
||||
|
||||
# An explicitly exported MIGRATE_PIPELINE_ROOT (Jenkinsfile) wins over .envrc
|
||||
if [[ -n "${PIPELINE_ROOT_EXPORTED}" ]]; then
|
||||
MIGRATE_PIPELINE_ROOT="${PIPELINE_ROOT_EXPORTED}"
|
||||
else
|
||||
MIGRATE_PIPELINE_ROOT="${MIGRATE_PIPELINE_ROOT:-${MIGRATE_PIPELINE_ROOT_DEFAULT}}"
|
||||
fi
|
||||
|
||||
# Fixed configuration for the release validation-scope branch
|
||||
RELEASE_BUILD=ON
|
||||
RUN_CTEST=ON
|
||||
BUILD_PREBUILT_IMAGE="${BUILD_PREBUILT_IMAGE:-OFF}"
|
||||
DELETE_PREBUILT_IMAGE="${DELETE_PREBUILT_IMAGE:-OFF}"
|
||||
# Jenkins builder options for RPM/DEB package production
|
||||
RUN_JENKINS_BUILDER="${RUN_JENKINS_BUILDER:-OFF}"
|
||||
PACKAGE_OUTPUT_DIR="${PACKAGE_OUTPUT_DIR:-./packages-out}"
|
||||
# Code coverage (lcov)
|
||||
RUN_COVERAGE="${RUN_COVERAGE:-OFF}"
|
||||
COVERAGE_OUTPUT_DIR="${COVERAGE_OUTPUT_DIR:-./coverage-out}"
|
||||
LTS_VERSION="${LTS_VERSION:-1.0}"
|
||||
PROJECT="${PROJECT:-guez}"
|
||||
GUEZ_MODE="${GUEZ_MODE:-ON}"
|
||||
BUILD_NUMBER="${BUILD_NUMBER:-1}"
|
||||
BUILD_TAG="${BUILD_TAG:-manual-build}"
|
||||
export QT_VERSION="${QT_VERSION:-6.10.2}"
|
||||
export QT_ARCH="${QT_ARCH:-linux_gcc_64}"
|
||||
# aqtinstall uses 'linux_gcc_64' but creates directory 'gcc_64'
|
||||
export QT_ARCH_DIR="${QT_ARCH_DIR:-gcc_64}"
|
||||
export QT_BASE_DIR="${QT_BASE_DIR:-/opt/Qt}"
|
||||
MIGRATE_PIPELINE_ROOT="${PIPELINE_ROOT_EXPORTED:-${MIGRATE_PIPELINE_ROOT:-${SCRIPT_DIR}}}"
|
||||
export MIGRATE_PIPELINE_ROOT
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Parse arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--build-prebuilt-image)
|
||||
BUILD_PREBUILT_IMAGE=ON
|
||||
;;
|
||||
--delete-prebuilt-image)
|
||||
DELETE_PREBUILT_IMAGE=ON
|
||||
;;
|
||||
--docker-image)
|
||||
shift
|
||||
[[ $# -gt 0 ]] || die "--docker-image requires an image name"
|
||||
DOCKER_IMAGE="$1"
|
||||
;;
|
||||
--run-jenkins-builder)
|
||||
RUN_JENKINS_BUILDER=ON
|
||||
;;
|
||||
--package-output-dir)
|
||||
shift
|
||||
[[ $# -gt 0 ]] || die "--package-output-dir requires a directory path"
|
||||
PACKAGE_OUTPUT_DIR="$1"
|
||||
;;
|
||||
--run-coverage)
|
||||
RUN_COVERAGE=ON
|
||||
;;
|
||||
--coverage-output-dir)
|
||||
shift
|
||||
[[ $# -gt 0 ]] || die "--coverage-output-dir requires a directory path"
|
||||
COVERAGE_OUTPUT_DIR="$1"
|
||||
;;
|
||||
--lts-version)
|
||||
shift
|
||||
[[ $# -gt 0 ]] || die "--lts-version requires a version string"
|
||||
LTS_VERSION="$1"
|
||||
;;
|
||||
--project)
|
||||
shift
|
||||
[[ $# -gt 0 ]] || die "--project requires a project name"
|
||||
PROJECT="$1"
|
||||
;;
|
||||
--build-number)
|
||||
shift
|
||||
[[ $# -gt 0 ]] || die "--build-number requires a build number"
|
||||
BUILD_NUMBER="$1"
|
||||
;;
|
||||
--build-tag)
|
||||
shift
|
||||
[[ $# -gt 0 ]] || die "--build-tag requires a build tag"
|
||||
BUILD_TAG="$1"
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
die "Unknown option: $1"
|
||||
;;
|
||||
--group1) BUILD_GROUP1="ON"; shift;;
|
||||
--no-group1) BUILD_GROUP1="OFF"; shift;;
|
||||
--group3) BUILD_GROUP3="ON"; shift;;
|
||||
--no-group3) BUILD_GROUP3="OFF"; shift;;
|
||||
--group5) BUILD_GROUP5="ON"; shift;;
|
||||
--no-group5) BUILD_GROUP5="OFF"; shift;;
|
||||
--group6) BUILD_GROUP6="ON"; shift;;
|
||||
--no-group6) BUILD_GROUP6="OFF"; shift;;
|
||||
--no-ctest) RUN_CTEST="OFF"; shift;;
|
||||
--tests-only) TESTS_ONLY="ON"; shift;;
|
||||
--use-prebuilt-image) USE_PREBUILT_IMAGE="ON"; shift;;
|
||||
--no-prebuilt-image) USE_PREBUILT_IMAGE="OFF"; shift;;
|
||||
--docker-image) DOCKER_IMAGE="$2"; USE_PREBUILT_IMAGE="ON"; shift 2;;
|
||||
--cmake_build_flags) CMAKE_BUILD_FLAGS="$2"; shift 2;;
|
||||
--docker-mount-root) DOCKER_MOUNT_ROOT="$2"; shift 2;;
|
||||
--run-jenkins-builder) RUN_JENKINS_BUILDER="ON"; shift;;
|
||||
--package-output-dir) PACKAGE_OUTPUT_DIR="$2"; shift 2;;
|
||||
--lts-version) LTS_VERSION="$2"; shift 2;;
|
||||
--project) PROJECT="$2"; shift 2;;
|
||||
--build-number) BUILD_NUMBER="$2"; shift 2;;
|
||||
--build-tag) BUILD_TAG="$2"; shift 2;;
|
||||
--run-coverage) RUN_COVERAGE="ON"; shift;;
|
||||
--coverage-output-dir) COVERAGE_OUTPUT_DIR="$2"; shift 2;;
|
||||
-h|--help) usage;;
|
||||
*) die "Unknown option: $1";;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
BUILD_PREBUILT_IMAGE="$(normalize_on_off "$BUILD_PREBUILT_IMAGE" "BUILD_PREBUILT_IMAGE")"
|
||||
DELETE_PREBUILT_IMAGE="$(normalize_on_off "$DELETE_PREBUILT_IMAGE" "DELETE_PREBUILT_IMAGE")"
|
||||
RUN_JENKINS_BUILDER="$(normalize_on_off "$RUN_JENKINS_BUILDER" "RUN_JENKINS_BUILDER")"
|
||||
RUN_COVERAGE="$(normalize_on_off "$RUN_COVERAGE" "RUN_COVERAGE")"
|
||||
|
||||
if [[ "${RUN_COVERAGE}" == "ON" && "${RUN_JENKINS_BUILDER}" == "ON" ]]; then
|
||||
die "--run-coverage is mutually exclusive with --run-jenkins-builder"
|
||||
# Validate mutually exclusive options
|
||||
if [[ "${RUN_JENKINS_BUILDER}" == "ON" ]] && [[ "${RUN_COVERAGE}" == "ON" ]]; then
|
||||
die "Error: --run-jenkins-builder and --run-coverage are mutually exclusive"
|
||||
fi
|
||||
|
||||
# Default for the Docker image name
|
||||
DOCKER_IMAGE="${DOCKER_IMAGE:-legatus-qt6:1.0}"
|
||||
|
||||
# Export variables for Docker container
|
||||
export RELEASE_BUILD RUN_CTEST BUILD_PREBUILT_IMAGE DELETE_PREBUILT_IMAGE DOCKER_IMAGE RUN_JENKINS_BUILDER PACKAGE_OUTPUT_DIR RUN_COVERAGE COVERAGE_OUTPUT_DIR LTS_VERSION PROJECT GUEZ_MODE BUILD_NUMBER BUILD_TAG
|
||||
|
||||
require_non_empty "${DOCKER_IMAGE}" "DOCKER_IMAGE"
|
||||
|
||||
if [[ "${DELETE_PREBUILT_IMAGE}" == "ON" ]]; then
|
||||
delete_prebuilt_image "${DOCKER_IMAGE}"
|
||||
exit 0
|
||||
require_command() {
|
||||
if ! command -v "$1" &> /dev/null; then
|
||||
die "Required command not found: $1"
|
||||
fi
|
||||
|
||||
require_non_empty "${MIGRATE_PIPELINE_ROOT:-}" "MIGRATE_PIPELINE_ROOT"
|
||||
require_directory "${MIGRATE_PIPELINE_ROOT}" "MIGRATE_PIPELINE_ROOT"
|
||||
|
||||
WORKSPACE_ROOT_HOST="${MIGRATE_PIPELINE_ROOT}"
|
||||
PROJECT_DIR_HOST="${WORKSPACE_ROOT_HOST}"
|
||||
|
||||
require_directory "${PROJECT_DIR_HOST}" "Project directory"
|
||||
|
||||
log_info "RELEASE_BUILD=${RELEASE_BUILD}"
|
||||
log_info "RUN_CTEST=${RUN_CTEST}"
|
||||
log_info "BUILD_PREBUILT_IMAGE=${BUILD_PREBUILT_IMAGE}"
|
||||
log_info "DELETE_PREBUILT_IMAGE=${DELETE_PREBUILT_IMAGE}"
|
||||
log_info "DOCKER_IMAGE=${DOCKER_IMAGE}"
|
||||
log_info "RUN_JENKINS_BUILDER=${RUN_JENKINS_BUILDER}"
|
||||
log_info "PACKAGE_OUTPUT_DIR=${PACKAGE_OUTPUT_DIR}"
|
||||
log_info "RUN_COVERAGE=${RUN_COVERAGE}"
|
||||
log_info "COVERAGE_OUTPUT_DIR=${COVERAGE_OUTPUT_DIR}"
|
||||
log_info "LTS_VERSION=${LTS_VERSION}"
|
||||
log_info "PROJECT=${PROJECT}"
|
||||
log_info "GUEZ_MODE=${GUEZ_MODE}"
|
||||
log_info "BUILD_NUMBER=${BUILD_NUMBER}"
|
||||
log_info "BUILD_TAG=${BUILD_TAG}"
|
||||
log_info "MIGRATE_PIPELINE_ROOT=${MIGRATE_PIPELINE_ROOT}"
|
||||
log_info "PROJECT_DIR_HOST=${PROJECT_DIR_HOST}"
|
||||
|
||||
if [[ "${BUILD_PREBUILT_IMAGE}" == "ON" ]]; then
|
||||
build_prebuilt_image "${DOCKER_IMAGE}"
|
||||
|
||||
log_info "Prebuilt image was built successfully."
|
||||
log_info "To run the build with it, run:"
|
||||
printf ' ./new_docker_build.sh --docker-image %q\n' "${DOCKER_IMAGE}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
RELEASE_BUILD_TARGETS_STRING="$(join_by ' ' "${RELEASE_BUILD_TARGETS[@]}")"
|
||||
|
||||
HOST_TEMP_DIR="$(mktemp -d)"
|
||||
CONTAINER_SCRIPT_HOST="${HOST_TEMP_DIR}/run-build-inside-container.sh"
|
||||
cleanup_all() {
|
||||
cleanup_temp_dir "${HOST_TEMP_DIR}"
|
||||
}
|
||||
trap cleanup_all EXIT
|
||||
|
||||
cat > "${CONTAINER_SCRIPT_HOST}" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Fixed configuration for the release validation-scope branch
|
||||
RELEASE_BUILD="${RELEASE_BUILD:-ON}"
|
||||
RUN_CTEST="${RUN_CTEST:-ON}"
|
||||
# Packaging variables
|
||||
RUN_JENKINS_BUILDER="${RUN_JENKINS_BUILDER:-OFF}"
|
||||
RUN_COVERAGE="${RUN_COVERAGE:-OFF}"
|
||||
LTS_VERSION="${LTS_VERSION:-1.0}"
|
||||
PROJECT="${PROJECT:-guez}"
|
||||
GUEZ_MODE="${GUEZ_MODE:-ON}"
|
||||
BUILD_NUMBER="${BUILD_NUMBER:-1}"
|
||||
BUILD_TAG="${BUILD_TAG:-manual-build}"
|
||||
RELEASE_BUILD_TARGETS="${RELEASE_BUILD_TARGETS:-}"
|
||||
QT_VERSION="${QT_VERSION:-6.10.2}"
|
||||
QT_ARCH="${QT_ARCH:-linux_gcc_64}"
|
||||
QT_ARCH_DIR="${QT_ARCH_DIR:-gcc_64}"
|
||||
QT_BASE_DIR="${QT_BASE_DIR:-/opt/Qt}"
|
||||
|
||||
log_info() {
|
||||
printf 'INFO: %s\n' "$*"
|
||||
}
|
||||
|
||||
log_error() {
|
||||
printf 'ERROR: %s\n' "$*" >&2
|
||||
require_command docker
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Validate environment
|
||||
if [[ ! -f ".envrc" ]]; then
|
||||
die ".envrc not found in current directory. Please create .envrc with required environment variables (e.g., MIGRATE_PIPELINE_ROOT)"
|
||||
fi
|
||||
|
||||
if [[ -z "${MIGRATE_PIPELINE_ROOT:-}" ]]; then
|
||||
die "MIGRATE_PIPELINE_ROOT is not set in .envrc"
|
||||
fi
|
||||
|
||||
if [[ ! -d "${MIGRATE_PIPELINE_ROOT}" ]]; then
|
||||
die "MIGRATE_PIPELINE_ROOT directory does not exist: ${MIGRATE_PIPELINE_ROOT}"
|
||||
fi
|
||||
|
||||
# Validate rti_license.dat exists (required for DDS builds).
|
||||
if [[ "${BUILD_GROUP1}" == "ON" ]]; then
|
||||
if [[ ! -f "${MIGRATE_PIPELINE_ROOT}/rti_license.dat" ]] && [[ ! -f "${SCRIPT_DIR}/rti_license.dat" ]]; then
|
||||
die "rti_license.dat not found in ${MIGRATE_PIPELINE_ROOT} or ${SCRIPT_DIR}. Required for DDS builds."
|
||||
fi
|
||||
fi
|
||||
|
||||
log_info "=== Release 2 Build Configuration ==="
|
||||
log_info "BUILD_GROUP1 (DDS/AP4): ${BUILD_GROUP1}"
|
||||
log_info "BUILD_GROUP3 (Lts/AP3): ${BUILD_GROUP3}"
|
||||
log_info "BUILD_GROUP5 (Viewer/AP9): ${BUILD_GROUP5}"
|
||||
log_info "BUILD_GROUP6 (Tools/AP9): ${BUILD_GROUP6}"
|
||||
log_info "RUN_CTEST: ${RUN_CTEST}"
|
||||
log_info "TESTS_ONLY: ${TESTS_ONLY}"
|
||||
log_info "USE_PREBUILT_IMAGE: ${USE_PREBUILT_IMAGE}"
|
||||
log_info "DOCKER_IMAGE: ${DOCKER_IMAGE}"
|
||||
log_info "DOCKER_MOUNT_ROOT: ${DOCKER_MOUNT_ROOT}"
|
||||
log_info "CMAKE_BUILD_FLAGS: ${CMAKE_BUILD_FLAGS:-none}"
|
||||
log_info "======================================"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Docker image (recipe: the in-tree ./Dockerfile, single source of truth)
|
||||
build_image() {
|
||||
log_info "Building Docker image ${DOCKER_IMAGE} from ${SCRIPT_DIR}/Dockerfile ..."
|
||||
docker build -t "${DOCKER_IMAGE}" -f "${SCRIPT_DIR}/Dockerfile" "${SCRIPT_DIR}"
|
||||
}
|
||||
|
||||
log_info "Using prebuilt Docker image: all build dependencies are baked in"
|
||||
|
||||
export QT_QPA_PLATFORM=offscreen
|
||||
|
||||
cd /workspace/qt6-migrated-legatus
|
||||
|
||||
# The build tree is ../build: next to the source tree, outside it.
|
||||
rm -rf ../build
|
||||
mkdir -p ../build
|
||||
cd ../build
|
||||
|
||||
COV_CMAKE_ARGS=()
|
||||
if [[ "${RUN_COVERAGE}" == "ON" ]]; then
|
||||
COV_CMAKE_ARGS=(
|
||||
"-DCMAKE_C_FLAGS_RELEASE=-O0 -g --coverage -DNDEBUG -fPIC"
|
||||
"-DCMAKE_CXX_FLAGS_RELEASE=-O0 -g --coverage -DNDEBUG -fPIC"
|
||||
"-DCMAKE_EXE_LINKER_FLAGS=--coverage"
|
||||
"-DCMAKE_SHARED_LINKER_FLAGS=--coverage"
|
||||
)
|
||||
fi
|
||||
cmake /workspace/qt6-migrated-legatus \
|
||||
-DBUILD_TESTING=ON \
|
||||
-DRELEASE_BUILD="${RELEASE_BUILD}" \
|
||||
-DCMAKE_CXX_STANDARD=17 \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_PREFIX_PATH="${QT_BASE_DIR}/${QT_VERSION}/${QT_ARCH_DIR}:/usr/local" \
|
||||
"${COV_CMAKE_ARGS[@]}"
|
||||
|
||||
read -r -a RELEASE_TARGETS_ARRAY <<< "${RELEASE_BUILD_TARGETS}"
|
||||
|
||||
log_info "Building release scope targets: ${RELEASE_TARGETS_ARRAY[*]}"
|
||||
make -j8 "${RELEASE_TARGETS_ARRAY[@]}" 2>&1 | tee release_build.log
|
||||
|
||||
if [[ "${RUN_CTEST}" == "ON" ]]; then
|
||||
log_info "Running CTest"
|
||||
ctest --test-dir . --output-on-failure || CTEST_RESULT=$?
|
||||
if [[ "${CTEST_RESULT:-0}" -ne 0 ]]; then
|
||||
log_info "CTest completed with failures (exit code: ${CTEST_RESULT})"
|
||||
fi
|
||||
if [[ "${USE_PREBUILT_IMAGE}" == "OFF" ]]; then
|
||||
build_image # --no-prebuilt-image: always (re)build
|
||||
else
|
||||
log_info "Skipping CTest"
|
||||
if ! docker image inspect "${DOCKER_IMAGE}" &> /dev/null; then
|
||||
build_image
|
||||
else
|
||||
log_info "Prebuilt image already exists: ${DOCKER_IMAGE}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "${RUN_COVERAGE}" == "ON" ]]; then
|
||||
log_info "=== Code coverage (lcov) ==="
|
||||
COVOUT=/workspace/coverage-out
|
||||
SRCROOT=/workspace/qt6-migrated-legatus
|
||||
mkdir -p "${COVOUT}"
|
||||
# -----------------------------------------------------------------------------
|
||||
# Prepare Docker run command
|
||||
DOCKER_RUN_ARGS=(
|
||||
--rm
|
||||
-e MIGRATE_PIPELINE_ROOT
|
||||
-e DOCKER_MOUNT_ROOT="${DOCKER_MOUNT_ROOT}"
|
||||
-e BUILD_GROUP1="${BUILD_GROUP1}"
|
||||
-e BUILD_GROUP3="${BUILD_GROUP3}"
|
||||
-e BUILD_GROUP5="${BUILD_GROUP5}"
|
||||
-e BUILD_GROUP6="${BUILD_GROUP6}"
|
||||
-e RUN_CTEST="${RUN_CTEST}"
|
||||
-e TESTS_ONLY="${TESTS_ONLY}"
|
||||
-e RUN_JENKINS_BUILDER="${RUN_JENKINS_BUILDER}"
|
||||
-e GUEZ_MODE="${GUEZ_MODE}"
|
||||
-e PACKAGE_OUTPUT_DIR="${PACKAGE_OUTPUT_DIR}"
|
||||
-e LTS_VERSION="${LTS_VERSION}"
|
||||
-e PROJECT="${PROJECT}"
|
||||
-e BUILD_NUMBER="${BUILD_NUMBER}"
|
||||
-e BUILD_TAG="${BUILD_TAG}"
|
||||
-e RUN_COVERAGE="${RUN_COVERAGE}"
|
||||
-e COVERAGE_OUTPUT_DIR="${COVERAGE_OUTPUT_DIR}"
|
||||
-v "${MIGRATE_PIPELINE_ROOT}:${DOCKER_MOUNT_ROOT}"
|
||||
-w "${DOCKER_MOUNT_ROOT}/qt-migration-legatus/qt6-after/qt6-migrated-legatus"
|
||||
"${DOCKER_IMAGE}"
|
||||
/bin/bash
|
||||
-c
|
||||
'
|
||||
set -e
|
||||
|
||||
COV_IGNORE=(--ignore-errors mismatch,inconsistent,unused)
|
||||
lcov --capture --directory . --external "${COV_IGNORE[@]}" \
|
||||
--rc branch_coverage=1 \
|
||||
--output-file "${COVOUT}/raw.info"
|
||||
lcov --extract "${COVOUT}/raw.info" \
|
||||
"${SRCROOT}/TetraIF/*" \
|
||||
"${SRCROOT}/Z/src/*" \
|
||||
"${SRCROOT}/Lts/Common/*" \
|
||||
"${SRCROOT}/Lts/Proxies/TrainingAreaBase/*" \
|
||||
"${COV_IGNORE[@]}" \
|
||||
--rc branch_coverage=1 \
|
||||
--output-file "${COVOUT}/scoped.info"
|
||||
lcov --remove "${COVOUT}/scoped.info" \
|
||||
"*/unit-test/*" \
|
||||
"*CommonUnitTestsPlaceholder*" \
|
||||
"*/UnitTests/*" \
|
||||
"*/tests/*" \
|
||||
"*/test_*" \
|
||||
"*_test.cpp" \
|
||||
"*_test.h" \
|
||||
"*_unit_test*" \
|
||||
"${COV_IGNORE[@]}" \
|
||||
--rc branch_coverage=1 \
|
||||
--output-file "${COVOUT}/coverage.info"
|
||||
lcov --summary "${COVOUT}/coverage.info" "${COV_IGNORE[@]}" --rc branch_coverage=1 \
|
||||
> "${COVOUT}/coverage_summary.txt"
|
||||
genhtml "${COVOUT}/coverage.info" \
|
||||
--output-directory "${COVOUT}/html" \
|
||||
"${COV_IGNORE[@]}" \
|
||||
--branch-coverage --legend \
|
||||
--rc branch_coverage=1
|
||||
log_info "Coverage report written to ${COVOUT} (host: ${COVERAGE_OUTPUT_DIR})"
|
||||
cat "${COVOUT}/coverage_summary.txt"
|
||||
log_info() { echo "[INFO] $*"; }
|
||||
die() { echo "[ERROR] $*" >&2; exit 1; }
|
||||
|
||||
# Point RTI Connext DDS at the license file (checked in at the source tree
|
||||
# root) so DDS processes started during the build/ctest can find it.
|
||||
if [[ -f "${DOCKER_MOUNT_ROOT}/qt-migration-legatus/qt6-after/qt6-migrated-legatus/rti_license.dat" ]]; then
|
||||
export RTI_LICENSE="${DOCKER_MOUNT_ROOT}/qt-migration-legatus/qt6-after/qt6-migrated-legatus/rti_license.dat"
|
||||
log_info "RTI_LICENSE=${RTI_LICENSE}"
|
||||
fi
|
||||
|
||||
# DEB package production with the in-tree rpmbuild script
|
||||
# Configure CMake (fixed build dir next to the tree, outside the source tree)
|
||||
log_info "Configuring CMake..."
|
||||
BUILD_DIR="../build"
|
||||
log_info "Using build directory: ${BUILD_DIR}"
|
||||
rm -rf "${BUILD_DIR}"
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
cmake -B "${BUILD_DIR}" \
|
||||
-G Ninja \
|
||||
-DBUILD_TESTING=ON \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DCMAKE_PREFIX_PATH="/opt/Qt/6.10.2/gcc_64" \
|
||||
-DCMAKE_CXX_FLAGS="-DRTI_LINUX -DRTI_UNIX" \
|
||||
-DCMAKE_C_FLAGS="-DRTI_LINUX -DRTI_UNIX" \
|
||||
-DBUILD_RTI=ON \
|
||||
-DBUILD_GROUP1="${BUILD_GROUP1}" \
|
||||
-DBUILD_GROUP3="${BUILD_GROUP3}" \
|
||||
-DBUILD_GROUP5="${BUILD_GROUP5}" \
|
||||
-DBUILD_GROUP6="${BUILD_GROUP6}" \
|
||||
-DRUN_JENKINS_BUILDER="${RUN_JENKINS_BUILDER}" \
|
||||
-DPACKAGE_OUTPUT_DIR="${PACKAGE_OUTPUT_DIR}" \
|
||||
-DLTS_VERSION="${LTS_VERSION}" \
|
||||
-DPROJECT="${PROJECT}" \
|
||||
-DBUILD_NUMBER="${BUILD_NUMBER}" \
|
||||
-DBUILD_TAG="${BUILD_TAG}" \
|
||||
-DRUN_COVERAGE="${RUN_COVERAGE}" \
|
||||
-DCOVERAGE_OUTPUT_DIR="${COVERAGE_OUTPUT_DIR}" \
|
||||
'"${CMAKE_BUILD_FLAGS}"' \
|
||||
.
|
||||
|
||||
# Build targets
|
||||
log_info "Building Release 2 targets..."
|
||||
|
||||
# AP4: DDS middleware
|
||||
GROUP1_TARGETS=(ddscore ddsftccore ddsfts ddsgen ddsQoS ddsconnector ddscore_unit_test ddsqos_unit_test)
|
||||
# AP3: Shared libraries + TetraIF + Lts/Common + Tests
|
||||
GROUP3_TARGETS=(NGLLogger nglapplication nglcompression nglcoreapplication ngldb nglguiapplication nglsettings nglsingleapplication nglsinglecoreapplication ngltools ngltranslator nglwidgets qtsingleapplication qtsinglecoreapplication wms_json_ds tcpserver LtsCoordinate LtsCoordTrans LtsSession LtsMultiMonitor DataPluginInterface GuiPluginInterface CoPrtCnv LogViewLogger LogView PrtCnvLib PrtCnv LtsLicence MockCoordTrans aes_crypt_test ngltools_qt_smoke lts_coord_trans_unit_test test_nglpdfwidget coprtcnv_unit_test logview_unit_test prtcnv_unit_test ngllogger_unit_test nglcoreapplication_unit_test nglsettings_unit_test ngltools_unit_test wms_json_ds_unit_test ltscoordinate_unit_test ltssession_unit_test commandlineparser_unit_test codegen_unit_test grantlee_parser_smoke utils_test)
|
||||
# AP9: Viewer / tools
|
||||
GROUP5_TARGETS=(ddsview LogViewer sqlbrowser logviewer_unit_test sqlbrowser_unit_test)
|
||||
# AP9: generators
|
||||
GROUP6_TARGETS=(ngl_codegen)
|
||||
|
||||
build_group() {
|
||||
local group_name="$1"
|
||||
local build_flag="$2"
|
||||
shift 2
|
||||
local targets=("$@")
|
||||
if [[ "${build_flag}" != "ON" ]]; then
|
||||
log_info "Skipping ${group_name} (disabled)"
|
||||
return
|
||||
fi
|
||||
log_info "Building ${group_name}..."
|
||||
for target in "${targets[@]}"; do
|
||||
log_info " Building: ${target}"
|
||||
cmake --build "${BUILD_DIR}" --target "${target}" -j$(nproc) || die "Failed to build ${target}"
|
||||
done
|
||||
}
|
||||
|
||||
build_group "GROUP1 (DDS/AP4)" "${BUILD_GROUP1}" "${GROUP1_TARGETS[@]}"
|
||||
build_group "GROUP3 (Lts/AP3)" "${BUILD_GROUP3}" "${GROUP3_TARGETS[@]}"
|
||||
build_group "GROUP5 (Viewer/AP9)" "${BUILD_GROUP5}" "${GROUP5_TARGETS[@]}"
|
||||
build_group "GROUP6 (Tools/AP9)" "${BUILD_GROUP6}" "${GROUP6_TARGETS[@]}"
|
||||
|
||||
# Run tests if enabled
|
||||
if [[ "${RUN_CTEST}" == "ON" ]] && [[ "${TESTS_ONLY}" != "ON" ]]; then
|
||||
log_info "Running ctest..."
|
||||
cd "${BUILD_DIR}"
|
||||
export QT_QPA_PLATFORM="${QT_QPA_PLATFORM:-offscreen}"
|
||||
export QT_PLUGIN_PATH="/usr/lib/x86_64-linux-gnu/qt6/plugins${QT_PLUGIN_PATH:+:${QT_PLUGIN_PATH}}"
|
||||
ctest --output-on-failure -j$(nproc) || log_info "Some tests failed (continuing)"
|
||||
cd ..
|
||||
fi
|
||||
|
||||
# DEB Package Production (in-tree rpmbuild)
|
||||
if [[ "${RUN_JENKINS_BUILDER}" == "ON" ]]; then
|
||||
log_info "=== DEB Package Production (in-tree rpmbuild) ==="
|
||||
|
||||
OS_VERSION=$(cat /etc/os-release | grep "^VERSION_ID=" | cut -d'"' -f2)
|
||||
STAGE_DIR=/workspace/qt6-migrated-legatus/deb_stage
|
||||
STAGED_SOURCE_DIR="${STAGE_DIR}"
|
||||
# Extract OS version for package naming
|
||||
OS_VERSION=$(eval $(grep "^VERSION_ID=" /etc/os-release) && echo "$VERSION_ID")
|
||||
STAGE_DIR="${DOCKER_MOUNT_ROOT}/deb_stage"
|
||||
WORKSPACE_DIR="${DOCKER_MOUNT_ROOT}/qt-migration-legatus/qt6-after/qt6-migrated-legatus"
|
||||
|
||||
log_info "Staging workspace to ${STAGE_DIR}"
|
||||
rm -rf "${STAGE_DIR}"
|
||||
@@ -568,41 +342,34 @@ if [[ "${RUN_JENKINS_BUILDER}" == "ON" ]]; then
|
||||
tar --exclude='./rpms' --exclude='./.git' --exclude='./build' \
|
||||
--exclude='./deb_build_tmp' --exclude='./deb_stage' --exclude='./packages-out' \
|
||||
--exclude='./legatus-qt6_1.0.tar.gz' \
|
||||
-cf - -C /workspace/qt6-migrated-legatus . | tar -xf - -C "${STAGE_DIR}"
|
||||
-cf - -C "${WORKSPACE_DIR}" . | tar -xf - -C "${STAGE_DIR}"
|
||||
|
||||
if [[ ! -f "${STAGED_SOURCE_DIR}/CMakeLists.txt" || ! -f "${STAGED_SOURCE_DIR}/rpmbuild/make_rpm_ubuntu26.py" ]]; then
|
||||
log_error "Staged source incomplete under ${STAGED_SOURCE_DIR} (CMakeLists.txt or rpmbuild/make_rpm_ubuntu26.py missing)"
|
||||
exit 1
|
||||
if [[ ! -f "${STAGE_DIR}/CMakeLists.txt" || ! -f "${STAGE_DIR}/rpmbuild/make_rpm_ubuntu26_release2.py" ]]; then
|
||||
die "Staged source incomplete under ${STAGE_DIR} (CMakeLists.txt or make_rpm_ubuntu26_release2.py missing)"
|
||||
fi
|
||||
|
||||
log_info "Running ${STAGED_SOURCE_DIR}/rpmbuild/make_rpm_ubuntu26.py with:"
|
||||
log_info " PROJECT=${PROJECT}"
|
||||
log_info " OS_VERSION=${OS_VERSION}"
|
||||
log_info " LTS_VERSION=${LTS_VERSION}"
|
||||
log_info " GUEZ_MODE=${GUEZ_MODE}"
|
||||
log_info " BUILD_NUMBER=${BUILD_NUMBER}"
|
||||
log_info " BUILD_TAG=${BUILD_TAG}"
|
||||
|
||||
cd "${STAGED_SOURCE_DIR}/rpmbuild"
|
||||
if python3 make_rpm_ubuntu26.py -c LTS \
|
||||
log_info "Running rpmbuild/make_rpm_ubuntu26_release2.py (PROJECT=${PROJECT} OS_VERSION=${OS_VERSION} LTS_VERSION=${LTS_VERSION} GUEZ_MODE=${GUEZ_MODE} BUILD_NUMBER=${BUILD_NUMBER} BUILD_TAG=${BUILD_TAG})"
|
||||
cd "${STAGE_DIR}/rpmbuild"
|
||||
if python3 make_rpm_ubuntu26_release2.py -c LTS \
|
||||
--project_name "${PROJECT}" \
|
||||
--version "${LTS_VERSION}" \
|
||||
--output_dir "/workspace/qt6-migrated-legatus/rpms/${PROJECT}/${OS_VERSION}/" \
|
||||
--source_dir "${STAGED_SOURCE_DIR}" \
|
||||
--cmake_build_flags "-DUSE_IPO=ON -DUSE_UNITY_BUILD=ON -DGUEZ_MODE=${GUEZ_MODE} -DBUILD_WLS=ON -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql/ -DRELEASE_BUILD=ON" \
|
||||
--output_dir "${DOCKER_MOUNT_ROOT}/rpms/${PROJECT}/${OS_VERSION}/" \
|
||||
--source_dir "${STAGE_DIR}" \
|
||||
--cmake_build_flags "-DUSE_IPO=ON -DUSE_UNITY_BUILD=ON -DGUEZ_MODE=${GUEZ_MODE} -DBUILD_WLS=ON -DBUILD_RTI=ON -DRELEASE_BUILD=ON -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql/ " \
|
||||
--build_targets "${GROUP1_TARGETS[*]} ${GROUP3_TARGETS[*]} ${GROUP5_TARGETS[*]} ${GROUP6_TARGETS[*]}" \
|
||||
--build_number "${BUILD_NUMBER}" \
|
||||
--release_scope; then
|
||||
log_info "Package build completed successfully"
|
||||
else
|
||||
log_error "Package build failed (exit code: $?)"
|
||||
echo "[ERROR] Package build failed (exit code: $?)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Copy produced DEB packages to the packages-out
|
||||
DEST_DIR=/workspace/packages-out
|
||||
# Copy produced DEB packages to packages-out (same-file skip by device:inode)
|
||||
DEST_DIR="${DOCKER_MOUNT_ROOT}/packages-out"
|
||||
mkdir -p "${DEST_DIR}"
|
||||
shopt -s nullglob
|
||||
for deb in "/workspace/qt6-migrated-legatus/rpms/${PROJECT}/${OS_VERSION}/"*.deb; do
|
||||
for deb in "${DOCKER_MOUNT_ROOT}/rpms/${PROJECT}/${OS_VERSION}/"*.deb; do
|
||||
base="$(basename "${deb}")"
|
||||
if [[ -e "${DEST_DIR}/${base}" ]] &&
|
||||
[[ "$(stat -c '%d:%i' "${deb}")" == "$(stat -c '%d:%i' "${DEST_DIR}/${base}")" ]]; then
|
||||
@@ -616,37 +383,12 @@ if [[ "${RUN_JENKINS_BUILDER}" == "ON" ]]; then
|
||||
else
|
||||
log_info "Skipping DEB package production"
|
||||
fi
|
||||
EOF
|
||||
|
||||
chmod +x "${CONTAINER_SCRIPT_HOST}"
|
||||
log_info "Release 2 build completed successfully!"
|
||||
'
|
||||
)
|
||||
|
||||
# The workspace mount is the tree's parent (not the tree): the build tree
|
||||
# ../build then lands next to the tree on the host (qt6-after/build), not
|
||||
# inside it. NOTE: no # comment lines inside the backslash-continued docker
|
||||
# run below - they break the continuation and drop the remaining arguments.
|
||||
docker run --rm \
|
||||
-e MIGRATE_PIPELINE_ROOT \
|
||||
-e LANG \
|
||||
-e LC_ALL \
|
||||
-e RELEASE_BUILD \
|
||||
-e RUN_CTEST \
|
||||
-e RUN_JENKINS_BUILDER \
|
||||
-e RUN_COVERAGE \
|
||||
-e COVERAGE_OUTPUT_DIR \
|
||||
-e PACKAGE_OUTPUT_DIR \
|
||||
-e LTS_VERSION \
|
||||
-e PROJECT \
|
||||
-e GUEZ_MODE \
|
||||
-e BUILD_NUMBER \
|
||||
-e BUILD_TAG \
|
||||
-e QT_VERSION \
|
||||
-e QT_ARCH \
|
||||
-e QT_ARCH_DIR \
|
||||
-e QT_BASE_DIR \
|
||||
-e RELEASE_BUILD_TARGETS="${RELEASE_BUILD_TARGETS_STRING}" \
|
||||
-v "${WORKSPACE_ROOT_HOST}/..:/workspace" \
|
||||
-v "${CONTAINER_SCRIPT_HOST}:/tmp/run-build-inside-container.sh:ro" \
|
||||
-v "${PACKAGE_OUTPUT_DIR}:/workspace/packages-out" \
|
||||
-v "${COVERAGE_OUTPUT_DIR}:/workspace/coverage-out" \
|
||||
"${DOCKER_IMAGE}" \
|
||||
bash /tmp/run-build-inside-container.sh
|
||||
log_info "Starting Docker container..."
|
||||
docker run "${DOCKER_RUN_ARGS[@]}"
|
||||
|
||||
log_info "Build script completed."
|
||||
@@ -1,660 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Build helper for qt-migrated-legatus inside Docker - RELEASE 2 VERSION
|
||||
#
|
||||
# Release 2 Scope:
|
||||
# - AP3: Shared libraries (LtsUtils, Widgets, Session, Krypto, PluginManager)
|
||||
# - AP4: DDS middleware (Core, DDSConnector, Routing, QosProfile, RTI layer)
|
||||
# - AP9: Tools and translations (DdsView, LogViewer, SqlBrowser, generators, lupdate)
|
||||
#
|
||||
# This is the Release 2 scope driver (the full-tree driver of the earlier
|
||||
# validation scope has been removed from this branch).
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage: ./new_docker_build_release2.sh [options]
|
||||
|
||||
Build groups (Release 2 scope):
|
||||
--group1 / --no-group1 Enable/disable DDS core libraries build (AP4)
|
||||
--group3 / --no-group3 Enable/disable Lts services build (AP3)
|
||||
--group5 / --no-group5 Enable/disable Lts/Viewer module targets and tests (AP9)
|
||||
--group6 / --no-group6 Enable/disable LTS Tools - generators and lupdate (AP9)
|
||||
|
||||
Test execution:
|
||||
--no-ctest Skip ctest execution
|
||||
--tests-only Run only ctest, skip all make build groups
|
||||
|
||||
Prebuilt Docker image usage:
|
||||
--use-prebuilt-image Use a Docker image with dependencies already installed
|
||||
--no-prebuilt-image Use base image and run apt-get install inside the container
|
||||
--docker-image IMAGE Docker image name to use/build/delete
|
||||
--cmake_build_flags FLAGS Extra CMake flags passed to the in-container configure
|
||||
(space-separated -D flags)
|
||||
|
||||
Package production options (DEB):
|
||||
--run-jenkins-builder Build the release DEB packages inside the container
|
||||
using the in-tree rpmbuild/make_rpm_ubuntu26_release2.py
|
||||
--package-output-dir DIR Directory to mount for package output (default: ./packages-out)
|
||||
--lts-version VERSION LTS version for package (default: 1.0)
|
||||
--project NAME Project name for package (default: guez)
|
||||
--build-number NUM Build number for package (default: 1)
|
||||
--build-tag TAG Build tag for package (default: manual-build)
|
||||
|
||||
Coverage options (lcov):
|
||||
--run-coverage Build with -O0 --coverage, run ctest and collect lcov
|
||||
--coverage-output-dir DIR Directory to mount for coverage output (default: ./coverage-out)
|
||||
|
||||
Docker mount configuration:
|
||||
--docker-mount-root PATH Container-side mount root path (default: /repo)
|
||||
Changes where host directories are mounted in container
|
||||
|
||||
Environment variable overrides:
|
||||
BUILD_GROUP1=ON|OFF DDS core libraries (AP4)
|
||||
BUILD_GROUP3=ON|OFF Lts services (AP3)
|
||||
BUILD_GROUP5=ON|OFF Viewer module (AP9)
|
||||
BUILD_GROUP6=ON|OFF Tools/generators (AP9)
|
||||
RUN_CTEST=ON|OFF
|
||||
TESTS_ONLY=ON|OFF
|
||||
USE_PREBUILT_IMAGE=ON|OFF
|
||||
RUN_JENKINS_BUILDER=ON|OFF
|
||||
PACKAGE_OUTPUT_DIR=<dir>
|
||||
LTS_VERSION=<version>
|
||||
PROJECT=<name>
|
||||
BUILD_NUMBER=<num>
|
||||
BUILD_TAG=<tag>
|
||||
RUN_COVERAGE=ON|OFF
|
||||
COVERAGE_OUTPUT_DIR=<dir>
|
||||
|
||||
MIGRATE_PIPELINE_ROOT resolution (highest precedence first):
|
||||
1. exported MIGRATE_PIPELINE_ROOT (e.g. from a Jenkinsfile)
|
||||
2. MIGRATE_PIPELINE_ROOT set by .envrc in this directory
|
||||
3. derived from the script location (the DLBO Qt6 repo root)
|
||||
|
||||
Examples:
|
||||
./new_docker_build_release2.sh --group1 --group3 --group5 --group6
|
||||
BUILD_GROUP1=ON BUILD_GROUP3=ON ./new_docker_build_release2.sh
|
||||
./new_docker_build_release2.sh --use-prebuilt-image --no-ctest
|
||||
./new_docker_build_release2.sh --group3 --run-jenkins-builder \
|
||||
--package-output-dir "${WORKSPACE}/rpms/guez/release2/"
|
||||
./new_docker_build_release2.sh --group3 --run-coverage \
|
||||
--coverage-output-dir "${WORKSPACE}/coverage/guez/release2/"
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
log_info() {
|
||||
echo "[INFO] $*"
|
||||
}
|
||||
|
||||
log_error() {
|
||||
printf "ERROR: %s\n" "$*" >&2
|
||||
}
|
||||
|
||||
die() {
|
||||
echo "[ERROR] $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Default values
|
||||
BUILD_GROUP1="${BUILD_GROUP1:-ON}" # AP4: DDS
|
||||
BUILD_GROUP3="${BUILD_GROUP3:-ON}" # AP3: Lts services
|
||||
BUILD_GROUP5="${BUILD_GROUP5:-ON}" # AP9: Viewer
|
||||
BUILD_GROUP6="${BUILD_GROUP6:-ON}" # AP9: Tools/generators
|
||||
RUN_CTEST="${RUN_CTEST:-ON}"
|
||||
TESTS_ONLY="${TESTS_ONLY:-OFF}"
|
||||
USE_PREBUILT_IMAGE="${USE_PREBUILT_IMAGE:-OFF}"
|
||||
DOCKER_IMAGE="${DOCKER_IMAGE:-qt6-migrated-legatus-release2}"
|
||||
CMAKE_BUILD_FLAGS="${CMAKE_BUILD_FLAGS:-}"
|
||||
DOCKER_MOUNT_ROOT="${DOCKER_MOUNT_ROOT:-/repo}"
|
||||
export DOCKER_MOUNT_ROOT
|
||||
|
||||
# Jenkins builder options for DEB package production
|
||||
GUEZ_MODE="${GUEZ_MODE:-ON}"
|
||||
RUN_JENKINS_BUILDER="${RUN_JENKINS_BUILDER:-OFF}"
|
||||
PACKAGE_OUTPUT_DIR="${PACKAGE_OUTPUT_DIR:-./packages-out}"
|
||||
LTS_VERSION="${LTS_VERSION:-1.0}"
|
||||
PROJECT="${PROJECT:-guez}"
|
||||
BUILD_NUMBER="${BUILD_NUMBER:-1}"
|
||||
BUILD_TAG="${BUILD_TAG:-manual-build}"
|
||||
|
||||
# Code coverage (lcov)
|
||||
RUN_COVERAGE="${RUN_COVERAGE:-OFF}"
|
||||
COVERAGE_OUTPUT_DIR="${COVERAGE_OUTPUT_DIR:-./coverage-out}"
|
||||
|
||||
# Export variables for Docker container
|
||||
export BUILD_GROUP1 BUILD_GROUP3 BUILD_GROUP5 BUILD_GROUP6 RUN_CTEST TESTS_ONLY USE_PREBUILT_IMAGE
|
||||
export RUN_JENKINS_BUILDER PACKAGE_OUTPUT_DIR LTS_VERSION PROJECT BUILD_NUMBER BUILD_TAG
|
||||
export RUN_COVERAGE COVERAGE_OUTPUT_DIR
|
||||
|
||||
# MIGRATE_PIPELINE_ROOT resolution (highest precedence first):
|
||||
# 1. exported MIGRATE_PIPELINE_ROOT (e.g. from a Jenkinsfile)
|
||||
# 2. MIGRATE_PIPELINE_ROOT set by .envrc in this directory
|
||||
# 3. derived from the script location (the DLBO Qt6 repo root)
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
MIGRATE_PIPELINE_ROOT_DEFAULT="${SCRIPT_DIR}"
|
||||
PIPELINE_ROOT_EXPORTED="${MIGRATE_PIPELINE_ROOT:-}"
|
||||
|
||||
if [[ -f ".envrc" ]]; then
|
||||
set -a
|
||||
source ".envrc"
|
||||
set +a
|
||||
fi
|
||||
|
||||
# An explicitly exported MIGRATE_PIPELINE_ROOT (Jenkinsfile) wins over .envrc
|
||||
if [[ -n "${PIPELINE_ROOT_EXPORTED}" ]]; then
|
||||
MIGRATE_PIPELINE_ROOT="${PIPELINE_ROOT_EXPORTED}"
|
||||
else
|
||||
MIGRATE_PIPELINE_ROOT="${MIGRATE_PIPELINE_ROOT:-${MIGRATE_PIPELINE_ROOT_DEFAULT}}"
|
||||
fi
|
||||
|
||||
export MIGRATE_PIPELINE_ROOT
|
||||
|
||||
# Parse arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--group1)
|
||||
BUILD_GROUP1="ON"
|
||||
shift
|
||||
;;
|
||||
--no-group1)
|
||||
BUILD_GROUP1="OFF"
|
||||
shift
|
||||
;;
|
||||
--group3)
|
||||
BUILD_GROUP3="ON"
|
||||
shift
|
||||
;;
|
||||
--no-group3)
|
||||
BUILD_GROUP3="OFF"
|
||||
shift
|
||||
;;
|
||||
--group5)
|
||||
BUILD_GROUP5="ON"
|
||||
shift
|
||||
;;
|
||||
--no-group5)
|
||||
BUILD_GROUP5="OFF"
|
||||
shift
|
||||
;;
|
||||
--group6)
|
||||
BUILD_GROUP6="ON"
|
||||
shift
|
||||
;;
|
||||
--no-group6)
|
||||
BUILD_GROUP6="OFF"
|
||||
shift
|
||||
;;
|
||||
--no-ctest)
|
||||
RUN_CTEST="OFF"
|
||||
shift
|
||||
;;
|
||||
--tests-only)
|
||||
TESTS_ONLY="ON"
|
||||
shift
|
||||
;;
|
||||
--use-prebuilt-image)
|
||||
USE_PREBUILT_IMAGE="ON"
|
||||
shift
|
||||
;;
|
||||
--no-prebuilt-image)
|
||||
USE_PREBUILT_IMAGE="OFF"
|
||||
shift
|
||||
;;
|
||||
--docker-image)
|
||||
DOCKER_IMAGE="$2"
|
||||
shift 2
|
||||
USE_PREBUILT_IMAGE="ON"
|
||||
;;
|
||||
--cmake_build_flags)
|
||||
CMAKE_BUILD_FLAGS="$2"
|
||||
shift 2
|
||||
;;
|
||||
--docker-mount-root)
|
||||
DOCKER_MOUNT_ROOT="$2"
|
||||
shift 2
|
||||
;;
|
||||
--run-jenkins-builder)
|
||||
RUN_JENKINS_BUILDER="ON"
|
||||
shift
|
||||
;;
|
||||
--package-output-dir)
|
||||
PACKAGE_OUTPUT_DIR="$2"
|
||||
shift 2
|
||||
;;
|
||||
--lts-version)
|
||||
LTS_VERSION="$2"
|
||||
shift 2
|
||||
;;
|
||||
--project)
|
||||
PROJECT="$2"
|
||||
shift 2
|
||||
;;
|
||||
--build-number)
|
||||
BUILD_NUMBER="$2"
|
||||
shift 2
|
||||
;;
|
||||
--build-tag)
|
||||
BUILD_TAG="$2"
|
||||
shift 2
|
||||
;;
|
||||
--run-coverage)
|
||||
RUN_COVERAGE="ON"
|
||||
shift
|
||||
;;
|
||||
--coverage-output-dir)
|
||||
COVERAGE_OUTPUT_DIR="$2"
|
||||
shift 2
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
;;
|
||||
*)
|
||||
die "Unknown option: $1"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Validate mutually exclusive options
|
||||
if [[ "${RUN_JENKINS_BUILDER}" == "ON" ]] && [[ "${RUN_COVERAGE}" == "ON" ]]; then
|
||||
die "Error: --run-jenkins-builder and --run-coverage are mutually exclusive"
|
||||
fi
|
||||
|
||||
require_command() {
|
||||
if ! command -v "$1" &> /dev/null; then
|
||||
die "Required command not found: $1"
|
||||
fi
|
||||
}
|
||||
|
||||
require_command docker
|
||||
|
||||
# Validate environment
|
||||
if [[ ! -f ".envrc" ]]; then
|
||||
die ".envrc not found in current directory. Please create .envrc with required environment variables (e.g., MIGRATE_PIPELINE_ROOT)"
|
||||
fi
|
||||
|
||||
set -a
|
||||
# shellcheck disable=SC1091
|
||||
source ".envrc"
|
||||
set +a
|
||||
|
||||
if [[ -z "${MIGRATE_PIPELINE_ROOT:-}" ]]; then
|
||||
die "MIGRATE_PIPELINE_ROOT is not set in .envrc"
|
||||
fi
|
||||
|
||||
if [[ ! -d "${MIGRATE_PIPELINE_ROOT}" ]]; then
|
||||
die "MIGRATE_PIPELINE_ROOT directory does not exist: ${MIGRATE_PIPELINE_ROOT}"
|
||||
fi
|
||||
|
||||
# Validate rti_license.dat exists (required for DDS builds).
|
||||
if [[ "${BUILD_GROUP1}" == "ON" ]]; then
|
||||
if [[ ! -f "${MIGRATE_PIPELINE_ROOT}/rti_license.dat" ]] && [[ ! -f "${SCRIPT_DIR}/rti_license.dat" ]]; then
|
||||
die "rti_license.dat not found in ${MIGRATE_PIPELINE_ROOT} or ${SCRIPT_DIR}. Required for DDS builds."
|
||||
fi
|
||||
fi
|
||||
|
||||
log_info "=== Release 2 Build Configuration ==="
|
||||
log_info "BUILD_GROUP1 (DDS/AP4): ${BUILD_GROUP1}"
|
||||
log_info "BUILD_GROUP3 (Lts/AP3): ${BUILD_GROUP3}"
|
||||
log_info "BUILD_GROUP5 (Viewer/AP9): ${BUILD_GROUP5}"
|
||||
log_info "BUILD_GROUP6 (Tools/AP9): ${BUILD_GROUP6}"
|
||||
log_info "RUN_CTEST: ${RUN_CTEST}"
|
||||
log_info "TESTS_ONLY: ${TESTS_ONLY}"
|
||||
log_info "USE_PREBUILT_IMAGE: ${USE_PREBUILT_IMAGE}"
|
||||
log_info "DOCKER_IMAGE: ${DOCKER_IMAGE}"
|
||||
log_info "DOCKER_MOUNT_ROOT: ${DOCKER_MOUNT_ROOT}"
|
||||
log_info "CMAKE_BUILD_FLAGS: ${CMAKE_BUILD_FLAGS:-none}"
|
||||
log_info "======================================"
|
||||
# Build prebuilt image if requested
|
||||
if [[ "${USE_PREBUILT_IMAGE}" == "ON" ]]; then
|
||||
if ! docker image inspect "${DOCKER_IMAGE}" &> /dev/null; then
|
||||
log_info "Prebuilt image ${DOCKER_IMAGE} not found. Building it now..."
|
||||
|
||||
# Create temporary directory for Dockerfile
|
||||
tmp_dir="$(mktemp -d)"
|
||||
trap 'rm -rf "${tmp_dir}"' EXIT
|
||||
|
||||
cat > "${tmp_dir}/Dockerfile" <<'DOCKERFILE'
|
||||
FROM ubuntu:26.04
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update -qq && \
|
||||
apt-get install -y -qq \
|
||||
build-essential \
|
||||
cmake \
|
||||
ninja-build \
|
||||
git \
|
||||
python3-pip \
|
||||
libboost-dev \
|
||||
libbz2-dev \
|
||||
libgl1-mesa-dev \
|
||||
pkg-config \
|
||||
libkf6texttemplate-dev \
|
||||
libgtest-dev \
|
||||
libgmock-dev \
|
||||
libpq-dev \
|
||||
postgresql-server-dev-all \
|
||||
libvlc-dev \
|
||||
vlc-plugin-base \
|
||||
libssl-dev \
|
||||
libxml2-dev \
|
||||
libxerces-c-dev \
|
||||
&& \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Qt6 packages via aqtinstall
|
||||
RUN pip3 install --break-system-packages --quiet aqtinstall && \
|
||||
aqt install-qt linux desktop 6.10.2 linux_gcc_64 \
|
||||
-m qtmultimedia qtserialport qtimageformats qtwebsockets qtwebengine \
|
||||
qtpdf qtwebview qt5compat qtwebchannel qtpositioning qtlocation qtsensors \
|
||||
--outputdir /opt/Qt && \
|
||||
rm -rf /root/.cache/Aqt
|
||||
|
||||
# Install KDReports from source
|
||||
RUN git clone --depth 1 https://github.com/KDAB/KDReports.git /tmp/KDReports && \
|
||||
cd /tmp/KDReports && \
|
||||
mkdir build && cd build && \
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_PREFIX_PATH=/opt/Qt .. && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
cd / && rm -rf /tmp/KDReports
|
||||
|
||||
# Create symlink for KDReports headers
|
||||
RUN ln -sfn KDReports-qt6 /usr/local/include/KDReports
|
||||
|
||||
CMD ["/bin/bash"]
|
||||
DOCKERFILE
|
||||
|
||||
docker build -t "${DOCKER_IMAGE}" "${tmp_dir}"
|
||||
log_info "Prebuilt image created: ${DOCKER_IMAGE}"
|
||||
else
|
||||
log_info "Prebuilt image already exists: ${DOCKER_IMAGE}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Prepare Docker run command
|
||||
DOCKER_RUN_ARGS=(
|
||||
--rm
|
||||
-e MIGRATE_PIPELINE_ROOT
|
||||
-e DOCKER_MOUNT_ROOT="${DOCKER_MOUNT_ROOT}"
|
||||
-e BUILD_GROUP1="${BUILD_GROUP1}"
|
||||
-e BUILD_GROUP3="${BUILD_GROUP3}"
|
||||
-e BUILD_GROUP5="${BUILD_GROUP5}"
|
||||
-e BUILD_GROUP6="${BUILD_GROUP6}"
|
||||
-e RUN_CTEST="${RUN_CTEST}"
|
||||
-e TESTS_ONLY="${TESTS_ONLY}"
|
||||
-e RUN_JENKINS_BUILDER="${RUN_JENKINS_BUILDER}"
|
||||
-e GUEZ_MODE="${GUEZ_MODE}"
|
||||
-e PACKAGE_OUTPUT_DIR="${PACKAGE_OUTPUT_DIR}"
|
||||
-e LTS_VERSION="${LTS_VERSION}"
|
||||
-e PROJECT="${PROJECT}"
|
||||
-e BUILD_NUMBER="${BUILD_NUMBER}"
|
||||
-e BUILD_TAG="${BUILD_TAG}"
|
||||
-e RUN_COVERAGE="${RUN_COVERAGE}"
|
||||
-e COVERAGE_OUTPUT_DIR="${COVERAGE_OUTPUT_DIR}"
|
||||
-v "${MIGRATE_PIPELINE_ROOT}:${DOCKER_MOUNT_ROOT}"
|
||||
-w "${DOCKER_MOUNT_ROOT}/qt-migration-legatus/qt6-after/qt6-migrated-legatus"
|
||||
)
|
||||
|
||||
if [[ "${USE_PREBUILT_IMAGE}" == "ON" ]]; then
|
||||
DOCKER_RUN_ARGS+=("${DOCKER_IMAGE}")
|
||||
else
|
||||
DOCKER_RUN_ARGS+=("ubuntu:26.04")
|
||||
fi
|
||||
|
||||
# When not using prebuilt image, we need to install dependencies first
|
||||
if [[ "${USE_PREBUILT_IMAGE}" == "OFF" ]]; then
|
||||
# Prepend dependency installation to the build command
|
||||
INSTALL_DEPS='
|
||||
set -e
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update -qq && \
|
||||
apt-get install -y -qq \
|
||||
build-essential \
|
||||
cmake \
|
||||
ninja-build \
|
||||
git \
|
||||
python3-pip \
|
||||
libboost-dev \
|
||||
libbz2-dev \
|
||||
libgl1-mesa-dev \
|
||||
pkg-config \
|
||||
libkf6texttemplate-dev \
|
||||
libgtest-dev \
|
||||
libgmock-dev \
|
||||
libpq-dev \
|
||||
postgresql-server-dev-all \
|
||||
libvlc-dev \
|
||||
vlc-plugin-base \
|
||||
libssl-dev \
|
||||
libxml2-dev \
|
||||
libxerces-c-dev \
|
||||
&& \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Qt6 packages via aqtinstall
|
||||
pip3 install --break-system-packages --quiet aqtinstall && \
|
||||
aqt install-qt linux desktop 6.10.2 linux_gcc_64 \
|
||||
-m qtmultimedia qtserialport qtimageformats qtwebsockets qtwebengine \
|
||||
qtpdf qtwebview qt5compat qtwebchannel qtpositioning qtlocation qtsensors \
|
||||
--outputdir /opt/Qt && \
|
||||
rm -rf /root/.cache/Aqt
|
||||
|
||||
# Install KDReports from source
|
||||
git clone --depth 1 https://github.com/KDAB/KDReports.git /tmp/KDReports && \
|
||||
cd /tmp/KDReports && \
|
||||
mkdir build && cd build && \
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_PREFIX_PATH=/opt/Qt .. && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
cd / && rm -rf /tmp/KDReports
|
||||
|
||||
# Create symlink for KDReports headers
|
||||
ln -sfn KDReports-qt6 /usr/local/include/KDReports
|
||||
|
||||
export PATH="/opt/Qt/6.10.2/gcc_64/bin:$PATH"
|
||||
export CMAKE_PREFIX_PATH="/opt/Qt/6.10.2/gcc_64"
|
||||
|
||||
log_info() {
|
||||
echo "[INFO] $*"
|
||||
}
|
||||
|
||||
die() {
|
||||
echo "[ERROR] $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
log_info "Dependencies installed successfully"
|
||||
|
||||
# Return to project directory
|
||||
cd "${DOCKER_MOUNT_ROOT}/qt-migration-legatus/qt6-after/qt6-migrated-legatus"
|
||||
'
|
||||
else
|
||||
INSTALL_DEPS=''
|
||||
fi
|
||||
|
||||
# Build command
|
||||
DOCKER_RUN_ARGS+=(
|
||||
/bin/bash
|
||||
-c
|
||||
'
|
||||
set -e
|
||||
|
||||
log_info() {
|
||||
echo "[INFO] $*"
|
||||
}
|
||||
|
||||
log_error() {
|
||||
printf "ERROR: %s\n" "$*" >&2
|
||||
}
|
||||
|
||||
die() {
|
||||
echo "[ERROR] $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
'"${INSTALL_DEPS}"'
|
||||
|
||||
# Point RTI Connext DDS at the license file (checked in at the source tree
|
||||
# root) so DDS processes started during the build/ctest can find it.
|
||||
if [[ -f "${DOCKER_MOUNT_ROOT}/qt-migration-legatus/qt6-after/qt6-migrated-legatus/rti_license.dat" ]]; then
|
||||
export RTI_LICENSE="${DOCKER_MOUNT_ROOT}/qt-migration-legatus/qt6-after/qt6-migrated-legatus/rti_license.dat"
|
||||
log_info "RTI_LICENSE=${RTI_LICENSE}"
|
||||
fi
|
||||
|
||||
# Configure CMake
|
||||
log_info "Configuring CMake..."
|
||||
# Fixed build dir next to the tree (../build), outside the source tree.
|
||||
BUILD_DIR="../build"
|
||||
log_info "Using build directory: ${BUILD_DIR}"
|
||||
rm -rf "${BUILD_DIR}"
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
cmake -B "${BUILD_DIR}" \
|
||||
-G Ninja \
|
||||
-DBUILD_TESTING=ON \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DCMAKE_PREFIX_PATH="/opt/Qt/6.10.2/gcc_64" \
|
||||
-DCMAKE_CXX_FLAGS="-DRTI_LINUX -DRTI_UNIX" \
|
||||
-DCMAKE_C_FLAGS="-DRTI_LINUX -DRTI_UNIX" \
|
||||
-DBUILD_RTI=ON \
|
||||
-DBUILD_GROUP1="${BUILD_GROUP1}" \
|
||||
-DBUILD_GROUP3="${BUILD_GROUP3}" \
|
||||
-DBUILD_GROUP5="${BUILD_GROUP5}" \
|
||||
-DBUILD_GROUP6="${BUILD_GROUP6}" \
|
||||
-DRUN_JENKINS_BUILDER="${RUN_JENKINS_BUILDER}" \
|
||||
-DPACKAGE_OUTPUT_DIR="${PACKAGE_OUTPUT_DIR}" \
|
||||
-DLTS_VERSION="${LTS_VERSION}" \
|
||||
-DPROJECT="${PROJECT}" \
|
||||
-DBUILD_NUMBER="${BUILD_NUMBER}" \
|
||||
-DBUILD_TAG="${BUILD_TAG}" \
|
||||
-DRUN_COVERAGE="${RUN_COVERAGE}" \
|
||||
-DCOVERAGE_OUTPUT_DIR="${COVERAGE_OUTPUT_DIR}" \
|
||||
'"${CMAKE_BUILD_FLAGS}"' \
|
||||
.
|
||||
|
||||
# Build targets
|
||||
log_info "Building Release 2 targets..."
|
||||
|
||||
# AP4: DDS middleware (Release 1 + Release 2 scope)
|
||||
GROUP1_TARGETS=(ddscore ddsftccore ddsfts ddsgen ddsQoS ddsconnector ddscore_unit_test ddsqos_unit_test)
|
||||
# AP3: Shared libraries + TetraIF + Lts/Common + Tests (Release 1 + Release 2 scope)
|
||||
GROUP3_TARGETS=(NGLLogger nglapplication nglcompression nglcoreapplication ngldb nglguiapplication nglsettings nglsingleapplication nglsinglecoreapplication ngltools ngltranslator nglwidgets qtsingleapplication qtsinglecoreapplication wms_json_ds tcpserver LtsCoordinate LtsCoordTrans LtsSession LtsMultiMonitor DataPluginInterface GuiPluginInterface CoPrtCnv LogViewLogger LogView PrtCnvLib PrtCnv LtsLicence MockCoordTrans aes_crypt_test ngltools_qt_smoke lts_coord_trans_unit_test test_nglpdfwidget coprtcnv_unit_test logview_unit_test prtcnv_unit_test ngllogger_unit_test nglcoreapplication_unit_test nglsettings_unit_test ngltools_unit_test wms_json_ds_unit_test ltscoordinate_unit_test ltssession_unit_test commandlineparser_unit_test codegen_unit_test grantlee_parser_smoke utils_test)
|
||||
GROUP5_TARGETS=(ddsview LogViewer sqlbrowser logviewer_unit_test sqlbrowser_unit_test)
|
||||
GROUP6_TARGETS=(ngl_codegen)
|
||||
|
||||
build_group() {
|
||||
local group_name="$1"
|
||||
local build_flag="$2"
|
||||
shift 2
|
||||
local targets=("$@")
|
||||
|
||||
if [[ "${build_flag}" != "ON" ]]; then
|
||||
log_info "Skipping ${group_name} (disabled)"
|
||||
return
|
||||
fi
|
||||
|
||||
log_info "Building ${group_name}..."
|
||||
for target in "${targets[@]}"; do
|
||||
log_info " Building: ${target}"
|
||||
cmake --build "${BUILD_DIR}" --target "${target}" -j$(nproc) || die "Failed to build ${target}"
|
||||
done
|
||||
}
|
||||
|
||||
build_group "GROUP1 (DDS/AP4)" "${BUILD_GROUP1}" "${GROUP1_TARGETS[@]}"
|
||||
build_group "GROUP3 (Lts/AP3)" "${BUILD_GROUP3}" "${GROUP3_TARGETS[@]}"
|
||||
build_group "GROUP5 (Viewer/AP9)" "${BUILD_GROUP5}" "${GROUP5_TARGETS[@]}"
|
||||
build_group "GROUP6 (Tools/AP9)" "${BUILD_GROUP6}" "${GROUP6_TARGETS[@]}"
|
||||
|
||||
# Run tests if enabled
|
||||
if [[ "${RUN_CTEST}" == "ON" ]] && [[ "${TESTS_ONLY}" != "ON" ]]; then
|
||||
log_info "Running ctest..."
|
||||
cd "${BUILD_DIR}"
|
||||
export QT_QPA_PLATFORM="${QT_QPA_PLATFORM:-offscreen}"
|
||||
# KF6 TextTemplate plugins (ktexttemplate_defaulttags, used by
|
||||
# GrantleeParserSmoke) are installed by the system libkf6texttemplate-dev
|
||||
# package under the multiarch plugin dir, which the /opt/Qt install does
|
||||
# not search by default. Prepend it so Qt can load them.
|
||||
export QT_PLUGIN_PATH="/usr/lib/x86_64-linux-gnu/qt6/plugins${QT_PLUGIN_PATH:+:${QT_PLUGIN_PATH}}"
|
||||
ctest --output-on-failure -j$(nproc) || log_info "Some tests failed (continuing)"
|
||||
cd ..
|
||||
fi
|
||||
|
||||
# DEB Package Production (in-tree rpmbuild)
|
||||
if [[ "${RUN_JENKINS_BUILDER}" == "ON" ]]; then
|
||||
log_info "=== DEB Package Production (in-tree rpmbuild) ==="
|
||||
|
||||
# Extract OS version for package naming
|
||||
OS_VERSION=$(eval $(grep "^VERSION_ID=" /etc/os-release) && echo "$VERSION_ID")
|
||||
STAGE_DIR="${DOCKER_MOUNT_ROOT}/deb_stage"
|
||||
STAGED_SOURCE_DIR="${STAGE_DIR}"
|
||||
WORKSPACE_DIR="${DOCKER_MOUNT_ROOT}/qt-migration-legatus/qt6-after/qt6-migrated-legatus"
|
||||
|
||||
log_info "Staging workspace to ${STAGE_DIR}"
|
||||
rm -rf "${STAGE_DIR}"
|
||||
mkdir -p "${STAGE_DIR}"
|
||||
|
||||
tar --exclude='./rpms' --exclude='./.git' --exclude='./build' \
|
||||
--exclude='./deb_build_tmp' --exclude='./deb_stage' --exclude='./packages-out' \
|
||||
--exclude='./legatus-qt6_1.0.tar.gz' \
|
||||
-cf - -C "${WORKSPACE_DIR}" . | tar -xf - -C "${STAGE_DIR}"
|
||||
|
||||
if [[ ! -f "${STAGED_SOURCE_DIR}/CMakeLists.txt" || ! -f "${STAGED_SOURCE_DIR}/rpmbuild/make_rpm_ubuntu26_release2.py" ]]; then
|
||||
log_error "Staged source incomplete under ${STAGED_SOURCE_DIR} (CMakeLists.txt or rpmbuild/make_rpm_ubuntu26_release2.py missing)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log_info "Running ${STAGED_SOURCE_DIR}/rpmbuild/make_rpm_ubuntu26_release2.py with:"
|
||||
log_info " PROJECT=${PROJECT}"
|
||||
log_info " OS_VERSION=${OS_VERSION}"
|
||||
log_info " LTS_VERSION=${LTS_VERSION}"
|
||||
log_info " GUEZ_MODE=${GUEZ_MODE}"
|
||||
log_info " BUILD_NUMBER=${BUILD_NUMBER}"
|
||||
log_info " BUILD_TAG=${BUILD_TAG}"
|
||||
|
||||
# DEB cmake flags: -DBUILD_RTI=ON is required
|
||||
cd "${STAGED_SOURCE_DIR}/rpmbuild"
|
||||
if python3 make_rpm_ubuntu26_release2.py -c LTS \
|
||||
--project_name "${PROJECT}" \
|
||||
--version "${LTS_VERSION}" \
|
||||
--output_dir "${DOCKER_MOUNT_ROOT}/rpms/${PROJECT}/${OS_VERSION}/" \
|
||||
--source_dir "${STAGED_SOURCE_DIR}" \
|
||||
--cmake_build_flags "-DUSE_IPO=ON -DUSE_UNITY_BUILD=ON -DGUEZ_MODE=${GUEZ_MODE} -DBUILD_WLS=ON -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql/ -DBUILD_RTI=ON -DRELEASE_BUILD=ON" \
|
||||
--build_targets "${GROUP1_TARGETS[*]} ${GROUP3_TARGETS[*]} ${GROUP5_TARGETS[*]} ${GROUP6_TARGETS[*]}" \
|
||||
--build_number "${BUILD_NUMBER}" \
|
||||
--release_scope; then
|
||||
log_info "Package build completed successfully"
|
||||
else
|
||||
log_error "Package build failed (exit code: $?)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Copy produced DEB packages to the packages-out
|
||||
DEST_DIR="${DOCKER_MOUNT_ROOT}/packages-out"
|
||||
mkdir -p "${DEST_DIR}"
|
||||
shopt -s nullglob
|
||||
for deb in "${DOCKER_MOUNT_ROOT}/rpms/${PROJECT}/${OS_VERSION}/"*.deb; do
|
||||
base="$(basename "${deb}")"
|
||||
if [[ -e "${DEST_DIR}/${base}" ]] &&
|
||||
[[ "$(stat -c '%d:%i' "${deb}")" == "$(stat -c '%d:%i' "${DEST_DIR}/${base}")" ]]; then
|
||||
continue
|
||||
fi
|
||||
cp -f "${deb}" "${DEST_DIR}/"
|
||||
done
|
||||
shopt -u nullglob
|
||||
log_info "DEB packages available in ${DEST_DIR} (host: ${PACKAGE_OUTPUT_DIR:-unknown}):"
|
||||
ls -lh "${DEST_DIR}/"
|
||||
else
|
||||
log_info "Skipping DEB package production"
|
||||
fi
|
||||
|
||||
log_info "Release 2 build completed successfully!"
|
||||
'
|
||||
)
|
||||
|
||||
log_info "Starting Docker container..."
|
||||
docker run "${DOCKER_RUN_ARGS[@]}"
|
||||
|
||||
log_info "Build script completed."
|
||||
@@ -21,7 +21,7 @@ from email.utils import formatdate
|
||||
SKIP_DIRS = {'build', 'cmake-build-debug', 'cmake-build-release', 'deb_build_tmp'}
|
||||
SOURCE_EXTENSIONS = ('.cpp', '.h', '.hpp', '.cc', '.cxx', '.hxx')
|
||||
PIPELINE_FILES = [
|
||||
"new_docker_build_release2.sh",
|
||||
"new_docker_build.sh",
|
||||
"Dockerfile",
|
||||
"jenkins-ci-rme/Jenkinsfile",
|
||||
"jenkins-ci-rme/jenkins/Jenkinsfile",
|
||||
|
||||
Reference in new issue
Block a user