Skip to content

Fix the livekit_uniffi build hook for universal builds and allow code_assets 2.x - #1416

Merged
hiroshihorie merged 3 commits into
mainfrom
hiroshi/dart-uniffi-hook-followups
Sep 9, 2026
Merged

Fix the livekit_uniffi build hook for universal builds and allow code_assets 2.x#1416
hiroshihorie merged 3 commits into
mainfrom
hiroshi/dart-uniffi-hook-followups

Conversation

@hiroshihorie

@hiroshihorie hiroshihorie commented Sep 9, 2026

Copy link
Copy Markdown
Member

Before you submit your PR

Make sure the following is true before submitting your PR:

  • I have read the contributing guidelines and validated that this PR will be accepted.
  • I have read and followed the principles regarding breaking changes, testing, and code quality.

PR description

Three fixes to the livekit_uniffi Dart package templates, found while doing the manual first publish of 0.1.10 and wiring it into client-sdk-flutter. All ship with the next release.

  • Allow code_assets 2.x. The pubspec capped code_assets below 2.0.0, which shipped on Aug 18. Its only breaking change (equality on OS/Architecture) does not affect the hook, and a cap below the current major makes the package unresolvable next to any dependency that already requires 2.x. Now >=1.0.0 <3.0.0. The comment is updated: hooks 2.2.0 dropped its meta dependency, so the Flutter meta-pin back-solve that motivated the wide ranges mostly no longer applies, but wide bounded ranges remain the right shape.
  • Stop registering the downloaded library as a hook dependency. Dependencies are inputs. Registering the downloaded output made the hooks runner print "File modified during build. Build must be rerun." and run the hook, and the download, twice on every fresh consumer build. Local mode keeps its registration, where the library really is an input.
  • Keep each target's downloaded library in its own directory. The hook wrote every target's library to the same path under the shared output directory. A universal macOS release build runs the hook once per architecture and then merges the results with lipo, so the second download overwrote the first and the build failed with "have the same architectures (x86_64) and can't be in the same fat output file" (Integrate initial uniffi rust core client-sdk-flutter#1160's macOS CI job). The directory is now keyed by target triple, which is also how the hooks package documents the shared directory should be used.

Breaking changes

None.

MSRV

No changes.

Testing

From this branch, cargo make dart-package in both profiles:

  • Dev profile (local library): resolves code_assets 2.0.0 + hooks 2.2.0, 5/5 FFI tests pass.
  • Release profile, copied outside the repo like the publish workflow does: fresh dart test downloads the real 0.1.10 library from the release, the "File modified during build" rerun is gone, 5/5 tests pass, and dart pub publish --dry-run reports 0 warnings.
  • Universal build: the client-sdk-flutter example pointed at the regenerated package with a path override, flutter build macos --release. Builds, lipo -info on the bundled livekit_uniffi.framework reports x86_64 arm64, and the hook produced separate aarch64-apple-darwin and x86_64-apple-darwin output directories. Debug builds are single-architecture and cannot catch this, which is why it reached CI.
  • code_assets 2.0.0 also adds header validation of the bundled library against the target architecture, which the downloaded 0.1.10 dylib passed.

Async

No async code changed.

🤖 Generated with Claude Code

code_assets 2.0.0 shipped after the constraint was written. Its only
breaking change, equality on OS and Architecture, does not affect the
hook, and capping below it makes the package unresolvable next to any
dependency that already requires 2.x. Verified against code_assets 2.0.0
and hooks 2.2.0 in both local and download mode.
Dependencies are inputs. Registering the downloaded output made the
hooks runner see a file modified during the build and rerun the hook,
and the download, once on every fresh build. Local mode keeps its
registration, since there the library really is an input that a fresh
cargo make dart-package overwrites.
@hiroshihorie
hiroshihorie requested a review from ladvoc as a code owner September 9, 2026 16:51
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Changeset ✓

This PR includes a changeset covering all affected packages:

Package Bump
livekit-uniffi patch

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Devin Review: 1 flag

Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

The hook wrote every target's library to the same path under the shared
output directory. A universal macOS release build runs the hook once per
architecture and then merges the results with lipo, so the second
download overwrote the first and lipo was handed the same x86_64 file
twice. Key the directory by target triple, which also matches how the
hooks package documents the shared directory should be used.
@hiroshihorie hiroshihorie changed the title Allow code_assets 2.x in the Dart package and fix the hook rerun Fix the livekit_uniffi build hook for universal builds and allow code_assets 2.x Sep 9, 2026
@hiroshihorie
hiroshihorie merged commit 357a576 into main Sep 9, 2026
39 of 48 checks passed
@hiroshihorie
hiroshihorie deleted the hiroshi/dart-uniffi-hook-followups branch September 9, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants