summaryrefslogtreecommitdiff
path: root/docker/scripts/build-app.sh
diff options
context:
space:
mode:
authorcirakg <cirakg@cirakg.xyz>2026-10-18 21:10:37 +0200
committercirakg <cirakg@cirakg.xyz>2026-10-18 21:10:37 +0200
commit85f1ecabd7f58f306b2a042376209ac8cf49ab9b (patch)
tree00a0f3e2717e5c20ce0c427a979ef609a400d326 /docker/scripts/build-app.sh
parent2071e2beda763137416ac386d4bb953711ec995d (diff)
build: complete the Docker pipeline for build, test, screenshots and packaging
- Container scripts now run from the mounted project (no image rebuild per script change): build-app.sh (strict -l 3, warnings fail), run-unit-tests.sh, screenshots.sh, app-diag.sh (perf/memory), lint.sh, package.sh and sim-vnc.sh (noVNC on 127.0.0.1:6080). - Headless simulator helpers: wait for port 1234, remove the stale single-instance lock (~/Sim-dev) that made later starts hang, show the simulator log on failure. - New targets: screenshots-approve, icons; `make lock` re-adds the requirements header; pytest treats warnings as errors. - Author/Summary headers on every build file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docker/scripts/build-app.sh')
-rwxr-xr-xdocker/scripts/build-app.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/docker/scripts/build-app.sh b/docker/scripts/build-app.sh
new file mode 100755
index 0000000..74dd042
--- /dev/null
+++ b/docker/scripts/build-app.sh
@@ -0,0 +1,49 @@
+#!/usr/bin/env bash
+# Author: cirakg & claude ai
+# Summary: Compile the watch app for one device: debug, release or unit-test build.
+#
+# Usage: build-app.sh debug|release|test DEVICE
+# Output: build/<mode>/<DEVICE>.prg, and the compiler log next to it.
+#
+# Policy (README section 17.7): strict type checking (-l 3), and any compiler
+# warning fails the build. Test builds add test.jungle, so test code never
+# reaches debug or release builds; release builds (-r) also drop every
+# (:debug) declaration, such as the diagnostics in source/util/Diag.mc.
+set -euo pipefail
+# shellcheck source=ciq-env.sh
+source "$(dirname "${BASH_SOURCE[0]}")/ciq-env.sh"
+
+mode="${1:?usage: build-app.sh debug|release|test DEVICE}"
+device="${2:?usage: build-app.sh debug|release|test DEVICE}"
+
+ciq_require_sdk
+ciq_require_key
+ciq_require_device "${device}"
+
+# icons.jungle (generated by tools/make_icon.py --all) gives every device a
+# launcher icon of exactly its size.
+jungles="/work/monkey.jungle;/work/icons.jungle"
+args=(-d "${device}" -y "${DEV_KEY}" -l 3 -w)
+case "${mode}" in
+ debug) ;;
+ release) args+=(-r) ;;
+ test)
+ jungles="${jungles};/work/test.jungle"
+ args+=(-t)
+ ;;
+ *) die "unknown build mode '${mode}' (use debug, release or test)" ;;
+esac
+
+out_dir="${BUILD_DIR}/${mode}"
+mkdir -p "${out_dir}"
+compile_log="${out_dir}/${device}.log"
+
+if ! monkeyc -f "${jungles}" -o "${out_dir}/${device}.prg" "${args[@]}" >"${compile_log}" 2>&1; then
+ cat "${compile_log}" >&2
+ die "compile failed for ${device} (${mode} build)"
+fi
+if grep -q "^WARNING" "${compile_log}"; then
+ grep "^WARNING" "${compile_log}" >&2
+ die "compiler warnings for ${device} (${mode} build); warnings count as errors"
+fi
+log "built build/${mode}/${device}.prg"