From 51bce91dcfa7abd6dad89115d09a359016c35b01 Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Wed, 25 Nov 2026 16:40:38 +0100 Subject: [PATCH] Use the shared nightly launcher template The plain nightly tar's launcher is now craft-common-actions's canonical template (scripts/nightly-launcher.sh.in, PR #363) rendered for this app: `effectcraft` starts `effectcraft-bin` beside it on the nightly-v1 profile under ai.storyteller.effectcraft.nightly, and both --version and -V reach the GUI as one plain --version. The distro formats are unchanged. The launcher test now pins the template's exact argv. --- packaging/linux/nightly-launch-test.sh | 31 ++++++++++++++++++++------ packaging/linux/nightly-launch.sh | 21 ++++++++--------- 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/packaging/linux/nightly-launch-test.sh b/packaging/linux/nightly-launch-test.sh index 90131c9fb..0d75cd47f 100755 --- a/packaging/linux/nightly-launch-test.sh +++ b/packaging/linux/nightly-launch-test.sh @@ -1,5 +1,10 @@ #!/usr/bin/env bash # Validate the launcher inside the flat Nightly tar without building or opening EffectCraft. +# +# That launcher is the canonical shared template (craft-common-actions scripts/nightly-launcher.sh.in), +# which the nightly producer accepts byte for byte: it starts `effectcraft-bin` beside itself on the +# nightly-v1 profile under the app's package identity, answers a version query with one plain +# `--version`, and wraps every other argument, including a command line that already names a profile. set -euo pipefail HERE="$(cd "$(dirname "$0")" && pwd)" @@ -19,8 +24,9 @@ chmod 755 "$stage/effectcraft" # A fixed profile base keeps the recorded arguments exactly comparable. export XDG_DATA_HOME="$work/xdg-data" +identity=ai.storyteller.effectcraft.nightly profile() { - printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$XDG_DATA_HOME/effectcraft-nightly" -- "$@" + printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$XDG_DATA_HOME/$identity" -- "$@" } expect() { expected="$1" @@ -33,14 +39,16 @@ expect() { } expect "$(profile)" expect "$(profile 'project with spaces.ec' '--other-name.ec')" 'project with spaces.ec' '--other-name.ec' -# A version query and an already selected profile pass through: after `--` both would be files. -expect '<--version>' --version -expect '<-V>' -V -expect "$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$work/launcher-root" --version)" \ - --launch-profile nightly-v1 --profile-root "$work/launcher-root" --version +# Both version spellings reach the GUI as one plain `--version`: the template never forwards `-V`. +expect "$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$XDG_DATA_HOME/$identity" --version)" --version +expect "$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$XDG_DATA_HOME/$identity" --version)" -V +# A command line that already names a profile is wrapped like any other argument: the template has no +# pass-through, so its own profile root is the one that is used and nothing the caller wrote is dropped. +supplied=(--launch-profile nightly-v1 --profile-root "$work/launcher-root" --version) +expect "$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$XDG_DATA_HOME/$identity" -- "${supplied[@]}")" "${supplied[@]}" # HOME is the only other base, and the profile root is never optional. home_run=$(env -u XDG_DATA_HOME HOME="$work/home" "$stage/effectcraft") -expected_home=$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$work/home/.local/share/effectcraft-nightly" --) +expected_home=$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$work/home/.local/share/$identity" --) if [[ "$home_run" != "$expected_home" ]]; then printf 'expected:\n%s\nactual:\n%s\n' "$expected_home" "$home_run" >&2 exit 1 @@ -49,5 +57,14 @@ if env -u XDG_DATA_HOME -u HOME "$stage/effectcraft" >/dev/null 2>&1; then echo 'a launcher without HOME must refuse rather than start with the stable profile' >&2 exit 1 fi +# The template starts the GUI beside itself or nothing: a missing copy is not looked for elsewhere. +mv "$stage/effectcraft-bin" "$work/moved-aside" +for args in "" "--version"; do + if "$stage/effectcraft" $args >/dev/null 2>&1; then + echo 'the launcher started without its GUI beside it' >&2 + exit 1 + fi +done +mv "$work/moved-aside" "$stage/effectcraft-bin" echo "PASS: the flat Nightly tar's launcher starts the GUI through the Nightly launch profile" diff --git a/packaging/linux/nightly-launch.sh b/packaging/linux/nightly-launch.sh index 7edb84e97..6cbc0374a 100755 --- a/packaging/linux/nightly-launch.sh +++ b/packaging/linux/nightly-launch.sh @@ -1,13 +1,14 @@ #!/bin/sh -# The launcher inside EffectCraft Nightly's flat tar: an unpacked copy is isolated like the -# packages, so it never falls back to the stable settings folder. The GUI itself is `effectcraft-bin`; -# `effectcraft` is the name people run, and the version query still answers from it. +# Nightly launcher generated by craft-common-actions scripts/nightly-launcher.sh.in. Do not edit: +# the shared nightly producer accepts this file only byte for byte as rendered for the app. set -eu - -here="$(dirname "$0")" -real_bin="$here/effectcraft-bin" -case "${1:-}" in - --version|-V|--launch-profile) exec "$real_bin" "$@" ;; +dir=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P) +readonly dir +target="$dir/effectcraft-bin" +readonly target +profile_root="${XDG_DATA_HOME:-$HOME/.local/share}/ai.storyteller.effectcraft.nightly" +readonly profile_root +case "${1-}" in + --version | -V) exec "$target" --launch-profile nightly-v1 --profile-root "$profile_root" --version ;; esac -profile_base="${XDG_DATA_HOME:-${HOME:?HOME is required}/.local/share}" -exec "$real_bin" --launch-profile nightly-v1 --profile-root "$profile_base/effectcraft-nightly" -- "$@" +exec "$target" --launch-profile nightly-v1 --profile-root "$profile_root" -- "$@"