Files
kestrove-core/scripts/build-apple.sh
T
samiandClaude Opus 5.5 4a152bde11 Fix Secret Key decode rejecting valid keys; verify build
The first base32 symbol carries 3 data bits (26 symbols = 130 bits, 2 spare),
but decode only accepted values 0-3, so ~half of generated keys failed to parse.
Adds an edge-case test, rustfmt config, Cargo.lock, and on-demand cross targets
instead of installing all seven in rust-toolchain.toml.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-15 21:14:15 +09:00

34 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds KestroveCoreFFI.xcframework + Swift bindings into ../kestrove-apple/Packages/KestroveCore.
set -euo pipefail
cd "$(dirname "$0")/.."
OUT=../kestrove-apple/Packages/KestroveCore
LIB=libkv_ffi.a
rustup target add aarch64-apple-ios aarch64-apple-ios-sim aarch64-apple-darwin x86_64-apple-darwin
for t in aarch64-apple-ios aarch64-apple-ios-sim aarch64-apple-darwin x86_64-apple-darwin; do
cargo build -p kv-ffi --release --target "$t"
done
cargo build -p kv-ffi # host dylib for library-mode bindgen
mkdir -p out/swift
cargo run -p kv-ffi --bin uniffi-bindgen -- generate --library target/debug/libkv_ffi.dylib --language swift --out-dir out/swift
mkdir -p out/headers
cp out/swift/kv_ffiFFI.h out/headers/
cp out/swift/kv_ffiFFI.modulemap out/headers/module.modulemap
mkdir -p out/macos
lipo -create target/aarch64-apple-darwin/release/$LIB target/x86_64-apple-darwin/release/$LIB -output out/macos/$LIB
rm -rf "$OUT/KestroveCoreFFI.xcframework"
xcodebuild -create-xcframework \
-library target/aarch64-apple-ios/release/$LIB -headers out/headers \
-library target/aarch64-apple-ios-sim/release/$LIB -headers out/headers \
-library out/macos/$LIB -headers out/headers \
-output "$OUT/KestroveCoreFFI.xcframework"
mkdir -p "$OUT/Sources/KestroveCore"
cp out/swift/kv_ffi.swift "$OUT/Sources/KestroveCore/Generated.swift"
echo "✅ XCFramework + bindings written to $OUT"