mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 11:07:10 +00:00
* feat(companion): add appState, eraseText, pressKey runner handlers
The Go runner transport already calls these methods; the in-device runner
implemented them only latently. They become load-bearing on the device
path, where the hybrid's legacy-companion fallback is absent. Backward
compatible: the simulator hybrid never calls them.
* feat(ios): resolve physical devices from devicectl
ResolveDevice parses xcrun devicectl list devices into Device{Name,
HardwareUDID, CoreDeviceID}: the hardware UDID feeds xcodebuild/iproxy
and the CoreDevice id feeds devicectl install. Matches by name or either
id; errors list candidates on none/ambiguous. Fixes the stale sidecar
comment on ResolveTarget.
* feat(ioscompanion): runner-only device driver mode
NewDevice reuses Driver with d.companion set to the runner dialed over an
iproxy usbmux tunnel, hybrid=false, runnerClient=nil. The existing accessor
seams then route launch/snapshot/text/gesture to the runner with no new
DeviceDriver methods. Device seams swap clear-state to a devicectl
reinstall, container reset to a warn-once no-op, and paste grant to a no-op.
realSpawnDeviceRunner builds and signs the runner at run time via the App
Store Connect API key (no Xcode UI), caching on a source hash.
* test(ioscompanion): cover device wiring, routing, and shell-out argv
Seam-driven NewDevice wiring + gesture/text routing (asserting no keyboard
HID), devicectl/build/test/iproxy argv builders, xctestrun test-target dict
name parsing, signing-credential env checks, and source-hash cache keying.
* feat(testrun): route physical-device iOS runs to the device driver
Execute resolves a non-simulator iOS target through ios.ResolveDevice into
its hardware UDID and CoreDevice id; buildDriver constructs NewDevice via a
seam instead of rejecting the device. Generalizes the --ios-device and
--ios-app-path help to cover the device path; signing stays env-read, never
a flag.
* feat(doctor): device prereqs replace java/sidecar for ios-device
iosDeviceChecks now verifies devicectl, iproxy on PATH, a connected+paired
device (via ios.ConnectedDevices), and App Store Connect signing creds (via
ioscompanion.VerifyDeviceSigning). The retired JVM sidecar checks stay only
under android.
* feat(conformance): device backend uses iphoneos app and tunnel orphan checks
The device backend now builds via just ios-device, points --ios-app-path at
the Debug-iphoneos bundle, and reinstalls each run for clear-state. The G5
orphan scan replaces the retired sidecar.jar check with lingering iproxy and
device test-without-building sessions (destination platform=iOS,id=).
* feat(folio): device build linking the iosArm64 framework
project.yml selects the Kotlin framework slice by SDK (iosArm64 for
iphoneos, iosSimulatorArm64 for simulator) and links via -framework Shared
on the SDK-conditional search path. New ios-device/test-ios-device recipes
mirror ios/test-ios, signing the Debug-iphoneos build with the .env API key.
* docs(cli): document ios-device doctor checks and the device flags
The --ios-device flag now also selects a connected device; --ios-app-path
covers the device install; the doctor gains an ios-device platform whose
checks are devicectl, iproxy, a paired device, and signing credentials.
Corrects the --clear-data default to true.
* fix(ioscompanion): resolve signing key path to absolute
xcodebuild's -authenticationKeyPath requires an absolute path, but .env
files commonly carry a repo-relative one. Resolve it against the working
directory before the stat so a relative ASC_API_KEY_PATH still signs.
* fix(ioscompanion): re-enable signing for the device runner build
companion/project.yml disables code signing for the simulator build, so
the device build inherited it and produced an unsigned runner that the
device rejected at install (0xe8008018). build-for-testing now forces
CODE_SIGNING_ALLOWED/REQUIRED=YES so automatic provisioning signs it.
* fix(ioscompanion): key the device build cache on signing identity
The cache marker hashed only sources, so switching signing team or key
reused a runner signed with the stale identity, which the device rejects at
install (0xe8008018). Fold team + key id into the cache key so a signing
change forces a rebuild.
* docs(getting-started): document physical iOS device setup
Lists the iproxy requirement and the App Store Connect signing env vars
(SANDERLING_IOS_TEAM, ASC_API_*) a device run needs, plus the
test-ios-device recipe and the doctor check.
* feat(ios): native usbmux client and in-process tunnel forwarder
Talk to macOS usbmuxd directly instead of shelling out to iproxy, so the
device path depends on nothing beyond macOS + Xcode.
* refactor(ios): drive device tunnel via io.Closer seam
Replace the tunnelChild *exec.Cmd and spawnTunnel seam with a tunnel
io.Closer and startTunnel seam backed by the in-process usbmux forwarder.
* refactor(ios): remove iproxy spawn from device runner
* test(ios): cover tunnel close via io.Closer not child process
* feat(doctor): check usbmuxd socket instead of iproxy on PATH
* chore(conformance): drop iproxy orphan check; tunnel is in-process
* docs(ios): device tunnel uses native usbmux, nothing to install
* chore: gitignore the signing keys directory
* feat(folio): add Android launcher icon (black bg, white dot)
* feat(folio): add iOS app icon (black bg, white dot)
* feat(folio): add web favicon (black bg, white dot)
* docs(ioscompanion): fix stale const comments
* refactor(ioscompanion): inline single-use devicectl argv builders
* refactor(ioscompanion): inline xcodegenArgs, drop tautological argv tests
* refactor(ioscompanion): inline firstNonEmpty
* refactor(doctor): dedup usbmuxd socket path via ioscompanion seam
* test(doctor): trim redundant signing-check test
* refactor(ioscompanion): deliver COMPANION_PORT via TEST_RUNNER_ env
* fix(testrun): seam preflight so iOS routing tests pass on CI without xcrun
213 lines
7.6 KiB
Makefile
213 lines
7.6 KiB
Makefile
set shell := ["bash", "-cu"]
|
|
set dotenv-load := true
|
|
|
|
sanderling := env_var_or_default("SANDERLING", "sanderling")
|
|
avd := env_var_or_default("AVD", "")
|
|
duration := env_var_or_default("DURATION", "1m")
|
|
seed := env_var_or_default("SEED", "0")
|
|
output := env_var_or_default("OUTPUT", justfile_directory() / "sanderling" / "runs")
|
|
ios_device := env_var_or_default("IOS_DEVICE", "iPhone 17 Pro")
|
|
ios_app := justfile_directory() / "app" / "iosApp" / "build" / "Build" / "Products" / "Debug-iphonesimulator" / "iosApp.app"
|
|
ios_app_device := justfile_directory() / "app" / "iosApp" / "build" / "Build" / "Products" / "Debug-iphoneos" / "iosApp.app"
|
|
|
|
default:
|
|
@just --list
|
|
|
|
# Resolve ANDROID_HOME from the env or a short list of canonical install
|
|
# locations, so Gradle can find the Android SDK without the user having to
|
|
# export anything.
|
|
_android-home:
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
if [[ -n "${ANDROID_HOME:-}" && -d "$ANDROID_HOME" ]]; then
|
|
echo "$ANDROID_HOME"; exit 0
|
|
fi
|
|
if [[ -n "${ANDROID_SDK_ROOT:-}" && -d "$ANDROID_SDK_ROOT" ]]; then
|
|
echo "$ANDROID_SDK_ROOT"; exit 0
|
|
fi
|
|
for candidate in \
|
|
"$HOME/Library/Android/sdk" \
|
|
"$HOME/Android/Sdk" \
|
|
"/opt/homebrew/share/android-commandlinetools" \
|
|
"/usr/local/share/android-commandlinetools"; do
|
|
if [[ -d "$candidate" ]]; then
|
|
echo "$candidate"; exit 0
|
|
fi
|
|
done
|
|
echo "could not locate Android SDK (set ANDROID_HOME)" >&2
|
|
exit 1
|
|
|
|
# Ensure an Android device is online. If none is connected and no AVD is
|
|
# provided, boot the first AVD whose system image is actually installed
|
|
# (headless) and wait for it to finish booting.
|
|
_ensure-device:
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
sdk="$(just _android-home)"
|
|
adb="$sdk/platform-tools/adb"
|
|
if "$adb" devices | awk 'NR>1 && $2=="device"{f=1} END{exit !f}'; then
|
|
exit 0
|
|
fi
|
|
if [[ -n "{{avd}}" ]]; then
|
|
exit 0 # sanderling boots the named AVD itself
|
|
fi
|
|
emulator="$sdk/emulator/emulator"
|
|
avd=""
|
|
for candidate in $("$emulator" -list-avds); do
|
|
# The AVD directory is named in <name>.ini's path= field, which is not
|
|
# always "<name>.avd" (e.g. Medium_Phone_API_36.0 -> Medium_Phone.avd).
|
|
avddir="$(sed -n 's/^path=//p' "$HOME/.android/avd/$candidate.ini" 2>/dev/null || true)"
|
|
[[ -n "$avddir" ]] || avddir="$HOME/.android/avd/$candidate.avd"
|
|
sysdir="$(sed -n 's/^image\.sysdir\.1=//p' "$avddir/config.ini" 2>/dev/null || true)"
|
|
if [[ -n "$sysdir" && -d "$sdk/$sysdir" ]]; then avd="$candidate"; break; fi
|
|
done
|
|
if [[ -z "$avd" ]]; then
|
|
echo "no bootable AVD found (no installed system image); create one or set AVD=" >&2
|
|
exit 1
|
|
fi
|
|
echo "booting emulator: $avd"
|
|
ANDROID_SDK_ROOT="$sdk" ANDROID_HOME="$sdk" nohup "$emulator" -avd "$avd" \
|
|
-no-window -no-snapshot -gpu swiftshader_indirect -no-audio >/tmp/folio-emulator.log 2>&1 &
|
|
for _ in $(seq 1 150); do
|
|
if [[ "$("$adb" shell getprop sys.boot_completed 2>/dev/null | tr -d '\r')" == "1" ]]; then
|
|
echo "emulator ready"; exit 0
|
|
fi
|
|
sleep 2
|
|
done
|
|
echo "emulator did not finish booting in time (see /tmp/folio-emulator.log)" >&2
|
|
exit 1
|
|
|
|
# Build and install the folio APK on a running emulator/device.
|
|
install: _ensure-device
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
export ANDROID_HOME="$(just _android-home)"
|
|
./gradlew :app:androidApp:installDebug
|
|
|
|
# Remove the folio APK from the connected device.
|
|
uninstall:
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
export ANDROID_HOME="$(just _android-home)"
|
|
./gradlew :app:androidApp:uninstallDebug
|
|
|
|
# Remove gradle + iOS build directories.
|
|
clean:
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
export ANDROID_HOME="$(just _android-home)"
|
|
./gradlew clean
|
|
rm -rf app/iosApp/build
|
|
|
|
# Regenerate iosApp.xcodeproj from project.yml.
|
|
ios-gen:
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
cd app/iosApp && xcodegen generate
|
|
|
|
# Build + install + launch on a booted iOS simulator (boots IOS_DEVICE if none).
|
|
ios:
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
export ANDROID_HOME="$(just _android-home)"
|
|
if ! xcrun simctl list devices booted | grep -q Booted; then
|
|
xcrun simctl boot "{{ios_device}}"
|
|
open -a Simulator
|
|
sleep 3
|
|
fi
|
|
just ios-gen
|
|
xcodebuild -project app/iosApp/iosApp.xcodeproj -scheme iosApp \
|
|
-destination 'platform=iOS Simulator,name={{ios_device}}' \
|
|
-derivedDataPath app/iosApp/build \
|
|
build | tail -5
|
|
xcrun simctl install booted "{{ios_app}}"
|
|
xcrun simctl launch booted app.folio
|
|
|
|
# Build the folio app for a connected physical iOS device (signed via .env creds).
|
|
# Signing reads ASC_API_* and DEVELOPMENT_TEAM/SANDERLING_IOS_TEAM from .env;
|
|
# sanderling installs the build on the device per run via devicectl.
|
|
ios-device:
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
export ANDROID_HOME="$(just _android-home)"
|
|
just ios-gen
|
|
xcodebuild -project app/iosApp/iosApp.xcodeproj -scheme iosApp \
|
|
-destination 'generic/platform=iOS' \
|
|
-derivedDataPath app/iosApp/build \
|
|
-allowProvisioningUpdates \
|
|
-authenticationKeyPath "$ASC_API_KEY_PATH" \
|
|
-authenticationKeyID "$ASC_API_KEY_ID" \
|
|
-authenticationKeyIssuerID "$ASC_API_ISSUER_ID" \
|
|
CODE_SIGN_STYLE=Automatic \
|
|
DEVELOPMENT_TEAM="${SANDERLING_IOS_TEAM:-${DEVELOPMENT_TEAM:-}}" \
|
|
build | tail -5
|
|
|
|
# Run 'sanderling test' against the folio app. Uses a connected device if one is
|
|
# online; otherwise boots AVD=<name> when provided, or auto-boots a bootable AVD.
|
|
# Depends on install so the run always fuzzes the current build, matching
|
|
# test-ios which rebuilds and reinstalls the app first.
|
|
test: install
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
avd_flag=()
|
|
if [[ -n "{{avd}}" ]]; then
|
|
avd_flag=(--avd "{{avd}}")
|
|
fi
|
|
"{{sanderling}}" test \
|
|
--spec "{{justfile_directory()}}/sanderling/spec.ts" \
|
|
--bundle-id app.folio \
|
|
"${avd_flag[@]}" \
|
|
--duration "{{duration}}" \
|
|
--seed "{{seed}}" \
|
|
--output "{{output}}"
|
|
|
|
# Serve the wasmJs web app from a webpack dev server with COOP/COEP headers.
|
|
web:
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
export ANDROID_HOME="$(just _android-home)"
|
|
./gradlew :app:webApp:wasmJsBrowserDevelopmentRun --continuous
|
|
|
|
# Produce a webpack distributable bundle for the web app.
|
|
web-build:
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
export ANDROID_HOME="$(just _android-home)"
|
|
./gradlew :app:webApp:wasmJsBrowserDevelopmentExecutableDistribution
|
|
|
|
# Build + install + run sanderling spec on iOS simulator.
|
|
test-ios:
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
just ios
|
|
ios_device_flag=()
|
|
if [[ -n "{{ios_device}}" ]]; then
|
|
ios_device_flag=(--ios-device "{{ios_device}}")
|
|
fi
|
|
"{{sanderling}}" test \
|
|
--platform ios \
|
|
--spec "{{justfile_directory()}}/sanderling/spec.ts" \
|
|
--bundle-id app.folio \
|
|
--ios-app-path "{{ios_app}}" \
|
|
"${ios_device_flag[@]}" \
|
|
--duration "{{duration}}" \
|
|
--seed "{{seed}}" \
|
|
--output "{{output}}"
|
|
|
|
# Requires App Store Connect signing creds in .env and IOS_DEVICE set to the
|
|
# connected device's name (or UDID / CoreDevice id).
|
|
# Build + install + run sanderling spec on a connected physical iOS device.
|
|
test-ios-device:
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
just ios-device
|
|
"{{sanderling}}" test \
|
|
--platform ios \
|
|
--spec "{{justfile_directory()}}/sanderling/spec.ts" \
|
|
--bundle-id app.folio \
|
|
--ios-app-path "{{ios_app_device}}" \
|
|
--ios-device "{{ios_device}}" \
|
|
--duration "{{duration}}" \
|
|
--seed "{{seed}}" \
|
|
--output "{{output}}"
|