Files
Trace/scripts/bundle.sh
Blue 43784615bd Add app icon, README screenshots, demo mode and release packaging
- App icon drawn by scripts/make-icon.swift; the in-app mark uses the same pulse line.
- README rewritten with screenshots, install steps and a Chinese summary.
- --demo starts the app with made-up data in memory; --shots <folder> saves
  the README screenshots from it.
- scripts/release.sh builds a universal app and packages a DMG and a zip,
  with optional Developer ID signing and notarization.
- Inspector shows long paths and URLs in full.
2026-11-13 21:11:41 +08:00

40 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# Builds Trace and assembles build/Trace.app.
#
# scripts/bundle.sh release build, ad-hoc signed
# scripts/bundle.sh debug debug build
#
# Set CODESIGN_IDENTITY to a certificate name (see `security find-identity -v
# -p codesigning`) to sign with it. With the default ad-hoc signature macOS
# treats every rebuild as a new app, so Accessibility access has to be granted
# again after each build.
set -euo pipefail
cd "$(dirname "$0")/.."
CONFIG="${1:-release}"
# A local, untracked .codesign-identity file saves typing the variable each time.
if [ -z "${CODESIGN_IDENTITY:-}" ] && [ -f .codesign-identity ]; then
CODESIGN_IDENTITY="$(head -n 1 .codesign-identity)"
fi
IDENTITY="${CODESIGN_IDENTITY:--}"
APP="build/Trace.app"
# UNIVERSAL=1 builds for both Apple silicon and Intel.
ARCHS=()
if [ "${UNIVERSAL:-0}" = "1" ]; then ARCHS=(--arch arm64 --arch x86_64); fi
swift build -c "$CONFIG" ${ARCHS[@]+"${ARCHS[@]}"}
BIN="$(swift build -c "$CONFIG" ${ARCHS[@]+"${ARCHS[@]}"} --show-bin-path)/Trace"
rm -rf "$APP"
mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"
cp "$BIN" "$APP/Contents/MacOS/Trace"
cp Support/Info.plist "$APP/Contents/Info.plist"
cp Support/AppIcon.icns "$APP/Contents/Resources/AppIcon.icns"
cp -R Resources/*.lproj "$APP/Contents/Resources/"
# English is the source language; an empty en.lproj lets macOS list it.
mkdir -p "$APP/Contents/Resources/en.lproj"
# The hardened runtime is required for notarization and harmless otherwise.
codesign --force --options runtime --timestamp=none --sign "$IDENTITY" "$APP"
echo "Built $APP"