#!/usr/bin/env bash # Build the Go swarm engine as an iOS XCFramework. Run this before # `xcodegen generate` whenever the Go bridge or anything under src/ changes. set -euo pipefail HERE="$(cd "$(dirname "$0")" && pwd)" TOOLS="$HERE/.build/tools" mkdir -p "$TOOLS" cd "$HERE/GoBridge" # Install the exact gomobile/gobind versions recorded in this module. The # tools live in the app folder so they are easy to delete and never leak # into the rest of the repo. GOBIN="$TOOLS" go install golang.org/x/mobile/cmd/gomobile golang.org/x/mobile/cmd/gobind export PATH="$TOOLS:$PATH" gomobile init rm -rf "$HERE/Share.xcframework" gomobile bind -target=ios -o "$HERE/Share.xcframework" . echo "Built $HERE/Share.xcframework"