xworkmate-app/scripts/copy_ffi_framework.sh
Haitao Pan 37b110763b refactor(storage): unify persistent storage with robust error handling and simplified secret management
- Consolidate settings, tasks, and audit storage into SettingsStore and SecretStore
- Implement PersistentWriteFailure for detailed error reporting across storage scopes
- Migrate secret retrieval to rely primarily on reference-based lookups
- Add ThemeMode persistence and AccountSyncState serialization
- Modernize SecureConfigStore with clear path resolution and support for UI state
- Streamline Rust build process by migrating from custom scripts to Makefile
- Remove redundant build_rust_ffi.sh and update integration scripts
2026-04-19 10:34:15 +08:00

40 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Copy FFI library to macOS Frameworks
# Add this to Xcode Build Phases > Run Script
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
FRAMEWORKS_DIR="$PROJECT_ROOT/macos/Frameworks"
RUST_DIR="$PROJECT_ROOT/rust"
# Source FFI library location
UNIVERSAL_LIB="$RUST_DIR/target/universal/libcodex_ffi.dylib"
ARM_LIB="$RUST_DIR/target/aarch64-apple-darwin/release/libcodex_ffi.dylib"
DEBUG_LIB="$RUST_DIR/target/debug/libcodex_ffi.dylib"
# Ensure Frameworks directory exists
mkdir -p "$FRAMEWORKS_DIR"
# Copy universal binary if available, otherwise fall back to single architecture
if [[ -f "$UNIVERSAL_LIB" ]]; then
echo "Copying universal FFI library..."
cp "$UNIVERSAL_LIB" "$FRAMEWORKS_DIR/"
elif [[ -f "$ARM_LIB" ]]; then
echo "Copying arm64 FFI library..."
cp "$ARM_LIB" "$FRAMEWORKS_DIR/"
elif [[ -f "$DEBUG_LIB" ]]; then
echo "Copying debug FFI library..."
cp "$DEBUG_LIB" "$FRAMEWORKS_DIR/"
else
echo "Warning: FFI library not found. Run make rust-build-release first."
echo "Expected one of:"
echo " - $UNIVERSAL_LIB"
echo " - $ARM_LIB"
echo " - $DEBUG_LIB"
exit 0 # Don't fail the build if library doesn't exist yet
fi
echo "FFI library copied to $FRAMEWORKS_DIR/"