Use build hooks to link core extension#386
Merged
Merged
Conversation
rkistner
approved these changes
Mar 30, 2026
simolus3
added a commit
that referenced
this pull request
Mar 31, 2026
Merged
simolus3
added a commit
that referenced
this pull request
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: I'll use the
devbranch for most of the changes from the Dart SDK proposal. That way, we can merge and release everything in the end without making it more difficult to land other changes in the meantime.Currently, linking the SQLite core extension is the responsibility of the
powersync_flutter_libspackage. It uses Gradle, SwiftPM and CocoaPods dependencies as well as CMake scripts to make the core extension loadable viaDynamicLibrary.openfrom Dart. This works alright, but has two main downsides:Starting from Dart 3.10, released in November last year, we have a better option available: Build hooks! These run as part of the toolchain whenever a Dart app is built, and can contribute native code to the app. It's the responsibility of the Dart tool to consume added code in a platform-specific way. So Flutter would setup an XCFramework when building an iOS app for instance, and
dart testwould load the emitted library manually.This allows us to write that bundling logic in a single place (
hook/build.dart) and deletepowersync_flutter_libs.Important
Instead of deleting
powersync_flutter_libsoutright, I've removed all build code from that package. By then depending on the updated empty package version, we can ensure users don't end up with the new hook and the old bundling package in their Flutter app.Tests
powersync_coreunit tests