Files
tether/core/build-apple.sh
Patrick Ecord db64b3b9a6 macos: migrate app to the shared tethercore engine (SSE + RTC)
Drop TetherKit's TetherClient/SSEClient/Message from the macOS app; drive
tethercore.Engine instead (RoomIdentity still from TetherKit via selective
import). The Mac now gets direct P2P over the RTC data channel for free, and
the native Swift app is no longer a parallel wire-protocol implementation.

Background NSPasteboard polling (auto-send on copy) and write-on-receive are
preserved. Feed UI moves to a FeedItem view-model (RTC messages carry ts=0 →
fall back to local time).

Verified end-to-end against the live server: RECEIVE (bus → Mac pasteboard via
pbpaste) and SEND (pbcopy → bus) both confirmed.

Generalize core/build-ios.sh → build-apple.sh: builds iOS device + sim + macOS
arm64 into one TetherCore.xcframework and vendors it into both apps.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 23:31:54 -05:00

47 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds the tethercore Rust engine for Apple targets and refreshes the
# artifacts both Xcode apps consume: the Swift bindings + a single
# TetherCore.xcframework (iOS device + iOS sim + macOS arm64).
# Outputs are git-ignored / regenerated — run after any change to core/src,
# then build the apps in Xcode.
set -euo pipefail
cd "$(dirname "$0")"
IOS_APP="../ios/TetherApp"
MAC_APP="../ios/MacTetherApp"
IOS=aarch64-apple-ios
SIM=aarch64-apple-ios-sim
MAC=aarch64-apple-darwin
echo "▸ building static libs ($IOS, $SIM, $MAC)…"
rustup target add "$IOS" "$SIM" "$MAC" >/dev/null 2>&1 || true
cargo build --release --target "$IOS" --lib
cargo build --release --target "$SIM" --lib
cargo build --release --target "$MAC" --lib
echo "▸ generating Swift bindings…"
cargo run --release --bin uniffi-bindgen -- \
generate --library "target/$MAC/release/libtethercore.dylib" \
--language swift --out-dir bindings/swift
echo "▸ assembling TetherCore.xcframework (ios + ios-sim + macos)…"
rm -rf build-xcframework && mkdir -p build-xcframework/headers
cp bindings/swift/tethercoreFFI.h build-xcframework/headers/
cp bindings/swift/tethercoreFFI.modulemap build-xcframework/headers/module.modulemap
rm -rf TetherCore.xcframework
xcodebuild -create-xcframework \
-library "target/$IOS/release/libtethercore.a" -headers build-xcframework/headers \
-library "target/$SIM/release/libtethercore.a" -headers build-xcframework/headers \
-library "target/$MAC/release/libtethercore.a" -headers build-xcframework/headers \
-output TetherCore.xcframework
echo "▸ vendoring into both apps…"
for APP in "$IOS_APP" "$MAC_APP"; do
rm -rf "$APP/Vendor/TetherCore.xcframework"
mkdir -p "$APP/Vendor"
cp -R TetherCore.xcframework "$APP/Vendor/"
cp bindings/swift/tethercore.swift "$APP/Sources/tethercore.swift"
done
echo "✅ done — build TetherApp (iOS) and MacTetherApp (macOS) in Xcode."