Skip to content

Load and use PowerSync rust extension #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 39 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
6feb22b
Initial extension testing.
rkistner Aug 22, 2023
6d20fae
Replace schema logic with rust extension.
rkistner Aug 23, 2023
1343b48
Use extension for saving operations.
rkistner Aug 23, 2023
eb45c75
Auto tx_id.
rkistner Aug 24, 2023
cc6d08d
Use sync_local op.
rkistner Aug 24, 2023
1ebb56c
Validate checksums using extension.
rkistner Aug 27, 2023
49d1451
clear_remove_ops
rkistner Aug 27, 2023
8e138b5
delete_pending_buckets
rkistner Aug 27, 2023
bb4281c
delete_bucket
rkistner Aug 27, 2023
507ee38
Fix deadlock on closing of connection.
rkistner Sep 4, 2023
15ebc61
WIP.
rkistner Oct 3, 2023
33d5d92
Merge remote-tracking branch 'origin/master' into rust-lib
rkistner Jan 4, 2024
07fe067
Update/fix tests.
rkistner Jan 4, 2024
b02c9cb
Add view name override.
rkistner Jan 4, 2024
5c91489
Retry opening database if locked.
rkistner Jan 4, 2024
8281fc5
Merge remote-tracking branch 'origin/master' into rust-lib
rkistner Jan 4, 2024
123ebae
Fix lint issues.
rkistner Jan 4, 2024
127756a
Use higher-level `updateSchema` in tests; test viewName alias.
rkistner Jan 31, 2024
273b1a3
Merge branch 'master' into rust-lib-integration
mugikhan May 22, 2024
fd6f2e8
Load extension for android and iOS
mugikhan May 22, 2024
b450ac3
Load extension for iOS, MacOS and Android
mugikhan May 23, 2024
b3e6e22
Include powersync_flutter_libs
mugikhan May 27, 2024
588842b
Rename android package
mugikhan May 27, 2024
3d352a4
Update windows and linux extension scripts
mugikhan Jun 2, 2024
1393881
Download binary in cmake
mugikhan Jun 4, 2024
580d56e
Fix arch in cmake
mugikhan Jun 4, 2024
d662e12
Fix binary download
mugikhan Jun 4, 2024
c53ec21
Load extension on windows
mugikhan Jun 4, 2024
4175bdc
Clean up readme and changelog
mugikhan Jun 4, 2024
6268fa9
Remove test code
mugikhan Jun 4, 2024
be3348d
Update Abi check for current platform
mugikhan Jun 5, 2024
2a22537
Clean up unused files
mugikhan Jun 5, 2024
8111db7
Update path dependencies
mugikhan Jun 5, 2024
43ca9cd
Test downloading powersync binary for tests
mugikhan Jun 5, 2024
f89e51b
Fix download for linux binary
mugikhan Jun 5, 2024
9d51339
Add binary download for demos workflow
mugikhan Jun 5, 2024
7813689
Download latest binaries
mugikhan Jun 5, 2024
1469c00
Bump version of powersync
mugikhan Jun 6, 2024
c9ec617
Bump minor version
mugikhan Jun 6, 2024
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
17 changes: 11 additions & 6 deletions .github/workflows/demos.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Demos checks

concurrency:
group: demos-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
group: demos-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on:
push:
Expand All @@ -17,8 +17,8 @@ jobs:
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.x'
channel: 'stable'
flutter-version: "3.x"
channel: "stable"

- name: Install Melos
run: flutter pub global activate melos
Expand All @@ -38,11 +38,16 @@ jobs:
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.x'
channel: 'stable'
flutter-version: "3.x"
channel: "stable"
- name: Install melos
run: flutter pub global activate melos
- name: Install dependencies
run: melos bootstrap
- name: Download powersync binary
run: |
github="https://github.com/powersync-ja/powersync-sqlite-core/releases/download/v0.1.6"

curl "${github}/libpowersync_x64.so" -o packages/powersync/libpowersync.so --create-dirs -L -f
- name: Run tests
run: melos test
17 changes: 11 additions & 6 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Packages check

concurrency:
group: packages-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
group: packages-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on:
push:
Expand All @@ -17,8 +17,8 @@ jobs:
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.x'
channel: 'stable'
flutter-version: "3.x"
channel: "stable"

- name: Install Melos
run: flutter pub global activate melos
Expand All @@ -42,11 +42,16 @@ jobs:
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.x'
channel: 'stable'
flutter-version: "3.x"
channel: "stable"
- name: Install melos
run: flutter pub global activate melos
- name: Install dependencies
run: melos bootstrap
- name: Download powersync binary
run: |
github="https://github.com/powersync-ja/powersync-sqlite-core/releases/download/v0.1.6"

curl "${github}/libpowersync_x64.so" -o packages/powersync/libpowersync.so --create-dirs -L -f
- name: Run tests
run: melos test
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
#include "generated_plugin_registrant.h"

#include <gtk/gtk_plugin.h>
#include <powersync_flutter_libs/powersync_flutter_libs_plugin.h>
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>

void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) gtk_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "GtkPlugin");
gtk_plugin_register_with_registrar(gtk_registrar);
g_autoptr(FlPluginRegistrar) powersync_flutter_libs_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "PowersyncFlutterLibsPlugin");
powersync_flutter_libs_plugin_register_with_registrar(powersync_flutter_libs_registrar);
g_autoptr(FlPluginRegistrar) sqlite3_flutter_libs_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "Sqlite3FlutterLibsPlugin");
sqlite3_flutter_libs_plugin_register_with_registrar(sqlite3_flutter_libs_registrar);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

list(APPEND FLUTTER_PLUGIN_LIST
gtk
powersync_flutter_libs
sqlite3_flutter_libs
url_launcher_linux
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import Foundation

import app_links
import path_provider_foundation
import powersync_flutter_libs
import shared_preferences_foundation
import sqlite3_flutter_libs
import url_launcher_macos

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
PowersyncFlutterLibsPlugin.register(with: registry.registrar(forPlugin: "PowersyncFlutterLibsPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
Sqlite3FlutterLibsPlugin.register(with: registry.registrar(forPlugin: "Sqlite3FlutterLibsPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
Expand Down
13 changes: 10 additions & 3 deletions demos/supabase-anonymous-auth/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,14 @@ packages:
path: "../../packages/powersync"
relative: true
source: path
version: "1.3.1"
version: "1.4.0"
powersync_flutter_libs:
dependency: "direct overridden"
description:
path: "../../packages/powersync_flutter_libs"
relative: true
source: path
version: "0.0.1"
realtime_client:
dependency: transitive
description:
Expand Down Expand Up @@ -440,10 +447,10 @@ packages:
dependency: transitive
description:
name: sqlite3_flutter_libs
sha256: d6c31c8511c441d1f12f20b607343df1afe4eddf24a1cf85021677c8eea26060
sha256: "9f89a7e7dc36eac2035808427eba1c3fbd79e59c3a22093d8dace6d36b1fe89e"
url: "https://pub.dev"
source: hosted
version: "0.5.20"
version: "0.5.23"
sqlite_async:
dependency: "direct main"
description:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
#include "generated_plugin_registrant.h"

#include <app_links/app_links_plugin_c_api.h>
#include <powersync_flutter_libs/powersync_flutter_libs_plugin.h>
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
AppLinksPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("AppLinksPluginCApi"));
PowersyncFlutterLibsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PowersyncFlutterLibsPlugin"));
Sqlite3FlutterLibsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("Sqlite3FlutterLibsPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

list(APPEND FLUTTER_PLUGIN_LIST
app_links
powersync_flutter_libs
sqlite3_flutter_libs
url_launcher_windows
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
#include "generated_plugin_registrant.h"

#include <gtk/gtk_plugin.h>
#include <powersync_flutter_libs/powersync_flutter_libs_plugin.h>
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>

void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) gtk_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "GtkPlugin");
gtk_plugin_register_with_registrar(gtk_registrar);
g_autoptr(FlPluginRegistrar) powersync_flutter_libs_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "PowersyncFlutterLibsPlugin");
powersync_flutter_libs_plugin_register_with_registrar(powersync_flutter_libs_registrar);
g_autoptr(FlPluginRegistrar) sqlite3_flutter_libs_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "Sqlite3FlutterLibsPlugin");
sqlite3_flutter_libs_plugin_register_with_registrar(sqlite3_flutter_libs_registrar);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

list(APPEND FLUTTER_PLUGIN_LIST
gtk
powersync_flutter_libs
sqlite3_flutter_libs
url_launcher_linux
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import Foundation

import app_links
import path_provider_foundation
import powersync_flutter_libs
import shared_preferences_foundation
import sqlite3_flutter_libs
import url_launcher_macos

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
PowersyncFlutterLibsPlugin.register(with: registry.registrar(forPlugin: "PowersyncFlutterLibsPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
Sqlite3FlutterLibsPlugin.register(with: registry.registrar(forPlugin: "Sqlite3FlutterLibsPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
Expand Down
13 changes: 10 additions & 3 deletions demos/supabase-edge-function-auth/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,14 @@ packages:
path: "../../packages/powersync"
relative: true
source: path
version: "1.3.1"
version: "1.4.0"
powersync_flutter_libs:
dependency: "direct overridden"
description:
path: "../../packages/powersync_flutter_libs"
relative: true
source: path
version: "0.0.1"
realtime_client:
dependency: transitive
description:
Expand Down Expand Up @@ -440,10 +447,10 @@ packages:
dependency: transitive
description:
name: sqlite3_flutter_libs
sha256: d6c31c8511c441d1f12f20b607343df1afe4eddf24a1cf85021677c8eea26060
sha256: "9f89a7e7dc36eac2035808427eba1c3fbd79e59c3a22093d8dace6d36b1fe89e"
url: "https://pub.dev"
source: hosted
version: "0.5.20"
version: "0.5.23"
sqlite_async:
dependency: "direct main"
description:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
#include "generated_plugin_registrant.h"

#include <app_links/app_links_plugin_c_api.h>
#include <powersync_flutter_libs/powersync_flutter_libs_plugin.h>
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
AppLinksPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("AppLinksPluginCApi"));
PowersyncFlutterLibsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PowersyncFlutterLibsPlugin"));
Sqlite3FlutterLibsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("Sqlite3FlutterLibsPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

list(APPEND FLUTTER_PLUGIN_LIST
app_links
powersync_flutter_libs
sqlite3_flutter_libs
url_launcher_windows
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
#include "generated_plugin_registrant.h"

#include <gtk/gtk_plugin.h>
#include <powersync_flutter_libs/powersync_flutter_libs_plugin.h>
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>

void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) gtk_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "GtkPlugin");
gtk_plugin_register_with_registrar(gtk_registrar);
g_autoptr(FlPluginRegistrar) powersync_flutter_libs_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "PowersyncFlutterLibsPlugin");
powersync_flutter_libs_plugin_register_with_registrar(powersync_flutter_libs_registrar);
g_autoptr(FlPluginRegistrar) sqlite3_flutter_libs_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "Sqlite3FlutterLibsPlugin");
sqlite3_flutter_libs_plugin_register_with_registrar(sqlite3_flutter_libs_registrar);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

list(APPEND FLUTTER_PLUGIN_LIST
gtk
powersync_flutter_libs
sqlite3_flutter_libs
url_launcher_linux
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Foundation

import app_links
import path_provider_foundation
import powersync_flutter_libs
import shared_preferences_foundation
import sign_in_with_apple
import sqlite3_flutter_libs
Expand All @@ -15,6 +16,7 @@ import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
PowersyncFlutterLibsPlugin.register(with: registry.registrar(forPlugin: "PowersyncFlutterLibsPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SignInWithApplePlugin.register(with: registry.registrar(forPlugin: "SignInWithApplePlugin"))
Sqlite3FlutterLibsPlugin.register(with: registry.registrar(forPlugin: "Sqlite3FlutterLibsPlugin"))
Expand Down
13 changes: 10 additions & 3 deletions demos/supabase-simple-chat/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,14 @@ packages:
path: "../../packages/powersync"
relative: true
source: path
version: "1.3.1"
version: "1.4.0"
powersync_flutter_libs:
dependency: "direct overridden"
description:
path: "../../packages/powersync_flutter_libs"
relative: true
source: path
version: "0.0.1"
realtime_client:
dependency: transitive
description:
Expand Down Expand Up @@ -496,10 +503,10 @@ packages:
dependency: transitive
description:
name: sqlite3_flutter_libs
sha256: d6c31c8511c441d1f12f20b607343df1afe4eddf24a1cf85021677c8eea26060
sha256: "9f89a7e7dc36eac2035808427eba1c3fbd79e59c3a22093d8dace6d36b1fe89e"
url: "https://pub.dev"
source: hosted
version: "0.5.20"
version: "0.5.23"
sqlite_async:
dependency: transitive
description:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
#include "generated_plugin_registrant.h"

#include <app_links/app_links_plugin_c_api.h>
#include <powersync_flutter_libs/powersync_flutter_libs_plugin.h>
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
AppLinksPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("AppLinksPluginCApi"));
PowersyncFlutterLibsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PowersyncFlutterLibsPlugin"));
Sqlite3FlutterLibsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("Sqlite3FlutterLibsPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

list(APPEND FLUTTER_PLUGIN_LIST
app_links
powersync_flutter_libs
sqlite3_flutter_libs
url_launcher_windows
)
Expand Down
2 changes: 1 addition & 1 deletion demos/supabase-todolist/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ android {
applicationId "co.powersync.demotodolist"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 21
minSdkVersion 24
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
Loading