Files
pipelines/app/docker/build.sh
T
alan 8138cdc3d9 Linux desktop: optimized release build, installer, Linux gaps
Build: split Dart debug info out of libapp.so (13.96 -> 11.27 MB, symbols
kept in the cache) and fix icon tree shaking, which Flutter 3.44's Linux
CMake backend silently disables by quoting the define; the build image
patches its SDK copy (MaterialIcons 1.6 MB -> 25 KB). Impeller cannot be
enabled in a Linux release build and was slower in a profile-build bench.

Install: `./install --linux --install` installs the bundle into
<prefix>/lib/app-linux with com.pipelines.app.desktop (the GTK/Wayland
app id), its icon and a ~/.local/bin/pipelines-app link, through
scripts/install-linux-app.sh.

Linux gaps: notifications through the freedesktop daemon; HTML artifacts
explain the missing web view instead of throwing; no Share for files;
a GTK clipboard reader for pasting files and screenshots (Ctrl+V and
Omarchy's Super+V); GTK header bar only on GNOME; window icon.

Bench: native fixture frame log, wheel/mark steps and
tool/perf/linux_desktop_bench.py (private Xvfb); results in
app/notes/linux-desktop-optimized.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 12:54:18 +00:00

57 lines
2.5 KiB
Bash
Executable File

#!/bin/sh
# Builds the app from the read-only source at /src into /out.
# Usage: pipelines-app-build web|apk [flutter build arguments...]
set -eu
kind="$1"
shift
rm -rf /tmp/work && mkdir -p /tmp/work
# A private copy: the host checkout's build outputs and machine paths stay out.
(cd /src && tar --exclude=./build --exclude=./.dart_tool --exclude=./android/.gradle \
--exclude=./android/local.properties --exclude=./android/app/.cxx --exclude=./ios/Pods \
--exclude=./macos/Pods --exclude=./macos/Flutter/ephemeral --exclude=./linux/flutter/ephemeral \
-cf - .) | tar -C /tmp/work -xf -
cd /tmp/work
flutter pub get
case "$kind" in
web)
# WebAssembly (skwasm) with the JavaScript (CanvasKit) build beside it:
# the loader picks wasm where the browser has WasmGC, else JavaScript.
# No source maps: they are not served.
flutter build web --release --wasm --no-web-resources-cdn --no-source-maps "$@"
cp -R build/web/. /out/
;;
apk)
# Flutter's template permits an 8 GiB Gradle heap plus separate Kotlin
# daemons. That exceeds a typical Docker Desktop VM before APK packaging.
# Limit only this private build copy, not native developers' settings.
cat >> android/gradle.properties <<'PROPERTIES'
org.gradle.jvmargs=-Xmx3G -XX:MaxMetaspaceSize=1G -XX:ReservedCodeCacheSize=256m -XX:+HeapDumpOnOutOfMemoryError
org.gradle.workers.max=2
org.gradle.parallel=false
org.gradle.vfs.watch=false
kotlin.compiler.execution.strategy=in-process
PROPERTIES
flutter build apk --release "$@"
cp build/app/outputs/flutter-apk/app-release.apk /out/pipelines.apk
# Public certificate identity only; never export the signing key.
apksigner=$(find "$ANDROID_SDK_ROOT/build-tools" -name apksigner -type f | sort -V | tail -n 1)
test -x "$apksigner"
"$apksigner" verify --print-certs /out/pipelines.apk > /tmp/apk-certificates.txt
awk -F ': ' '/^Signer #[0-9]+ certificate SHA-256 digest:/ { print tolower($2) }' \
/tmp/apk-certificates.txt > /out/signing-certificate-sha256.txt
;;
linux)
# Dart symbols go beside the bundle, not into libapp.so (about 18%
# smaller); `flutter symbolize -i <trace> -d .debug-info/app.linux-x64.symbols`
# reads a release stack trace. Icon fonts are tree-shaken (see Dockerfile).
flutter build linux --release --split-debug-info=/tmp/debug-info "$@"
cp -a build/linux/x64/release/bundle/. /out/
cp -a /tmp/debug-info /out/.debug-info
;;
*)
echo "unknown build: $kind" >&2
exit 2
;;
esac