mirror of
https://github.com/storytold/figcraft.git
synced 2026-12-04 19:41:51 -05:00
packaging(macos): check the bundled figcraft-cli in the DMG's app and its copy
This commit is contained in:
@@ -12,10 +12,13 @@ export DIST="$TEST_WORK/dist"
|
||||
mkdir -p "$TEST_WORK/stage/FigCraft.app/Contents/MacOS" "$TEST_WORK/stage/FigCraft.app/Contents/Resources" "$TEST_WORK/checks"
|
||||
APP="$TEST_WORK/stage/FigCraft.app"
|
||||
cp /usr/bin/true "$APP/Contents/MacOS/FigCraft"
|
||||
# Stands in for the bundled CLI (HAS_CLI): the check runs `figcraft-cli --version`.
|
||||
cp /usr/bin/true "$APP/Contents/MacOS/figcraft-cli"
|
||||
sed -e 's/@VERSION@/0.0.0/g' -e 's/@SHORT_VERSION@/0.0.0/g' -e 's/@BUILD_SHA@/test/g' \
|
||||
"$HERE/Info.plist.in" >"$APP/Contents/Info.plist"
|
||||
printf 'Test licence\n' >"$APP/Contents/Resources/License.txt"
|
||||
ln -s /Applications "$TEST_WORK/stage/Applications"
|
||||
codesign --force --sign - --timestamp=none "$APP/Contents/MacOS/figcraft-cli"
|
||||
codesign --force --sign - --timestamp=none "$APP/Contents/MacOS/FigCraft"
|
||||
codesign --force --sign - --timestamp=none "$APP"
|
||||
codesign --verify --deep --strict "$APP"
|
||||
@@ -91,4 +94,19 @@ fi
|
||||
grep -q 'DMG has no FigCraft.app' "$TEST_WORK/linked.log"
|
||||
assert_detached
|
||||
|
||||
echo 'DMG round trip: signed app and installation copy pass; FinderInfo in image/copy, missing app and symlink rejected; mounts cleaned up'
|
||||
# A validly signed app without the bundled CLI leaves the launcher nothing to register.
|
||||
if [[ "$HAS_CLI" = 1 ]]; then
|
||||
mkdir -p "$TEST_WORK/nocli"
|
||||
ditto "$APP" "$TEST_WORK/nocli/FigCraft.app"
|
||||
rm "$TEST_WORK/nocli/FigCraft.app/Contents/MacOS/figcraft-cli"
|
||||
codesign --force --sign - --timestamp=none "$TEST_WORK/nocli/FigCraft.app"
|
||||
create_dmg "$TEST_WORK/nocli" "$TEST_WORK/nocli.dmg"
|
||||
if verify_image "$TEST_WORK/nocli.dmg" >"$TEST_WORK/nocli.log" 2>&1; then
|
||||
echo "error: verifier accepted an app without its bundled figcraft-cli" >&2
|
||||
exit 1
|
||||
fi
|
||||
grep -q 'has no executable Contents/MacOS/figcraft-cli' "$TEST_WORK/nocli.log"
|
||||
assert_detached
|
||||
fi
|
||||
|
||||
echo 'DMG round trip: signed app and installation copy pass; FinderInfo in image/copy, missing app, symlink and missing CLI rejected; mounts cleaned up'
|
||||
|
||||
@@ -50,6 +50,15 @@ verify_dmg_app() (
|
||||
retry xcrun stapler validate "$app"
|
||||
retry spctl --assess --type execute -vvv "$app"
|
||||
fi
|
||||
# The ArtCraft Launcher registers FigCraft for agents only through the CLI beside the app.
|
||||
if [[ "${HAS_CLI:-0}" = 1 ]]; then
|
||||
local cli="$app/Contents/MacOS/figcraft-cli"
|
||||
if [[ -L "$cli" || ! -f "$cli" || ! -x "$cli" ]]; then
|
||||
echo "error: FigCraft.app has no executable Contents/MacOS/figcraft-cli: $app" >&2
|
||||
return 1
|
||||
fi
|
||||
"$cli" --version
|
||||
fi
|
||||
}
|
||||
|
||||
check_app "$check_work/mounted/FigCraft.app"
|
||||
|
||||
Reference in New Issue
Block a user