From 110a8d9e53c77dffac1a4009069acbdd9acbbd15 Mon Sep 17 00:00:00 2001 From: Simon Binder Date: Fri, 3 Jul 2020 12:10:37 +0200 Subject: [PATCH 1/3] Add empty Android plugin class to moor_ffi --- .../integration_tests/flutter_db/pubspec.lock | 4 ++-- .../query_builder/schema/table_info.dart | 2 +- .../eu/simonbinder/moor_ffi/MoorFfiPlugin.java | 17 +++++++++++++++++ moor_ffi/pubspec.yaml | 10 +++++++--- 4 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 moor_ffi/android/src/main/java/eu/simonbinder/moor_ffi/MoorFfiPlugin.java diff --git a/extras/integration_tests/flutter_db/pubspec.lock b/extras/integration_tests/flutter_db/pubspec.lock index b37ec1a3..c1541463 100644 --- a/extras/integration_tests/flutter_db/pubspec.lock +++ b/extras/integration_tests/flutter_db/pubspec.lock @@ -180,14 +180,14 @@ packages: path: "../../../moor" relative: true source: path - version: "3.1.0" + version: "3.2.0" moor_ffi: dependency: "direct main" description: path: "../../../moor_ffi" relative: true source: path - version: "0.7.0-dev" + version: "0.7.0" moor_flutter: dependency: "direct main" description: diff --git a/moor/lib/src/runtime/query_builder/schema/table_info.dart b/moor/lib/src/runtime/query_builder/schema/table_info.dart index 1047dd60..28caf637 100644 --- a/moor/lib/src/runtime/query_builder/schema/table_info.dart +++ b/moor/lib/src/runtime/query_builder/schema/table_info.dart @@ -59,7 +59,7 @@ mixin TableInfo on Table /// Converts a [companion] to the real model class, [D]. /// /// Values that are [Value.absent] in the companion will be set to `null`. - D mapFromCompanion(UpdateCompanion companion) { + D mapFromCompanion(Insertable companion) { final asColumnMap = companion.toColumns(false); if (asColumnMap.values.any((e) => e is! Variable)) { diff --git a/moor_ffi/android/src/main/java/eu/simonbinder/moor_ffi/MoorFfiPlugin.java b/moor_ffi/android/src/main/java/eu/simonbinder/moor_ffi/MoorFfiPlugin.java new file mode 100644 index 00000000..e9dee623 --- /dev/null +++ b/moor_ffi/android/src/main/java/eu/simonbinder/moor_ffi/MoorFfiPlugin.java @@ -0,0 +1,17 @@ +package eu.simonbinder.moor_ffi; + +import io.flutter.embedding.engine.plugins.FlutterPlugin; + +public class MoorFfiPlugin implements FlutterPlugin { + + @Override + public void onAttachedToEngine(FlutterPluginBinding binding) { + // Do nothing, we only need the native libraries. + } + + @Override + public void onDetachedFromEngine(FlutterPluginBinding binding) { + // Again, nothing to do here. + } + +} \ No newline at end of file diff --git a/moor_ffi/pubspec.yaml b/moor_ffi/pubspec.yaml index ddc6a58c..7ae01383 100644 --- a/moor_ffi/pubspec.yaml +++ b/moor_ffi/pubspec.yaml @@ -23,6 +23,10 @@ dev_dependencies: flutter: plugin: - # the flutter.plugin key needs to exists so that this project gets recognized as a plugin when imported. We need to - # get recognized as a plugin so that our build scripts are executed. - foo: bar \ No newline at end of file + platforms: + # At the moment, we only have a custom build script for Android. For that to be included, we have to provide a + # plugin class (even though moor_ffi contains no platform-specific code). The plugin class is just an empty stub + # here. + android: + pluginClass: MoorFfiPlugin + package: eu.simonbinder.moor_ffi \ No newline at end of file From ba987b57b1a324fd0594037fe60c6a81ab2db8a9 Mon Sep 17 00:00:00 2001 From: Simon Binder Date: Wed, 8 Jul 2020 16:04:10 +0200 Subject: [PATCH 2/3] Release moor_ffi version 0.7.1 --- moor_ffi/CHANGELOG.md | 4 ++++ moor_ffi/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/moor_ffi/CHANGELOG.md b/moor_ffi/CHANGELOG.md index 65a3fc65..e7302543 100644 --- a/moor_ffi/CHANGELOG.md +++ b/moor_ffi/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.7.1 + +- Fix `libsqlite3.so` not being included in new Flutter builds for Android + ## 0.7.0 - Throw an error when using an unsupported datatype as argument diff --git a/moor_ffi/pubspec.yaml b/moor_ffi/pubspec.yaml index 7ae01383..4c6405b5 100644 --- a/moor_ffi/pubspec.yaml +++ b/moor_ffi/pubspec.yaml @@ -1,6 +1,6 @@ name: moor_ffi description: "Provides sqlite bindings using dart:ffi, including a moor executor" -version: 0.7.0 +version: 0.7.1 homepage: https://github.com/simolus3/moor/tree/develop/moor_ffi issue_tracker: https://github.com/simolus3/moor/issues From 0d2512c51026c3f9192b82c795e90e99aec19a37 Mon Sep 17 00:00:00 2001 From: Egide Muhire Date: Sun, 26 Jul 2020 13:48:35 +0200 Subject: [PATCH 3/3] Fix documentation typo / wording --- docs/content/en/docs/testing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/en/docs/testing.md b/docs/content/en/docs/testing.md index 0bbc3e2f..3d150f34 100644 --- a/docs/content/en/docs/testing.md +++ b/docs/content/en/docs/testing.md @@ -5,7 +5,7 @@ description: Guide on writing unit tests for moor databases Flutter apps using moor can always be tested with [integration tests](https://flutter.dev/docs/cookbook/testing/integration/introduction) running on a real device. This guide focusses on writing unit tests for a database written in moor. -Those tests can be run and debugged on your computer without additional setup, you don't a +Those tests can be run and debugged on your computer without additional setup, you don't need a physical device to run them. ## Setup @@ -108,4 +108,4 @@ test('stream emits a new user when the name updates', () async { await database.updateName(id, 'changed name'); await expectation; }); -``` \ No newline at end of file +```