Skip to content

Commit d812f78

Browse files
mugikhanrkistner
andauthored
Load and use PowerSync rust extension (#92)
* Initial extension testing. * Replace schema logic with rust extension. * Use extension for saving operations. * Auto tx_id. * Use sync_local op. * Validate checksums using extension. * clear_remove_ops * delete_pending_buckets * delete_bucket * Fix deadlock on closing of connection. * WIP. * Update/fix tests. * Add view name override. * Retry opening database if locked. * Fix lint issues. * Use higher-level `updateSchema` in tests; test viewName alias. * Load extension for android and iOS * Load extension for iOS, MacOS and Android * Include powersync_flutter_libs * Rename android package * Update windows and linux extension scripts * Download binary in cmake * Fix arch in cmake * Fix binary download * Load extension on windows * Clean up readme and changelog * Remove test code * Update Abi check for current platform * Clean up unused files * Update path dependencies * Test downloading powersync binary for tests * Fix download for linux binary * Add binary download for demos workflow * Download latest binaries * Bump version of powersync * Bump minor version --------- Co-authored-by: Ralf Kistner <ralf@journeyapps.com>
1 parent e362fdb commit d812f78

File tree

78 files changed

+1367
-993
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1367
-993
lines changed

.github/workflows/demos.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: Demos checks
22

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

77
on:
88
push:
@@ -17,8 +17,8 @@ jobs:
1717
- name: Install Flutter
1818
uses: subosito/flutter-action@v2
1919
with:
20-
flutter-version: '3.x'
21-
channel: 'stable'
20+
flutter-version: "3.x"
21+
channel: "stable"
2222

2323
- name: Install Melos
2424
run: flutter pub global activate melos
@@ -38,11 +38,16 @@ jobs:
3838
- name: Install Flutter
3939
uses: subosito/flutter-action@v2
4040
with:
41-
flutter-version: '3.x'
42-
channel: 'stable'
41+
flutter-version: "3.x"
42+
channel: "stable"
4343
- name: Install melos
4444
run: flutter pub global activate melos
4545
- name: Install dependencies
4646
run: melos bootstrap
47+
- name: Download powersync binary
48+
run: |
49+
github="https://github.com/powersync-ja/powersync-sqlite-core/releases/download/v0.1.6"
50+
51+
curl "${github}/libpowersync_x64.so" -o packages/powersync/libpowersync.so --create-dirs -L -f
4752
- name: Run tests
4853
run: melos test

.github/workflows/packages.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: Packages check
22

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

77
on:
88
push:
@@ -17,8 +17,8 @@ jobs:
1717
- name: Install Flutter
1818
uses: subosito/flutter-action@v2
1919
with:
20-
flutter-version: '3.x'
21-
channel: 'stable'
20+
flutter-version: "3.x"
21+
channel: "stable"
2222

2323
- name: Install Melos
2424
run: flutter pub global activate melos
@@ -42,11 +42,16 @@ jobs:
4242
- name: Install Flutter
4343
uses: subosito/flutter-action@v2
4444
with:
45-
flutter-version: '3.x'
46-
channel: 'stable'
45+
flutter-version: "3.x"
46+
channel: "stable"
4747
- name: Install melos
4848
run: flutter pub global activate melos
4949
- name: Install dependencies
5050
run: melos bootstrap
51+
- name: Download powersync binary
52+
run: |
53+
github="https://github.com/powersync-ja/powersync-sqlite-core/releases/download/v0.1.6"
54+
55+
curl "${github}/libpowersync_x64.so" -o packages/powersync/libpowersync.so --create-dirs -L -f
5156
- name: Run tests
5257
run: melos test

demos/supabase-anonymous-auth/linux/flutter/generated_plugin_registrant.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@
77
#include "generated_plugin_registrant.h"
88

99
#include <gtk/gtk_plugin.h>
10+
#include <powersync_flutter_libs/powersync_flutter_libs_plugin.h>
1011
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
1112
#include <url_launcher_linux/url_launcher_plugin.h>
1213

1314
void fl_register_plugins(FlPluginRegistry* registry) {
1415
g_autoptr(FlPluginRegistrar) gtk_registrar =
1516
fl_plugin_registry_get_registrar_for_plugin(registry, "GtkPlugin");
1617
gtk_plugin_register_with_registrar(gtk_registrar);
18+
g_autoptr(FlPluginRegistrar) powersync_flutter_libs_registrar =
19+
fl_plugin_registry_get_registrar_for_plugin(registry, "PowersyncFlutterLibsPlugin");
20+
powersync_flutter_libs_plugin_register_with_registrar(powersync_flutter_libs_registrar);
1721
g_autoptr(FlPluginRegistrar) sqlite3_flutter_libs_registrar =
1822
fl_plugin_registry_get_registrar_for_plugin(registry, "Sqlite3FlutterLibsPlugin");
1923
sqlite3_flutter_libs_plugin_register_with_registrar(sqlite3_flutter_libs_registrar);

demos/supabase-anonymous-auth/linux/flutter/generated_plugins.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
list(APPEND FLUTTER_PLUGIN_LIST
66
gtk
7+
powersync_flutter_libs
78
sqlite3_flutter_libs
89
url_launcher_linux
910
)

demos/supabase-anonymous-auth/macos/Flutter/GeneratedPluginRegistrant.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ import Foundation
77

88
import app_links
99
import path_provider_foundation
10+
import powersync_flutter_libs
1011
import shared_preferences_foundation
1112
import sqlite3_flutter_libs
1213
import url_launcher_macos
1314

1415
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
1516
AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin"))
1617
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
18+
PowersyncFlutterLibsPlugin.register(with: registry.registrar(forPlugin: "PowersyncFlutterLibsPlugin"))
1719
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
1820
Sqlite3FlutterLibsPlugin.register(with: registry.registrar(forPlugin: "Sqlite3FlutterLibsPlugin"))
1921
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))

demos/supabase-anonymous-auth/pubspec.lock

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,14 @@ packages:
326326
path: "../../packages/powersync"
327327
relative: true
328328
source: path
329-
version: "1.3.1"
329+
version: "1.4.0"
330+
powersync_flutter_libs:
331+
dependency: "direct overridden"
332+
description:
333+
path: "../../packages/powersync_flutter_libs"
334+
relative: true
335+
source: path
336+
version: "0.0.1"
330337
realtime_client:
331338
dependency: transitive
332339
description:
@@ -440,10 +447,10 @@ packages:
440447
dependency: transitive
441448
description:
442449
name: sqlite3_flutter_libs
443-
sha256: d6c31c8511c441d1f12f20b607343df1afe4eddf24a1cf85021677c8eea26060
450+
sha256: "9f89a7e7dc36eac2035808427eba1c3fbd79e59c3a22093d8dace6d36b1fe89e"
444451
url: "https://pub.dev"
445452
source: hosted
446-
version: "0.5.20"
453+
version: "0.5.23"
447454
sqlite_async:
448455
dependency: "direct main"
449456
description:

demos/supabase-anonymous-auth/windows/flutter/generated_plugin_registrant.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77
#include "generated_plugin_registrant.h"
88

99
#include <app_links/app_links_plugin_c_api.h>
10+
#include <powersync_flutter_libs/powersync_flutter_libs_plugin.h>
1011
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
1112
#include <url_launcher_windows/url_launcher_windows.h>
1213

1314
void RegisterPlugins(flutter::PluginRegistry* registry) {
1415
AppLinksPluginCApiRegisterWithRegistrar(
1516
registry->GetRegistrarForPlugin("AppLinksPluginCApi"));
17+
PowersyncFlutterLibsPluginRegisterWithRegistrar(
18+
registry->GetRegistrarForPlugin("PowersyncFlutterLibsPlugin"));
1619
Sqlite3FlutterLibsPluginRegisterWithRegistrar(
1720
registry->GetRegistrarForPlugin("Sqlite3FlutterLibsPlugin"));
1821
UrlLauncherWindowsRegisterWithRegistrar(

demos/supabase-anonymous-auth/windows/flutter/generated_plugins.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
list(APPEND FLUTTER_PLUGIN_LIST
66
app_links
7+
powersync_flutter_libs
78
sqlite3_flutter_libs
89
url_launcher_windows
910
)

demos/supabase-edge-function-auth/linux/flutter/generated_plugin_registrant.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@
77
#include "generated_plugin_registrant.h"
88

99
#include <gtk/gtk_plugin.h>
10+
#include <powersync_flutter_libs/powersync_flutter_libs_plugin.h>
1011
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
1112
#include <url_launcher_linux/url_launcher_plugin.h>
1213

1314
void fl_register_plugins(FlPluginRegistry* registry) {
1415
g_autoptr(FlPluginRegistrar) gtk_registrar =
1516
fl_plugin_registry_get_registrar_for_plugin(registry, "GtkPlugin");
1617
gtk_plugin_register_with_registrar(gtk_registrar);
18+
g_autoptr(FlPluginRegistrar) powersync_flutter_libs_registrar =
19+
fl_plugin_registry_get_registrar_for_plugin(registry, "PowersyncFlutterLibsPlugin");
20+
powersync_flutter_libs_plugin_register_with_registrar(powersync_flutter_libs_registrar);
1721
g_autoptr(FlPluginRegistrar) sqlite3_flutter_libs_registrar =
1822
fl_plugin_registry_get_registrar_for_plugin(registry, "Sqlite3FlutterLibsPlugin");
1923
sqlite3_flutter_libs_plugin_register_with_registrar(sqlite3_flutter_libs_registrar);

demos/supabase-edge-function-auth/linux/flutter/generated_plugins.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
list(APPEND FLUTTER_PLUGIN_LIST
66
gtk
7+
powersync_flutter_libs
78
sqlite3_flutter_libs
89
url_launcher_linux
910
)

demos/supabase-edge-function-auth/macos/Flutter/GeneratedPluginRegistrant.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ import Foundation
77

88
import app_links
99
import path_provider_foundation
10+
import powersync_flutter_libs
1011
import shared_preferences_foundation
1112
import sqlite3_flutter_libs
1213
import url_launcher_macos
1314

1415
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
1516
AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin"))
1617
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
18+
PowersyncFlutterLibsPlugin.register(with: registry.registrar(forPlugin: "PowersyncFlutterLibsPlugin"))
1719
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
1820
Sqlite3FlutterLibsPlugin.register(with: registry.registrar(forPlugin: "Sqlite3FlutterLibsPlugin"))
1921
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))

demos/supabase-edge-function-auth/pubspec.lock

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,14 @@ packages:
326326
path: "../../packages/powersync"
327327
relative: true
328328
source: path
329-
version: "1.3.1"
329+
version: "1.4.0"
330+
powersync_flutter_libs:
331+
dependency: "direct overridden"
332+
description:
333+
path: "../../packages/powersync_flutter_libs"
334+
relative: true
335+
source: path
336+
version: "0.0.1"
330337
realtime_client:
331338
dependency: transitive
332339
description:
@@ -440,10 +447,10 @@ packages:
440447
dependency: transitive
441448
description:
442449
name: sqlite3_flutter_libs
443-
sha256: d6c31c8511c441d1f12f20b607343df1afe4eddf24a1cf85021677c8eea26060
450+
sha256: "9f89a7e7dc36eac2035808427eba1c3fbd79e59c3a22093d8dace6d36b1fe89e"
444451
url: "https://pub.dev"
445452
source: hosted
446-
version: "0.5.20"
453+
version: "0.5.23"
447454
sqlite_async:
448455
dependency: "direct main"
449456
description:

demos/supabase-edge-function-auth/windows/flutter/generated_plugin_registrant.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77
#include "generated_plugin_registrant.h"
88

99
#include <app_links/app_links_plugin_c_api.h>
10+
#include <powersync_flutter_libs/powersync_flutter_libs_plugin.h>
1011
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
1112
#include <url_launcher_windows/url_launcher_windows.h>
1213

1314
void RegisterPlugins(flutter::PluginRegistry* registry) {
1415
AppLinksPluginCApiRegisterWithRegistrar(
1516
registry->GetRegistrarForPlugin("AppLinksPluginCApi"));
17+
PowersyncFlutterLibsPluginRegisterWithRegistrar(
18+
registry->GetRegistrarForPlugin("PowersyncFlutterLibsPlugin"));
1619
Sqlite3FlutterLibsPluginRegisterWithRegistrar(
1720
registry->GetRegistrarForPlugin("Sqlite3FlutterLibsPlugin"));
1821
UrlLauncherWindowsRegisterWithRegistrar(

demos/supabase-edge-function-auth/windows/flutter/generated_plugins.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
list(APPEND FLUTTER_PLUGIN_LIST
66
app_links
7+
powersync_flutter_libs
78
sqlite3_flutter_libs
89
url_launcher_windows
910
)

demos/supabase-simple-chat/linux/flutter/generated_plugin_registrant.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@
77
#include "generated_plugin_registrant.h"
88

99
#include <gtk/gtk_plugin.h>
10+
#include <powersync_flutter_libs/powersync_flutter_libs_plugin.h>
1011
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
1112
#include <url_launcher_linux/url_launcher_plugin.h>
1213

1314
void fl_register_plugins(FlPluginRegistry* registry) {
1415
g_autoptr(FlPluginRegistrar) gtk_registrar =
1516
fl_plugin_registry_get_registrar_for_plugin(registry, "GtkPlugin");
1617
gtk_plugin_register_with_registrar(gtk_registrar);
18+
g_autoptr(FlPluginRegistrar) powersync_flutter_libs_registrar =
19+
fl_plugin_registry_get_registrar_for_plugin(registry, "PowersyncFlutterLibsPlugin");
20+
powersync_flutter_libs_plugin_register_with_registrar(powersync_flutter_libs_registrar);
1721
g_autoptr(FlPluginRegistrar) sqlite3_flutter_libs_registrar =
1822
fl_plugin_registry_get_registrar_for_plugin(registry, "Sqlite3FlutterLibsPlugin");
1923
sqlite3_flutter_libs_plugin_register_with_registrar(sqlite3_flutter_libs_registrar);

demos/supabase-simple-chat/linux/flutter/generated_plugins.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
list(APPEND FLUTTER_PLUGIN_LIST
66
gtk
7+
powersync_flutter_libs
78
sqlite3_flutter_libs
89
url_launcher_linux
910
)

demos/supabase-simple-chat/macos/Flutter/GeneratedPluginRegistrant.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Foundation
77

88
import app_links
99
import path_provider_foundation
10+
import powersync_flutter_libs
1011
import shared_preferences_foundation
1112
import sign_in_with_apple
1213
import sqlite3_flutter_libs
@@ -15,6 +16,7 @@ import url_launcher_macos
1516
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
1617
AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin"))
1718
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
19+
PowersyncFlutterLibsPlugin.register(with: registry.registrar(forPlugin: "PowersyncFlutterLibsPlugin"))
1820
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
1921
SignInWithApplePlugin.register(with: registry.registrar(forPlugin: "SignInWithApplePlugin"))
2022
Sqlite3FlutterLibsPlugin.register(with: registry.registrar(forPlugin: "Sqlite3FlutterLibsPlugin"))

demos/supabase-simple-chat/pubspec.lock

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,14 @@ packages:
358358
path: "../../packages/powersync"
359359
relative: true
360360
source: path
361-
version: "1.3.1"
361+
version: "1.4.0"
362+
powersync_flutter_libs:
363+
dependency: "direct overridden"
364+
description:
365+
path: "../../packages/powersync_flutter_libs"
366+
relative: true
367+
source: path
368+
version: "0.0.1"
362369
realtime_client:
363370
dependency: transitive
364371
description:
@@ -496,10 +503,10 @@ packages:
496503
dependency: transitive
497504
description:
498505
name: sqlite3_flutter_libs
499-
sha256: d6c31c8511c441d1f12f20b607343df1afe4eddf24a1cf85021677c8eea26060
506+
sha256: "9f89a7e7dc36eac2035808427eba1c3fbd79e59c3a22093d8dace6d36b1fe89e"
500507
url: "https://pub.dev"
501508
source: hosted
502-
version: "0.5.20"
509+
version: "0.5.23"
503510
sqlite_async:
504511
dependency: transitive
505512
description:

demos/supabase-simple-chat/windows/flutter/generated_plugin_registrant.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77
#include "generated_plugin_registrant.h"
88

99
#include <app_links/app_links_plugin_c_api.h>
10+
#include <powersync_flutter_libs/powersync_flutter_libs_plugin.h>
1011
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
1112
#include <url_launcher_windows/url_launcher_windows.h>
1213

1314
void RegisterPlugins(flutter::PluginRegistry* registry) {
1415
AppLinksPluginCApiRegisterWithRegistrar(
1516
registry->GetRegistrarForPlugin("AppLinksPluginCApi"));
17+
PowersyncFlutterLibsPluginRegisterWithRegistrar(
18+
registry->GetRegistrarForPlugin("PowersyncFlutterLibsPlugin"));
1619
Sqlite3FlutterLibsPluginRegisterWithRegistrar(
1720
registry->GetRegistrarForPlugin("Sqlite3FlutterLibsPlugin"));
1821
UrlLauncherWindowsRegisterWithRegistrar(

demos/supabase-simple-chat/windows/flutter/generated_plugins.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
list(APPEND FLUTTER_PLUGIN_LIST
66
app_links
7+
powersync_flutter_libs
78
sqlite3_flutter_libs
89
url_launcher_windows
910
)

demos/supabase-todolist/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ android {
4646
applicationId "co.powersync.demotodolist"
4747
// You can update the following values to match your application needs.
4848
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
49-
minSdkVersion 21
49+
minSdkVersion 24
5050
targetSdkVersion flutter.targetSdkVersion
5151
versionCode flutterVersionCode.toInteger()
5252
versionName flutterVersionName

0 commit comments

Comments
 (0)