|
@@ -46,6 +46,13 @@ DO_REPO=0
|
|
|
SUITE=""
|
|
SUITE=""
|
|
|
DO_SYNC=0
|
|
DO_SYNC=0
|
|
|
MAKE_DEBS=1
|
|
MAKE_DEBS=1
|
|
|
|
|
+# The function runner is part of a release: ON here, even though the CMake
|
|
|
|
|
+# option defaults to OFF (it vendors QuickJS from GitHub at configure time, and
|
|
|
|
|
+# the ordinary dev build must not start depending on a network fetch). The
|
|
|
|
|
+# release build already fetches cpp-httplib the same way, so the Docker build
|
|
|
|
|
+# demonstrably has network. --no-runner is the escape hatch for an offline or
|
|
|
|
|
+# runner-less build.
|
|
|
|
|
+BUILD_RUNNER=ON
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# ---------------------------------------------------------------------------
|
|
|
# Colored logging
|
|
# Colored logging
|
|
@@ -92,6 +99,9 @@ Build modes:
|
|
|
|
|
|
|
|
Options:
|
|
Options:
|
|
|
--install Install .debs locally after build (--local, Debian host only)
|
|
--install Install .debs locally after build (--local, Debian host only)
|
|
|
|
|
+ --no-runner Do not build the QuickJS function runner (skips the
|
|
|
|
|
+ smartbotic-vectorapi-runner package; needed for a build
|
|
|
|
|
+ with no network access to github.com)
|
|
|
--skip-tests Skip building and running the test suite (--local only)
|
|
--skip-tests Skip building and running the test suite (--local only)
|
|
|
--deb-revision N Debian revision suffix (default: 1)
|
|
--deb-revision N Debian revision suffix (default: 1)
|
|
|
--rebuild-base Force rebuild Docker base image
|
|
--rebuild-base Force rebuild Docker base image
|
|
@@ -116,6 +126,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
case "$1" in
|
|
case "$1" in
|
|
|
--local) LOCAL_MODE=1; shift ;;
|
|
--local) LOCAL_MODE=1; shift ;;
|
|
|
--install) INSTALL_AFTER=1; shift ;;
|
|
--install) INSTALL_AFTER=1; shift ;;
|
|
|
|
|
+ --no-runner) BUILD_RUNNER=OFF; shift ;;
|
|
|
--skip-tests) SKIP_TESTS=1; shift ;;
|
|
--skip-tests) SKIP_TESTS=1; shift ;;
|
|
|
--deb-revision) DEB_REVISION="$2"; shift 2 ;;
|
|
--deb-revision) DEB_REVISION="$2"; shift 2 ;;
|
|
|
--rebuild-base) REBUILD_BASE=1; shift ;;
|
|
--rebuild-base) REBUILD_BASE=1; shift ;;
|
|
@@ -201,11 +212,12 @@ build_local() {
|
|
|
tests="OFF"
|
|
tests="OFF"
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
- log_info "Configuring CMake (Release, BUILD_TESTS=${tests})..."
|
|
|
|
|
|
|
+ log_info "Configuring CMake (Release, BUILD_TESTS=${tests}, BUILD_RUNNER=${BUILD_RUNNER})..."
|
|
|
cmake -B "$PROJECT_DIR/build" -G Ninja \
|
|
cmake -B "$PROJECT_DIR/build" -G Ninja \
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
-DBUILD_WEBUI=ON \
|
|
-DBUILD_WEBUI=ON \
|
|
|
-DBUILD_TESTS="$tests" \
|
|
-DBUILD_TESTS="$tests" \
|
|
|
|
|
+ -DBUILD_RUNNER="$BUILD_RUNNER" \
|
|
|
-S "$PROJECT_DIR"
|
|
-S "$PROJECT_DIR"
|
|
|
|
|
|
|
|
log_info "Building with ${BUILD_JOBS} jobs..."
|
|
log_info "Building with ${BUILD_JOBS} jobs..."
|
|
@@ -225,15 +237,23 @@ build_local() {
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
log_info "Creating .deb packages..."
|
|
log_info "Creating .deb packages..."
|
|
|
- OUTPUT_DIR="$OUTPUT_DIR" BUILD_DEB_REVISION="$DEB_REVISION" "$PROJECT_DIR/packaging/deb/create-debs.sh"
|
|
|
|
|
|
|
+ # SKIP_RUNNER_DEB keeps --no-runner from emitting a warning about a binary
|
|
|
|
|
+ # we deliberately did not build.
|
|
|
|
|
+ local skip_runner=0
|
|
|
|
|
+ [[ "$BUILD_RUNNER" == "ON" ]] || skip_runner=1
|
|
|
|
|
+ OUTPUT_DIR="$OUTPUT_DIR" BUILD_DEB_REVISION="$DEB_REVISION" \
|
|
|
|
|
+ SKIP_RUNNER_DEB="$skip_runner" "$PROJECT_DIR/packaging/deb/create-debs.sh"
|
|
|
log_success "Packages created"
|
|
log_success "Packages created"
|
|
|
|
|
|
|
|
if [[ $INSTALL_AFTER -eq 1 ]]; then
|
|
if [[ $INSTALL_AFTER -eq 1 ]]; then
|
|
|
log_info "Installing .deb packages..."
|
|
log_info "Installing .deb packages..."
|
|
|
- sudo dpkg -i \
|
|
|
|
|
- "$OUTPUT_DIR"/smartbotic-vectorapi_*.deb \
|
|
|
|
|
- "$OUTPUT_DIR"/smartbotic-vectorapi-webui_*.deb \
|
|
|
|
|
- || sudo apt-get install -f -y
|
|
|
|
|
|
|
+ local debs=("$OUTPUT_DIR"/smartbotic-vectorapi_*.deb "$OUTPUT_DIR"/smartbotic-vectorapi-webui_*.deb)
|
|
|
|
|
+ # Installed in the same dpkg run as the server when present: the runner
|
|
|
|
|
+ # Breaks older server versions, so they have to be configured together.
|
|
|
|
|
+ if compgen -G "$OUTPUT_DIR/smartbotic-vectorapi-runner_*.deb" >/dev/null; then
|
|
|
|
|
+ debs+=("$OUTPUT_DIR"/smartbotic-vectorapi-runner_*.deb)
|
|
|
|
|
+ fi
|
|
|
|
|
+ sudo dpkg -i "${debs[@]}" || sudo apt-get install -f -y
|
|
|
log_success "Packages installed"
|
|
log_success "Packages installed"
|
|
|
fi
|
|
fi
|
|
|
}
|
|
}
|
|
@@ -305,7 +325,19 @@ build_docker() {
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
# Build packages
|
|
# Build packages
|
|
|
- log_info "Building packages in Docker..."
|
|
|
|
|
|
|
+ log_info "Building packages in Docker (BUILD_RUNNER=${BUILD_RUNNER})..."
|
|
|
|
|
+
|
|
|
|
|
+ # BUILD_RUNNER has to be consumed by Dockerfile.build's cmake invocation -
|
|
|
|
|
+ # the flags live in the Dockerfile, not here. If that ARG is not declared
|
|
|
|
|
+ # there, buildx silently ignores the build-arg and the runner package is
|
|
|
|
|
+ # simply missing from the output, which is the kind of omission nobody
|
|
|
|
|
+ # notices until functions stop working in production. So say so, loudly.
|
|
|
|
|
+ if [[ "$BUILD_RUNNER" == "ON" ]] \
|
|
|
|
|
+ && ! grep -q 'BUILD_RUNNER' "$PROJECT_DIR/packaging/Dockerfile.build"; then
|
|
|
|
|
+ log_warn "packaging/Dockerfile.build does not consume BUILD_RUNNER:"
|
|
|
|
|
+ log_warn " it needs 'ARG BUILD_RUNNER=ON' and -DBUILD_RUNNER=\${BUILD_RUNNER} on its"
|
|
|
|
|
+ log_warn " cmake line. Until then this build produces NO smartbotic-vectorapi-runner deb."
|
|
|
|
|
+ fi
|
|
|
|
|
|
|
|
local build_cache_args=()
|
|
local build_cache_args=()
|
|
|
if [[ $NO_CACHE -eq 1 ]]; then
|
|
if [[ $NO_CACHE -eq 1 ]]; then
|
|
@@ -319,6 +351,7 @@ build_docker() {
|
|
|
--build-arg "BUILD_DEB_REVISION=${DEB_REVISION}" \
|
|
--build-arg "BUILD_DEB_REVISION=${DEB_REVISION}" \
|
|
|
--build-arg "BUILD_JOBS=${BUILD_JOBS}" \
|
|
--build-arg "BUILD_JOBS=${BUILD_JOBS}" \
|
|
|
--build-arg "BUILD_GIT_COMMIT=${GIT_COMMIT}" \
|
|
--build-arg "BUILD_GIT_COMMIT=${GIT_COMMIT}" \
|
|
|
|
|
+ --build-arg "BUILD_RUNNER=${BUILD_RUNNER}" \
|
|
|
--target packages \
|
|
--target packages \
|
|
|
--output "type=local,dest=$OUTPUT_DIR" \
|
|
--output "type=local,dest=$OUTPUT_DIR" \
|
|
|
"${build_cache_args[@]+"${build_cache_args[@]}"}" \
|
|
"${build_cache_args[@]+"${build_cache_args[@]}"}" \
|