Use the shared nightly launcher template (#4169)

Renders the plain nightly tar's launcher from craft-common-actions' shared template.

Independent check: dylanmtaylor compared all 14 app launcher PRs byte for byte with the template rendered from the registry (https://github.com/storytold/craft-common-actions/pull/367#issuecomment-7172085284); this head was re-checked against craft-common-actions main 88148a5.
This commit is contained in:
skylar taylor-barrick authored and GitHub committed 2026-11-25 16:16:58 -06:00
1 parent 59aed45057
commit 5eccc055ce
2 files changed
+44 -17

No files matched your search

+31 -7
View File
@@ -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,23 @@ 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
# The ArtCraft Launcher starts the entry point with its own profile pair and per-install root; the
# template hands that line to the GUI unchanged.
supplied=(--launch-profile nightly-v1 --profile-root "$work/launcher-root" --version)
expect "$(printf '<%s>\n' "${supplied[@]}")" "${supplied[@]}"
supplied=(--launch-profile nightly-v1 --profile-root "$work/launcher root" -- 'project.ec')
expect "$(printf '<%s>\n' "${supplied[@]}")" "${supplied[@]}"
# Anything else is wrapped in the template's own profile, including a profile line that does not open
# the arguments and an `=` spelling of the selector.
wrapped=(--profile-root "$work/launcher-root" --)
expect "$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$XDG_DATA_HOME/$identity" -- "${wrapped[@]}")" "${wrapped[@]}"
expect "$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$XDG_DATA_HOME/$identity" -- --launch-profile=nightly-v1)" --launch-profile=nightly-v1
# 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 +64,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"
+13 -10
View File
@@ -1,13 +1,16 @@
#!/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
# The ArtCraft Launcher passes its own profile and per-install root; the app validates the pair.
--launch-profile) exec "$target" "$@" ;;
--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" -- "$@"