#!/bin/sh # Base's screenshot gate (rastrillo/native RastrilloSnapshots): the look # (the sky at its still pose, the surfaces, the type scale, the marks) and # Ask (the mockups' thread, its states and cards), light and dark, and on # iPhone at the default size and AX3. # # native/scripts/snapshots.sh [compare|record] [mac|iphone|all] # # compare (the default) fails on any changed, missing or stale picture; # record redraws the baselines in apple/Tests/BaseSnapshots/__Snapshots__/. # Review the contact sheets, apple/.build/snapshots/base-*/index.html, # before committing a recording, beside the approved mockups # (.superpowers/mockups/native/, git-ignored). # # Not in .amadan/ci.d: baselines are exact only on the OS and simulator # runtime that drew them (ENVIRONMENT beside them says which). The runner # scripts are rastrillo/native's own, from the pinned checkout; the iPhone # half runs on its "Rastrillo Snapshots" simulator under its lock. Drawn # with Timeless Sans when `make fonts` has fetched it; a run without it # draws DM Sans, and fails against baselines drawn in Timeless. set -eu cd "$(dirname "$0")/.." mode=${1:-compare} platforms=${2:-all} case "$mode" in compare|record) ;; *) echo "usage: $0 [compare|record] [mac|iphone|all]" >&2; exit 2 ;; esac case "$platforms" in mac|iphone|all) ;; *) echo "usage: $0 [compare|record] [mac|iphone|all]" >&2; exit 2 ;; esac scripts/fonts-into-bundle.sh swift package --package-path apple resolve shared=${OFICINA_NATIVE_PACKAGE_PATH:-apple/.build/checkouts/native} case "$shared" in /*) ;; *) shared="$(pwd)/$shared" ;; esac tools="$shared/tools" failed=0 case "$platforms" in mac|all) (cd apple && swift build --build-tests) if ! (cd apple && "$tools/snapshots-mac.sh" "$mode" BaseSnapshots); then failed=1; fi ;; esac case "$platforms" in iphone|all) xcodegen generate --spec ios/project.yml if ! (cd apple && SNAPSHOT_DERIVED_DATA=.build/xcode "$tools/snapshots-iphone.sh" "$mode" BasePhoneSnapshots BasePhoneSnapshots \ -project ../ios/BasePhone.xcodeproj -test-timeouts-enabled YES -default-test-execution-time-allowance 120); then failed=1 fi ;; esac exit "$failed"