Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ provider-supplied download URLs.
three threads (#192).
- Benchmark scripts run on machines other than the one they were written
on (napi artifact resolved from platform/arch, SDKs from npm) (#160).
- **Flutter package size**: the iOS static-lib slices carried fat-LTO
LLVM bitcode (~80% of each slice) plus debug symbols because a
`staticlib` never goes through cargo's link step — the 0.5.0 xcframework
hit pub.dev's 256MiB uncompressed package limit and was rejected. The
iOS build now uses an LTO-off profile and strips debug/local symbols:
each slice drops from ~128MB to ~15MB.

### Removed

Expand Down
9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ panic = "abort"
strip = true
opt-level = "z"

# staticlib archives (.a) never reach a link step under cargo — the
# consumer's toolchain links them — so fat-LTO only embeds every crate's
# LLVM bitcode into the archive (.llvmbc on ELF, __LLVM,__bitcode on
# Mach-O): ~80% of each iOS xcframework slice, past pub.dev's 256MiB
# package limit since 0.5.0. Used by scripts/build-ios-xcframework.sh.
[profile.ios-release]
inherits = "release"
lto = false

[workspace.dependencies]
# Async runtime
tokio = { version = "1", features = ["full"] }
Expand Down
13 changes: 13 additions & 0 deletions bindings/flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## 0.5.0

- Breaking release aligning the whole aimux family — see the
[main CHANGELOG](https://github.com/arcships/aimux/blob/master/CHANGELOG.md)
for the complete list (stable cross-language error model, request
pipeline retries/timeouts, Core-boundary tool-input validation, host-side
`repairToolCall`, WS proxy, SSRF hardening).
- Flutter binding: typed error model with retry context, host-side
`repairToolCall`, `VideoPollOptions`.
- The embedded iOS `aimux_ffi.xcframework` no longer carries LTO bitcode /
debug symbols: each slice shrinks from ~128MB to ~15MB (the 0.3.0
archives had grown past pub.dev's 256MB package limit).

## 0.2.1

- First pub.dev release under publisher `arcships.ai`.
Expand Down
26 changes: 22 additions & 4 deletions scripts/build-ios-xcframework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@ set -euo pipefail

OUT="${1:?usage: build-ios-xcframework.sh <output-dir>}"
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
VERSION="$(grep -m1 '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/')"
cd "$ROOT"

# A staticlib is never linked here — the consumer's Xcode link step runs
# after LTO stops mattering — so the workspace's fat-LTO only bloats the
# archive: cargo passes -C embed-bitcode=yes and every codegen unit carries
# its full LLVM bitcode (~80% of each slice, ~256MB uncompressed past
# pub.dev's package limit since 0.5.0). The ios-release profile turns LTO
# off for this build only; the size gate below fails loudly if that regresses.
rustup target add aarch64-apple-ios aarch64-apple-ios-sim
cargo build -p aimux-ffi --release --target aarch64-apple-ios
cargo build -p aimux-ffi --release --target aarch64-apple-ios-sim
cargo build -p aimux-ffi --profile ios-release --target aarch64-apple-ios
cargo build -p aimux-ffi --profile ios-release --target aarch64-apple-ios-sim

TMP="$(mktemp -d)"
trap 'rm -rf "$TMP"' EXIT
Expand All @@ -28,7 +35,18 @@ for triple in aarch64-apple-ios aarch64-apple-ios-sim; do
aarch64-apple-ios-sim) slice=sim ;;
esac
mkdir -p "$TMP/$slice/aimux_ffi.framework"
cp "target/$triple/release/libaimux_ffi.a" "$TMP/$slice/aimux_ffi.framework/aimux_ffi"
cp "target/$triple/ios-release/libaimux_ffi.a" "$TMP/$slice/aimux_ffi.framework/aimux_ffi"
# Strip debug + local symbols; global symbols stay (force_load in
# aimux.podspec resolves against them).
strip -Sx "$TMP/$slice/aimux_ffi.framework/aimux_ffi"
# Fail loudly on a size regression instead of letting a fat slice slip
# through and blow pub.dev's 256MiB package limit again: a healthy slice
# is ~15-30MB; an LTO/bitcode regression lands near 128MB.
SLICE_BYTES=$(stat -f%z "$TMP/$slice/aimux_ffi.framework/aimux_ffi")
if [ "$SLICE_BYTES" -gt 67108864 ]; then
echo "slice $triple is $SLICE_BYTES bytes (> 64MiB) — bitcode/LTO regression?" >&2
exit 1
fi
cat > "$TMP/$slice/aimux_ffi.framework/Info.plist" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
Expand All @@ -39,7 +57,7 @@ for triple in aarch64-apple-ios aarch64-apple-ios-sim; do
<key>CFBundleInfoDictionaryVersion</key><string>6.0</string>
<key>CFBundleName</key><string>aimux_ffi</string>
<key>CFBundlePackageType</key><string>FMWK</string>
<key>CFBundleShortVersionString</key><string>0.2.0</string>
<key>CFBundleShortVersionString</key><string>$VERSION</string>
<key>CFBundleVersion</key><string>1</string>
</dict></plist>
EOF
Expand Down
Loading