diff --git a/CHANGELOG.md b/CHANGELOG.md index f7c910c54..84c468191 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Cargo.toml b/Cargo.toml index 403484ef2..72caa4314 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"] } diff --git a/bindings/flutter/CHANGELOG.md b/bindings/flutter/CHANGELOG.md index 6ea7af48f..3327a9844 100644 --- a/bindings/flutter/CHANGELOG.md +++ b/bindings/flutter/CHANGELOG.md @@ -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`. diff --git a/scripts/build-ios-xcframework.sh b/scripts/build-ios-xcframework.sh index 8df9b3b57..660ffaa7f 100644 --- a/scripts/build-ios-xcframework.sh +++ b/scripts/build-ios-xcframework.sh @@ -13,11 +13,18 @@ set -euo pipefail OUT="${1:?usage: build-ios-xcframework.sh }" 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 @@ -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" < @@ -39,7 +57,7 @@ for triple in aarch64-apple-ios aarch64-apple-ios-sim; do CFBundleInfoDictionaryVersion6.0 CFBundleNameaimux_ffi CFBundlePackageTypeFMWK - CFBundleShortVersionString0.2.0 + CFBundleShortVersionString$VERSION CFBundleVersion1 EOF