forked from WikiDeck/wikideck
[mobile-ios] IOS.md draft and simulator build script
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
# iOS app and macOS VM (Night 1, mobile-ios, issue #9)
|
||||
|
||||
Status: **DRAFT, updated through the night.** See "What's verified" at the bottom.
|
||||
|
||||
## Where things are (inspiron-3670, outside git)
|
||||
| Path | What |
|
||||
|---|---|
|
||||
| `~/worker/jobs/macos/boot-macos.sh` | Starts the VM (QEMU/KVM, OSX-KVM style): 8 GB RAM, 4 vCPU, q35, OpenCore |
|
||||
| `~/worker/jobs/macos/mac_hdd_ng.qcow2` | 80 GB macOS system disk |
|
||||
| `~/worker/jobs/macos/BaseSystem.img` | macOS recovery/installer image (from macos-fetch) |
|
||||
| `~/worker/jobs/macos/OpenCore*.qcow2` | OpenCore bootloader (from kholia/OSX-KVM) |
|
||||
| `~/worker/jobs/macos/OVMF_*.fd` | UEFI firmware + NVRAM (VARS is per-VM, writable) |
|
||||
| `~/worker/jobs/macos/CREDENTIALS.txt` | Local macOS user + password, mode 600. **Never in git.** |
|
||||
| `~/worker/jobs/macos/vnc.sh` | `vncdotool` wrapper for the VM's VNC (capture/type/click) |
|
||||
| `~/worker/jobs/macos/guest/provision.sh` | Runs inside the VM: Command Line Tools, Node (no Apple ID) |
|
||||
|
||||
## Start the VM
|
||||
```
|
||||
cd ~/worker/jobs/macos
|
||||
NO_INSTALLER=1 setsid ./boot-macos.sh > qemu.log 2>&1 & # after install; omit NO_INSTALLER to attach the installer
|
||||
```
|
||||
- VNC: **127.0.0.1:5911** (display :11), localhost only, no password. From another machine:
|
||||
`ssh -L 5911:127.0.0.1:5911 eric@inspiron-3670` then point a VNC viewer at `localhost:5911`.
|
||||
- SSH into macOS: `ssh -p 10022 <user>@127.0.0.1` (user/password in `CREDENTIALS.txt`).
|
||||
- QEMU monitor: `socat - UNIX-CONNECT:$HOME/worker/jobs/macos/qemu-monitor.sock` (`system_powerdown` to shut down cleanly).
|
||||
- In the OpenCore picker, choose the macOS disk (or "macOS Base System" for the installer).
|
||||
|
||||
## Eric's 10-minute checklist
|
||||
1. Start the VM (above), open VNC, log in as the local user.
|
||||
2. Sign in with your Apple ID in the App Store (or developer.apple.com/download) and install **Xcode**.
|
||||
Launch it once, accept the license, let it install the iOS platform + a simulator runtime.
|
||||
3. Over SSH (or Terminal in the VM): `~/wikideck/scripts/ios/build-sim.sh`
|
||||
It runs `npm ci`, `npm run build`, `npx cap sync ios`, builds for the simulator with
|
||||
`xcodebuild`, boots a simulator and launches `dev.eom.wikideck`.
|
||||
4. A screenshot lands in `~/wikideck-ios-sim.png`.
|
||||
|
||||
## App notes
|
||||
- Capacitor app id `dev.eom.wikideck`, `webDir: dist`, scaffold from mobile-android (#8).
|
||||
- iOS WebView origin is `capacitor://localhost` (iOS forbids `https` as a custom scheme), so the
|
||||
testnet allowlist in `server/testnet/http.ts` must include it (coordinated on #8).
|
||||
- Node URL: build-time `VITE_NODE_URL` (defaults to the testnet), same as Android.
|
||||
|
||||
## What's verified
|
||||
- (filled in as the night goes)
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
# Build WikiDeck for the iOS simulator and launch it. Run INSIDE the macOS VM after Xcode is installed.
|
||||
# Usage: scripts/ios/build-sim.sh [simulator name, default "iPhone 16"]
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/../.."
|
||||
export PATH="$HOME/node/bin:$PATH"
|
||||
SIM="${1:-iPhone 16}"
|
||||
APP_ID=dev.eom.wikideck
|
||||
|
||||
xcode-select -p | grep -q Xcode.app || sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
|
||||
xcodebuild -version
|
||||
sudo xcodebuild -license accept 2>/dev/null || true
|
||||
xcodebuild -runFirstLaunch >/dev/null 2>&1 || true
|
||||
|
||||
npm ci
|
||||
npm run build
|
||||
npx cap sync ios
|
||||
|
||||
# Pick the simulator (fall back to the first available iPhone).
|
||||
UDID=$(xcrun simctl list devices available -j | python3 -c '
|
||||
import json,sys; want=sys.argv[1]; d=json.load(sys.stdin)["devices"]
|
||||
devs=[x for r,l in d.items() if "iOS" in r for x in l]
|
||||
m=[x for x in devs if x["name"]==want] or [x for x in devs if x["name"].startswith("iPhone")]
|
||||
print(m[-1]["udid"] if m else "")' "$SIM")
|
||||
[ -n "$UDID" ] || { echo "No iOS simulator runtime installed. Xcode > Settings > Components > iOS."; exit 1; }
|
||||
|
||||
xcodebuild -project ios/App/App.xcodeproj -scheme App -configuration Debug \
|
||||
-sdk iphonesimulator -destination "id=$UDID" -derivedDataPath ios/build \
|
||||
CODE_SIGNING_ALLOWED=NO build
|
||||
|
||||
APP=$(find ios/build/Build/Products/Debug-iphonesimulator -maxdepth 1 -name '*.app' | head -1)
|
||||
xcrun simctl boot "$UDID" 2>/dev/null || true
|
||||
open -a Simulator
|
||||
xcrun simctl install "$UDID" "$APP"
|
||||
xcrun simctl launch "$UDID" "$APP_ID"
|
||||
sleep 8
|
||||
xcrun simctl io "$UDID" screenshot "$HOME/wikideck-ios-sim.png"
|
||||
echo "Launched $APP_ID on $SIM ($UDID); screenshot: ~/wikideck-ios-sim.png"
|
||||
Reference in New Issue
Block a user