Merge upstream main preserving custom feature integrations

This commit is contained in:
MasterControl committed 2026-11-10 17:08:15 +00:00
commit 6150a1ac57
228 files changed
+16844 -1388

No files matched your search

+4
View File
@@ -26,10 +26,14 @@ function embedEnabled() {
/** Xcode's own builds of the watch project read this too, so they sign the same way. */
function writeLocalConfig() {
const version = /FACECLAW_VERSION = "(.*)"/.exec(fs.readFileSync(path.join(root, 'app/version.ts'), 'utf8'))[1];
const build = execFileSync('/usr/libexec/PlistBuddy', [
'-c', 'Print :CFBundleVersion', path.join(root, 'App_Resources/iOS/Info.plist'),
], { encoding: 'utf8' }).trim();
const lines = [
`FACECLAW_IOS_BUNDLE_ID = ${process.env.IOS_BUNDLE_ID || 'com.faceclaw.app'}`,
// An embedded watch app has to carry the phone app's version.
`MARKETING_VERSION = ${version}`,
`CURRENT_PROJECT_VERSION = ${build}`,
];
if (process.env.IOS_TEAM_ID) lines.push(`DEVELOPMENT_TEAM = ${process.env.IOS_TEAM_ID}`);
fs.writeFileSync(path.join(root, 'apple-watch/Local.xcconfig'), `${lines.join('\n')}\n`);
+6
View File
@@ -102,6 +102,12 @@ Use `--device` / `-d` or set `IOS_DEVICE` when more than one device is connected
Without either, the script selects the only device with an active Xcode tunnel.
For the simulator, add `--simulator` (defaults to `booted`; `--device` selects one).
`scripts/resetOnboardingIos.sh` is the iOS counterpart of `scripts/resetOnboarding.sh`.
It pulls the config, then pushes every `onboarding.*` key that is set back to its empty
value, which the app reads the same as a missing key. Pushes can't remove keys, and the
plist can't be edited directly (see below). Its `--all` uninstalls the app, since iOS has
no equivalent of `pm clear`.
Transfers use `devicectl` app-container access. The app consumes a uniquely
identified request at bootstrap, before loading settings getters and workers;
it applies imports through NSUserDefaults rather than overwriting a plist that
+127 -62
View File
@@ -18,6 +18,7 @@ BUNDLE = os.environ.get('IOS_BUNDLE_ID') or 'com.faceclaw.app'
REMOTE = 'Library/FaceclawConfigPort'
# The app reads requests of up to 8 MiB: a 2 MiB document embedded as an escaped JSON string.
REQUEST_LIMIT = 8 * 1024 * 1024
ONBOARDING_PREFIX = 'onboarding.'
def run(args, tolerate=False):
@@ -46,96 +47,160 @@ def atomic_write(path, data):
temporary.unlink(missing_ok=True)
def resolve_device(args, work):
device = args.device or os.environ.get('IOS_DEVICE')
if args.simulator:
return device or 'booted'
if device:
return device
listing = work / 'devices.json'
run(['devicectl', 'list', 'devices', '--json-output', str(listing)])
devices = json.loads(listing.read_text())['result']['devices']
available = [d for d in devices if d.get('connectionProperties', {}).get('tunnelState') == 'connected']
if len(available) != 1:
raise ValueError('Specify the iPhone with --device UDID (or IOS_DEVICE)')
return available[0]['identifier']
def exchange(args, work, device, operation, document=None):
"""Restart the app with one request for it to consume at launch; returns its successful reply."""
if args.simulator:
container = Path(run(['simctl', 'get_app_container', device, BUNDLE, 'data']).stdout.strip())
identifier = str(uuid.uuid4())
payload = {'id': identifier, 'operation': operation}
if document is not None:
payload['document'] = document
encoded = json.dumps(payload, ensure_ascii=False, allow_nan=False).encode()
if len(encoded) > REQUEST_LIMIT:
raise ValueError('Config request exceeds 8 MiB')
stage = work / 'FaceclawConfigPort'
stage.mkdir(mode=0o700, exist_ok=True)
atomic_write(stage / 'request.json', encoded)
if args.simulator:
remote = container / REMOTE
remote.mkdir(parents=True, exist_ok=True)
atomic_write(remote / 'request.json', encoded)
run(['simctl', 'terminate', device, BUNDLE], tolerate=True)
run(['simctl', 'launch', device, BUNDLE])
else:
run(['devicectl', 'device', 'copy', 'to', '--device', device, '--domain-type', 'appDataContainer',
'--domain-identifier', BUNDLE, '--source', str(stage), '--destination', REMOTE])
run(['devicectl', 'device', 'process', 'launch', '--device', device, '--terminate-existing', BUNDLE])
deadline = time.monotonic() + 25
response = None
while time.monotonic() < deadline:
if args.simulator:
response_path = remote / 'response.json'
else:
response_path = work / 'response.json'
run(['devicectl', 'device', 'copy', 'from', '--device', device, '--domain-type', 'appDataContainer',
'--domain-identifier', BUNDLE, '--source', REMOTE + '/response.json', '--destination', str(response_path)], tolerate=True)
try:
candidate = json.loads(response_path.read_text())
if candidate.get('id') == identifier:
response = candidate
break
except (OSError, ValueError):
pass
time.sleep(0.5)
if response is None:
raise RuntimeError('No matching config response. Unlock the phone and install a build with config-port support, then retry.')
if not response.get('ok'):
message = response.get('message', 'Config transfer failed')
if message == 'Invalid config request':
message += ' (does the installed build predate JSON config documents?)'
raise RuntimeError(message)
return response
def pull_document(args, work, device):
response = exchange(args, work, device, 'pull')
if not isinstance(response.get('document'), str):
raise RuntimeError('The installed build predates JSON config documents; update it and retry.')
return response
def transfer(args):
# Parse and validate before touching the device or restarting its app.
document = read_document(args.file) if args.operation == 'push' else None
with tempfile.TemporaryDirectory(prefix='faceclaw-config-') as work:
work = Path(work)
device = args.device or os.environ.get('IOS_DEVICE')
if args.simulator:
device = device or 'booted'
container = Path(run(['simctl', 'get_app_container', device, BUNDLE, 'data']).stdout.strip())
else:
if not device:
listing = work / 'devices.json'
run(['devicectl', 'list', 'devices', '--json-output', str(listing)])
devices = json.loads(listing.read_text())['result']['devices']
available = [d for d in devices if d.get('connectionProperties', {}).get('tunnelState') == 'connected']
if len(available) != 1:
raise ValueError('Specify the iPhone with --device UDID (or IOS_DEVICE)')
device = available[0]['identifier']
identifier = str(uuid.uuid4())
payload = {'id': identifier, 'operation': args.operation}
if document is not None:
payload['document'] = document
encoded = json.dumps(payload, ensure_ascii=False, allow_nan=False).encode()
if len(encoded) > REQUEST_LIMIT:
raise ValueError('Config request exceeds 8 MiB')
stage = work / 'FaceclawConfigPort'
stage.mkdir(mode=0o700)
atomic_write(stage / 'request.json', encoded)
if args.simulator:
remote = container / REMOTE
remote.mkdir(parents=True, exist_ok=True)
atomic_write(remote / 'request.json', encoded)
run(['simctl', 'terminate', device, BUNDLE], tolerate=True)
run(['simctl', 'launch', device, BUNDLE])
else:
run(['devicectl', 'device', 'copy', 'to', '--device', device, '--domain-type', 'appDataContainer',
'--domain-identifier', BUNDLE, '--source', str(stage), '--destination', REMOTE])
run(['devicectl', 'device', 'process', 'launch', '--device', device, '--terminate-existing', BUNDLE])
deadline = time.monotonic() + 25
response = None
while time.monotonic() < deadline:
if args.simulator:
response_path = remote / 'response.json'
else:
response_path = work / 'response.json'
run(['devicectl', 'device', 'copy', 'from', '--device', device, '--domain-type', 'appDataContainer',
'--domain-identifier', BUNDLE, '--source', REMOTE + '/response.json', '--destination', str(response_path)], tolerate=True)
try:
candidate = json.loads(response_path.read_text())
if candidate.get('id') == identifier:
response = candidate
break
except (OSError, ValueError):
pass
time.sleep(0.5)
if response is None:
raise RuntimeError('No matching config response. Unlock the phone and install a build with config-port support, then retry.')
if not response.get('ok'):
message = response.get('message', 'Config transfer failed')
if message == 'Invalid config request':
message += ' (does the installed build predate JSON config documents?)'
raise RuntimeError(message)
device = resolve_device(args, work)
if args.operation == 'pull':
if not isinstance(response.get('document'), str):
raise RuntimeError('The installed build predates JSON config documents; update it and retry.')
response = pull_document(args, work, device)
atomic_write(args.file, response['document'].encode())
print(f'Pulled {response.get("count", "?")} settings to {args.file} (mode 600). App restarted.')
else:
response = exchange(args, work, device, 'push', document)
skipped = response.get('skipped') or []
note = f' Left out {len(skipped)} {response.get("sourcePlatform") or "other-platform"}-only settings.' if skipped else ''
print(f'Pushed {response["count"]} settings; app restarted.{note} Unspecified settings preserved; '
f'previous preferences backed up in {REMOTE}/previous.plist.')
def onboarding_reset_document(pulled):
"""A document clearing the onboarding keys set in a pulled config, or None if none are.
Pushes merge, so a key can be overwritten but not removed. Every onboarding key reads the
value written here the same as a missing key: false for flags, "" for the finished version.
"""
cleared = {}
for key, value in json.loads(pulled).get('platformSettings', {}).items():
if not key.startswith(ONBOARDING_PREFIX):
continue
blank = False if isinstance(value, bool) else 0 if isinstance(value, (int, float)) else ''
if value != blank:
cleared[key] = blank
if not cleared:
return None
return json.dumps({'schema': 2, 'platform': 'ios', 'settings': {}, 'platformSettings': cleared})
def reset_onboarding(args):
with tempfile.TemporaryDirectory(prefix='faceclaw-config-') as work:
work = Path(work)
device = resolve_device(args, work)
if args.all:
print(f'Uninstalling {BUNDLE}, which removes ALL of its data...')
if args.simulator:
run(['simctl', 'uninstall', device, BUNDLE])
else:
run(['devicectl', 'device', 'uninstall', 'app', '--device', device, BUNDLE])
print('Done. Reinstall (npm run run:ios) to start from a clean onboarding.')
return
print(f'Clearing onboarding preference keys ({ONBOARDING_PREFIX}*) for {BUNDLE}...')
document = onboarding_reset_document(pull_document(args, work, device)['document'])
if document is None:
print('No onboarding keys were set. App is already in pre-onboarding state.')
return
keys = json.loads(document)['platformSettings']
exchange(args, work, device, 'push', document)
for key in keys:
print(f' cleared {key}')
print(f'Done. Faceclaw has restarted into onboarding; previous preferences backed up in {REMOTE}/previous.plist.')
def main():
os.umask(0o077)
parser = argparse.ArgumentParser(description='Pull/push iOS Faceclaw config; restarts the app. Requires Xcode and an unlocked development device. Push merges supplied keys; accepts Faceclaw JSON from either platform, or legacy Android XML.')
parser.add_argument('operation', choices=['pull', 'push'])
parser = argparse.ArgumentParser(description='Pull/push iOS Faceclaw config, or reset its onboarding state; restarts the app. Requires Xcode and an unlocked development device. Push merges supplied keys; accepts Faceclaw JSON from either platform, or legacy Android XML.')
parser.add_argument('operation', choices=['pull', 'push', 'reset-onboarding'])
parser.add_argument('path', nargs='?')
parser.add_argument('-f', '--file')
parser.add_argument('-d', '--device', help='iPhone UDID/name, or simulator ID with --simulator; defaults to IOS_DEVICE or the only connected device')
parser.add_argument('--simulator', action='store_true', help='Use simctl (default device: booted)')
parser.add_argument('--all', action='store_true', help='With reset-onboarding: uninstall the app, wiping ALL of its data')
args = parser.parse_args()
if args.operation == 'reset-onboarding' and (args.path or args.file):
parser.error('reset-onboarding does not take a file')
if args.all and args.operation != 'reset-onboarding':
parser.error('--all only applies to reset-onboarding')
if args.path and args.file:
parser.error('Specify one file, either positional or with -f')
args.file = args.file or args.path or 'faceclaw_settings.ios.json'
if args.operation == 'pull' and Path(args.file).suffix.lower() == '.xml':
parser.error('Configs are pulled as JSON; choose a .json filename')
try:
transfer(args)
(reset_onboarding if args.operation == 'reset-onboarding' else transfer)(args)
except (OSError, ValueError, RuntimeError, ET.ParseError) as error:
print(f'Error: {error}', file=sys.stderr)
return 1
+19 -7
View File
@@ -15,20 +15,21 @@
# scripts/resetOnboarding.sh --all # full `pm clear` (wipes everything)
# scripts/resetOnboarding.sh -s <device-id> # target a specific adb device
#
# The device id defaults to $FACECLAW_DEVICE_ID, then to the id used by
# build_and_run.sh. adb is located the same way build.sh finds its tools.
# The device id defaults to DEVICE_ID from build_paths.sh, the same device
# build_and_run.sh targets. adb must be on PATH, or added to it in build_paths.sh.
# Sourced ahead of strict mode, since the build scripts source it without one.
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
if [ -f "$ROOT/build_paths.sh" ]; then
source "$ROOT/build_paths.sh"
fi
set -euo pipefail
PACKAGE="com.faceclaw.app"
PREF_KEY_PREFIX="onboarding."
DEVICE_ID="${FACECLAW_DEVICE_ID:-3A101JEHN12330}"
WIPE_ALL=0
# Match build.sh's tool locations so adb is on PATH even from a bare shell.
export ANDROID_HOME="${ANDROID_HOME:-/Users/jbabcock/Library/Android/sdk}"
export PATH="$ANDROID_HOME/platform-tools:$PATH"
while [ $# -gt 0 ]; do
case "$1" in
--all) WIPE_ALL=1; shift ;;
@@ -44,8 +45,19 @@ done
command -v adb >/dev/null 2>&1 || { echo "error: adb not found on PATH" >&2; exit 1; }
if [ -z "${DEVICE_ID:-}" ]; then
echo "error: no adb device; set DEVICE_ID in build_paths.sh or pass -s <device-id>." >&2
exit 2
fi
ADB="adb -s $DEVICE_ID"
# Network devices (host:port) need an explicit connect first. A failure here is
# reported by the connected-device check below.
case "$DEVICE_ID" in
*:*) adb connect "$DEVICE_ID" >/dev/null 2>&1 || true ;;
esac
# Confirm the device is actually there before doing anything.
if ! $ADB get-state >/dev/null 2>&1; then
echo "error: adb device '$DEVICE_ID' not connected." >&2
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
#
# resetOnboardingIos.sh — reset Faceclaw on an iPhone back to its pre-onboarding
# state, for testing the onboarding flow repeatedly. The iOS counterpart of
# resetOnboarding.sh.
#
# By default this only clears the onboarding-related preference keys
# (onboarding.complete, onboarding.previewOnly, the on-glasses onboarding's
# onboarding.glassesFinishedVersion, ...) and leaves everything else, notably
# the saved glasses/ring identities, intact. It restarts Faceclaw twice, and
# leaves it running in onboarding. Pass --all to uninstall the app instead,
# which wipes ALL of its data and permissions; you then have to reinstall it.
#
# Usage:
# scripts/resetOnboardingIos.sh # reset onboarding flags only
# scripts/resetOnboardingIos.sh --all # uninstall (wipes everything)
# scripts/resetOnboardingIos.sh -d <device-id> # target a specific iPhone
# scripts/resetOnboardingIos.sh --simulator # target the booted simulator
#
# The device defaults to IOS_DEVICE from build_paths.sh, then to the only iPhone
# connected. Needs Xcode and an unlocked phone with a development build installed;
# see config-transfer.md.
# Sourced ahead of strict mode, since the build scripts source it without one.
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
if [ -f "$ROOT/build_paths.sh" ]; then
source "$ROOT/build_paths.sh"
fi
set -euo pipefail
# ios_config.py reads these from its environment.
export IOS_DEVICE IOS_BUNDLE_ID
exec python3 "$ROOT/scripts/ios_config.py" reset-onboarding "$@"
+213
View File
@@ -0,0 +1,213 @@
#!/usr/bin/env bash
#
# Build the sibling ScouterKit G1 firmware (g1v0), then update Faceclaw's
# embedded copy of it (app/g1/firmware/, via tools/g1_firmware_bundle.py).
#
# Usage:
# scripts/update_g1_firmware.sh [--gate] [--skip-build] [--allow-uncommitted] VERSION
#
# VERSION is the g1v0 version to build and ship, e.g. 0.5.67. It must be newer
# than the one Faceclaw ships now: the app only offers an install to arms older
# than that, and every build gets a fresh (RSA-PSS) signature, so a rebuild
# under the same version would never reach arms that already run it.
#
# --gate also run ScouterKit's emulator gate (scripts/gate.sh
# VERSION) before bundling. Needs `scripts/setup.sh
# emulator` to have been run once in g1_firmware/.
# --skip-build bundle the existing build of VERSION (e.g. one that has
# already been gated) instead of rebuilding. With the
# version Faceclaw already ships, this refreshes the
# manifest's source commit after committing scouter_kit.
# --allow-uncommitted bundle firmware whose sources in scouter_kit are not
# committed (tests/g1-firmware.test.cjs then fails).
#
# Set SCOUTER_KIT_DIR to use a scouter_kit checkout somewhere other than
# ~/src/scouter_kit. The build uses ScouterKit's podman containers (its
# `scripts/setup.sh build`). If g1_firmware/work/macos/env.sh exists (a native
# macOS build environment with a podman stand-in) it is sourced for the build
# and the gate; set G1_BUILD_ENV to source a different script instead.
set -euo pipefail
usage() {
sed -n '6,7p' "${BASH_SOURCE[0]}" | sed 's/^# //' >&2
exit "${1:-2}"
}
GATE=0
SKIP_BUILD=0
ALLOW_UNCOMMITTED=0
VERSION=
while [ $# -gt 0 ]; do
case "$1" in
--gate) GATE=1 ;;
--skip-build) SKIP_BUILD=1 ;;
--allow-uncommitted) ALLOW_UNCOMMITTED=1 ;;
-h|--help) usage 0 ;;
-*) echo "error: unknown option $1" >&2; usage ;;
*)
[ -z "$VERSION" ] || usage
VERSION=$1
;;
esac
shift
done
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
FACECLAW_DIR="$(cd -- "$SCRIPT_DIR/.." && pwd)"
SCOUTER_KIT_DIR="${SCOUTER_KIT_DIR:-"$HOME/src/scouter_kit"}"
FW="$SCOUTER_KIT_DIR/g1_firmware"
BUNDLER="$FACECLAW_DIR/tools/g1_firmware_bundle.py"
MANIFEST_TS="$FACECLAW_DIR/app/g1/firmware/g1v0-image.ts"
BUILD_ENV="${G1_BUILD_ENV:-"$FW/work/macos/env.sh"}"
# The manifest's top-level fields are indented by two spaces; its parts' by six.
manifest_field() {
sed -n "s/^ \"$1\": \"\\(.*\\)\",\$/\\1/p" "$MANIFEST_TS"
}
SHIPPED_VERSION="$(manifest_field version)"
SHIPPED_SHA256="$(manifest_field sha256)"
if [ -z "$VERSION" ]; then
echo "error: no VERSION given (Faceclaw ships g1v0 ${SHIPPED_VERSION:-?} now)" >&2
usage
fi
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "error: VERSION must look like 0.5.67, not $VERSION" >&2
exit "${1:-2}"
fi
if [ ! -x "$FW/scripts/build.sh" ]; then
echo "error: ScouterKit build script not found or not executable: $FW/scripts/build.sh" >&2
exit 1
fi
if ! command -v python3 >/dev/null 2>&1; then
echo "error: python3 is required" >&2
exit 1
fi
if [ -z "$SHIPPED_VERSION" ] || [ -z "$SHIPPED_SHA256" ]; then
echo "error: cannot read the shipped version and sha256 from $MANIFEST_TS" >&2
exit 1
fi
# Prints -1, 0 or 1 as $1 is older than, the same as or newer than $2.
compare_versions() {
awk -v a="$1" -v b="$2" 'BEGIN {
split(a, x, "."); split(b, y, ".")
for (i = 1; i <= 3; i++) {
if (x[i] + 0 < y[i] + 0) { print -1; exit }
if (x[i] + 0 > y[i] + 0) { print 1; exit }
}
print 0
}'
}
case "$(compare_versions "$VERSION" "$SHIPPED_VERSION")" in
-1)
echo "error: Faceclaw already ships g1v0 $SHIPPED_VERSION, newer than $VERSION" >&2
exit 1
;;
0)
if [ "$SKIP_BUILD" = 0 ]; then
echo "error: Faceclaw already ships g1v0 $VERSION; a rebuild needs a new version, or arms" >&2
echo "already on $VERSION would never be offered it. (--skip-build re-bundles the shipped build.)" >&2
exit 1
fi
;;
esac
# The same paths tools/g1_firmware_bundle.py checks to mark a source "+uncommitted".
UNCOMMITTED="$(git -C "$FW" status --porcelain -- firmware ../src/vm)"
if [ -n "$UNCOMMITTED" ]; then
if [ "$ALLOW_UNCOMMITTED" = 0 ]; then
echo "error: the firmware sources in $SCOUTER_KIT_DIR have uncommitted changes:" >&2
echo "$UNCOMMITTED" >&2
echo "Commit them first, or pass --allow-uncommitted (tests/g1-firmware.test.cjs then fails)." >&2
exit 1
fi
echo "warning: bundling firmware built from uncommitted sources" >&2
fi
# Runs a command in g1_firmware/, in the build environment if there is one.
in_scouter_kit() {
(
if [ -f "$BUILD_ENV" ]; then
# shellcheck disable=SC1090
. "$BUILD_ENV"
fi
cd "$FW"
"$@"
)
}
# Where scripts/build.sh puts its output (G1_WORK and G1_BUILD may come from the build environment).
BUILD_DIR="$(in_scouter_kit sh -c 'w=${G1_WORK:-$PWD/work}; echo "${G1_BUILD:-$w/build}"')"
v="$(echo "$VERSION" | tr -d .)"
IMAGE="$BUILD_DIR/g1v0-v$v/zephyr/app_update.bin"
if [ "$SKIP_BUILD" = 0 ]; then
echo "Building g1v0 $VERSION in $FW (four variants; logs in $BUILD_DIR/logs)..."
BUILD_OUTPUT="$(in_scouter_kit scripts/build.sh "$VERSION" 2>&1)" || true
echo "$BUILD_OUTPUT"
# build.sh reports each variant but exits 0 even when one fails, and a failed
# build can leave an older image behind, so trust only its "ok" line.
if ! grep -qx "g1v0-v$v ok" <<<"$BUILD_OUTPUT"; then
LOG="$BUILD_DIR/logs/build-g1v0-v$v.log"
echo "error: the g1v0 $VERSION build failed" >&2
if [ -f "$LOG" ]; then
echo "--- last lines of $LOG:" >&2
tail -20 "$LOG" >&2
fi
exit 1
fi
fi
if [ ! -f "$IMAGE" ]; then
echo "error: no build of g1v0 $VERSION at $IMAGE" >&2
exit 1
fi
IMAGE_VERSION="$(python3 -I - "$IMAGE" <<'PY'
import struct
import sys
with open(sys.argv[1], "rb") as f:
header = f.read(24)
if len(header) < 24 or header[:4] != bytes.fromhex("3db8f396"):
print("not an MCUboot image")
else:
print("%d.%d.%d" % struct.unpack_from("<BBH", header, 20))
PY
)"
if [ "$IMAGE_VERSION" != "$VERSION" ]; then
echo "error: $IMAGE is g1v0 $IMAGE_VERSION, not $VERSION" >&2
exit 1
fi
if [ "$VERSION" = "$SHIPPED_VERSION" ]; then
IMAGE_SHA256="$(python3 -I -c 'import hashlib, sys; print(hashlib.sha256(open(sys.argv[1], "rb").read()).hexdigest())' "$IMAGE")"
if [ "$IMAGE_SHA256" != "$SHIPPED_SHA256" ]; then
echo "error: $IMAGE is not the g1v0 $VERSION build Faceclaw ships (sha256 $IMAGE_SHA256," >&2
echo "shipped $SHIPPED_SHA256); a different image needs a new version" >&2
exit 1
fi
fi
if [ "$GATE" = 1 ]; then
echo "Running the emulator gate for g1v0 $VERSION..."
if ! in_scouter_kit scripts/gate.sh "$VERSION"; then
echo "error: the emulator gate failed for g1v0 $VERSION. Results are in its work/runs/gate-*/;" >&2
echo "rerun failing tests with scripts/gate.sh $VERSION TEST..., then this script with --skip-build." >&2
exit 1
fi
fi
python3 -I "$BUNDLER" "$IMAGE" --firmware-dir "$FW"
if [ "$VERSION" = "$SHIPPED_VERSION" ]; then
echo "Re-bundled g1v0 $VERSION (same image)."
else
echo "Faceclaw now ships g1v0 $VERSION (was $SHIPPED_VERSION)."
echo "If Faceclaw now requires it, also bump REQUIRED_FIRMWARE in native/kotlin/shared/src/commonMain/kotlin/com/faceclaw/app/g1/G1Protocol.kt."
fi
if [ "$GATE" = 0 ] && [ "$SKIP_BUILD" = 0 ]; then
echo "This build has not been through the emulator gate: before shipping it, run"
echo " (cd $FW && scripts/gate.sh $VERSION)"
echo "which tests this same build, or rerun this script with --gate."
fi