wangdl dd360c88e2 fix: RagChatModule 导入 AiModule,修复 AiGatewayService 未注入
AiGatewayService 使用了 @Optional() 导致不报错但始终为 null,
sendMessage 永远走 fallbackReply。现在导入 AiModule 正确注入。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-06 13:38:57 +08:00

46 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# Build iOS XCFramework for zhixi-document-runtime
# UDL bindgen + proc-macro C symbols + inline Swift FFI types
set -e
RUST_DIR="$(cd "$(dirname "$0")/.." && pwd)"
OUT_DIR="$RUST_DIR/bindings/ios"
LIB_NAME="libzx_document_ffi.a"
rustup target add aarch64-apple-ios aarch64-apple-ios-sim
echo "==> Building for iOS device (arm64)..."
cargo build --release --target aarch64-apple-ios -p zx_document_ffi
echo "==> Building for iOS simulator (arm64)..."
cargo build --release --target aarch64-apple-ios-sim -p zx_document_ffi
rm -rf "$OUT_DIR/ZxDocumentRuntime.xcframework"
mkdir -p "$OUT_DIR/device" "$OUT_DIR/simulator" "$OUT_DIR/generated"
cp "target/aarch64-apple-ios/release/$LIB_NAME" "$OUT_DIR/device/"
cp "target/aarch64-apple-ios-sim/release/$LIB_NAME" "$OUT_DIR/simulator/"
echo "==> Generating Swift bindings (UDL bindgen)..."
rm -f "$OUT_DIR/generated/zx_document.swift"
uniffi-bindgen generate \
--language swift \
--out-dir "$OUT_DIR/generated" \
"$RUST_DIR/crates/zx_document_ffi/src/zx_document.udl"
echo "==> Patching Swift file for static linking..."
python3 "$RUST_DIR/scripts/patch-swift.py" "$OUT_DIR/generated/zx_document.swift"
echo "==> Checking C ABI symbols..."
bash "$RUST_DIR/scripts/check-symbols.sh" "$OUT_DIR/simulator/$LIB_NAME"
echo "==> Creating XCFramework..."
xcodebuild -create-xcframework \
-library "$OUT_DIR/device/$LIB_NAME" \
-library "$OUT_DIR/simulator/$LIB_NAME" \
-output "$OUT_DIR/ZxDocumentRuntime.xcframework"
echo "==> Done!"
echo "XCFramework: $OUT_DIR/ZxDocumentRuntime.xcframework"
echo "Swift sources: $OUT_DIR/generated/"