tv-anarchy/tools/stamp-build.sh
Natalie 4a2ceb9781 feat(offline): inline star-to-keep and trash-to-cull on cache rows
Surface the existing pin (keep-from-cull) and per-file delete actions as
visible inline buttons on each offline cache row instead of context-menu-only:
a star toggles protection from auto-cull (and restore-if-missing), a trash
culls that file early. Aligns wording/icons to the star metaphor.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 00:12:41 -04:00

53 lines
No EOL
1.7 KiB
Bash
Executable file

#!/usr/bin/env bash
# Write build identity before xcodegen/xcodebuild:
# Config/BuildVersion.xcconfig → MARKETING_VERSION + CURRENT_PROJECT_VERSION
# Sources/TVAnarchyCore/BuildStamp.swift → compiled identity for the running app
#
# Semver is automatic: latest vX.Y.Z tag + commits since tag bump the patch
# (no tag → 0.1.<commitCount>). Run BEFORE `xcodegen generate`.
set -euo pipefail
cd "$(dirname "$0")/.."
SHA=$(git rev-parse --short HEAD 2>/dev/null || echo nogit)
IS_DIRTY=false
if [ -n "$(git status --porcelain 2>/dev/null)" ]; then
IS_DIRTY=true
SHA="${SHA}-dirty"
fi
COUNT=$(git rev-list --count HEAD 2>/dev/null || echo 0)
STAMP=$(date "+%Y-%m-%d %H:%M:%S")
# Auto semver: v1.1.0 + 50 commits since → 1.1.50
TAG=$(git describe --tags --match 'v[0-9]*' --abbrev=0 2>/dev/null || true)
if [ -n "$TAG" ]; then
BASE="${TAG#v}"
IFS=. read -r VMAJ VMIN VPAT <<< "$BASE"
VPAT=${VPAT:-0}
SINCE=$(git rev-list --count "${TAG}..HEAD" 2>/dev/null || echo 0)
VPAT=$((VPAT + SINCE))
VERSION="${VMAJ}.${VMIN}.${VPAT}"
else
VERSION="0.1.${COUNT}"
fi
mkdir -p Config
XCCONFIG="Config/BuildVersion.xcconfig"
cat > "$XCCONFIG" <<EOF
// GENERATED by tools/stamp-build.sh — do not edit, gitignored.
MARKETING_VERSION = ${VERSION}
CURRENT_PROJECT_VERSION = ${COUNT}
EOF
OUT="Sources/TVAnarchyCore/BuildStamp.swift"
cat > "$OUT" <<EOF
// GENERATED by tools/stamp-build.sh — do not edit, gitignored.
enum BuildStamp {
static let version = "${VERSION}"
static let sha = "${SHA}"
static let commitCount = ${COUNT}
static let buildTime = "${STAMP}"
static let isDirty = ${IS_DIRTY}
}
EOF
echo "stamped v${VERSION} (build ${COUNT}) · ${SHA} @ ${STAMP}${XCCONFIG}, ${OUT}"