@ondeinference / onde / commits / 726ee26

Refactor React Native iOS build to output only XCFramework

- Update .npmignore to exclude intermediate device/simulator dirs - Update package.json to include only the XCFramework and required Swift/podspec files - Simplify build script to build XCFramework directly without staging dirs

keypair34 committed Apr 10, 2026 at 18:59 UTC 726ee26a67d81efc103a4704b1ac2257b92e04fc
3 files changed +16 -20
sdk/react-native/.npmignore
+4 -4
@@ -1,12 +1,12 @@
1 # Example app
2 example/
3
4 -# Rust build artifacts
4 +# Rust build artifacts — target/ is huge, never publish it
5 rust/target/
6 -rust/Cargo.lock
6
8 -# Scripts (build-rust.sh is in files[] but consumers don't need it)
9 -# Keep scripts/ included for source builds — remove this line if you want to exclude them
7 +# iOS intermediate staging dirs — only the XCFramework is needed by CocoaPods
8 +ios/rust/device/
9 +ios/rust/simulator/
10
11 # Development files
12 .github/
sdk/react-native/package.json
+4 -2
@@ -29,7 +29,7 @@
29 "homepage": "https://ondeinference.com",
30 "repository": {
31 "type": "git",
32 - "url": "https://github.com/ondeinference/onde",
32 + "url": "git+https://github.com/ondeinference/onde.git",
33 "directory": "sdk/react-native"
34 },
35 "bugs": {
@@ -49,7 +49,9 @@
49 },
50 "files": [
51 "build/",
52 - "ios/",
52 + "ios/OndeInference.podspec",
53 + "ios/OndeInferenceModule.swift",
54 + "ios/rust/OndeReactNative.xcframework",
55 "android/",
56 "rust/Cargo.toml",
57 "rust/Cargo.lock",
sdk/react-native/scripts/build-rust.sh
+8 -14
@@ -10,7 +10,7 @@ set -euo pipefail
10
11 SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
12 RUST_DIR="$SCRIPT_DIR/../rust"
13 -IOS_OUT="$SCRIPT_DIR/../ios/rust"
13 +IOS_XCFRAMEWORK_OUT="$SCRIPT_DIR/../ios/rust/OndeReactNative.xcframework"
14 ANDROID_OUT="$SCRIPT_DIR/../android/src/main/jniLibs"
15
16 build_ios() {
@@ -26,21 +26,15 @@ build_ios() {
26 cargo build --manifest-path "$RUST_DIR/Cargo.toml" \
27 --target aarch64-apple-ios-sim --release
28
29 - # Copy both device and simulator staticlibs to ios/rust/{device,simulator}/
30 - mkdir -p "$IOS_OUT/device" "$IOS_OUT/simulator"
31 - cp "$RUST_DIR/target/aarch64-apple-ios/release/libonde_react_native.a" \
32 - "$IOS_OUT/device/libonde_react_native.a"
33 - cp "$RUST_DIR/target/aarch64-apple-ios-sim/release/libonde_react_native.a" \
34 - "$IOS_OUT/simulator/libonde_react_native.a"
35 -
36 - # Create an XCFramework that bundles both slices. CocoaPods picks the
37 - # correct one automatically based on the target SDK.
29 + # Build the XCFramework directly from the cargo output — no staging dirs needed.
30 + # CocoaPods picks the correct slice (device vs simulator) automatically.
31 echo " → Creating XCFramework"
39 - rm -rf "$IOS_OUT/OndeReactNative.xcframework"
32 + rm -rf "$IOS_XCFRAMEWORK_OUT"
33 + mkdir -p "$(dirname "$IOS_XCFRAMEWORK_OUT")"
34 xcodebuild -create-xcframework \
41 - -library "$IOS_OUT/device/libonde_react_native.a" \
42 - -library "$IOS_OUT/simulator/libonde_react_native.a" \
43 - -output "$IOS_OUT/OndeReactNative.xcframework"
35 + -library "$RUST_DIR/target/aarch64-apple-ios/release/libonde_react_native.a" \
36 + -library "$RUST_DIR/target/aarch64-apple-ios-sim/release/libonde_react_native.a" \
37 + -output "$IOS_XCFRAMEWORK_OUT"
38
39 echo " ✓ iOS XCFramework created at ios/rust/OndeReactNative.xcframework"
40 }