diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb1c03a3..c7fa4ff9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,7 +87,7 @@ jobs: - name: Run generator run: flutter packages pub run build_runner build --delete-conflicting-outputs - working-directory: floor + working-directory: floor_common - name: Analyze run: flutter analyze @@ -101,14 +101,14 @@ jobs: - name: Run tests run: flutter test --coverage --coverage-path coverage/lcov.info - working-directory: floor + working-directory: floor_common - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} flags: floor - file: ./floor/coverage/lcov.info + file: ./floor_common/coverage/lcov.info example: runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 3406c8e2..10d6e236 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Miscellaneous -floor/**/*.g.dart +floor_common/**/*.g.dart *.class *.log *.pyc diff --git a/example/pubspec.lock b/example/pubspec.lock index 5eb91dff..841a53a7 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -231,6 +231,13 @@ packages: relative: true source: path version: "1.4.2" + floor_common: + dependency: transitive + description: + path: "../floor_common" + relative: true + source: path + version: "1.2.0" floor_generator: dependency: "direct dev" description: diff --git a/floor/lib/floor.dart b/floor/lib/floor.dart index f60f694f..5793c19a 100644 --- a/floor/lib/floor.dart +++ b/floor/lib/floor.dart @@ -1,12 +1,2 @@ -library floor; - -export 'package:floor/src/adapter/deletion_adapter.dart'; -export 'package:floor/src/adapter/insertion_adapter.dart'; -export 'package:floor/src/adapter/migration_adapter.dart'; -export 'package:floor/src/adapter/query_adapter.dart'; -export 'package:floor/src/adapter/update_adapter.dart'; -export 'package:floor/src/callback.dart'; -export 'package:floor/src/database.dart'; -export 'package:floor/src/migration.dart'; export 'package:floor/src/sqflite_database_factory.dart'; -export 'package:floor_annotation/floor_annotation.dart'; +export 'package:floor_common/floor_common.dart'; diff --git a/floor/pubspec.lock b/floor/pubspec.lock index 5f0b7139..b8f2496b 100644 --- a/floor/pubspec.lock +++ b/floor/pubspec.lock @@ -224,6 +224,13 @@ packages: relative: true source: path version: "1.4.2" + floor_common: + dependency: "direct main" + description: + path: "../floor_common" + relative: true + source: path + version: "1.2.0" floor_generator: dependency: "direct dev" description: diff --git a/floor/pubspec.yaml b/floor/pubspec.yaml index 20911c63..93aba39c 100644 --- a/floor/pubspec.yaml +++ b/floor/pubspec.yaml @@ -14,7 +14,9 @@ environment: dependencies: collection: ^1.18.0 floor_annotation: - path: ../floor_annotation + path: ../floor_annotation/ + floor_common: + path: ../floor_common/ flutter: sdk: flutter meta: @@ -22,7 +24,7 @@ dependencies: sqflite: ^2.3.2 sqflite_common_ffi: ^2.3.2+1 sqflite_common_ffi_web: ^0.4.3 - sqlparser: ^0.34.0 + sqlparser: ^0.34.1 dev_dependencies: build_runner: ^2.4.8 diff --git a/floor_common/LICENSE b/floor_common/LICENSE new file mode 100644 index 00000000..dd5b3a58 --- /dev/null +++ b/floor_common/LICENSE @@ -0,0 +1,174 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. diff --git a/floor_common/README.md b/floor_common/README.md new file mode 100644 index 00000000..0f6fc42c --- /dev/null +++ b/floor_common/README.md @@ -0,0 +1,30 @@ +# Floor +**The typesafe, reactive and lightweight SQLite abstraction for your Flutter applications (iOS, Android, Linux, macOS, Windows)** + +Don't import this package! +You should be using the [floor](https://pub.dartlang.org/packages/floor) package, which comes with all the annotations. +Separating the packages brings some benefits for developing the library but not for the users of it. + +--- + +The library's name derives from the following. +*Floor* as the *bottom layer* of a [Room](https://developer.android.com/topic/libraries/architecture/room) which points to the analogy of the database layer being the bottom and foundation layer of most applications. +Where *fl* also gives a pointer that the library is used in the Flutter context. + +## Bugs and Feedback +For bugs, questions and discussions please use [Github Issues](https://github.com/vitusortner/floor/issues). + +## License + Copyright 2021 The Floor Project Authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/floor_common/lib/floor_common.dart b/floor_common/lib/floor_common.dart new file mode 100644 index 00000000..11b7e1fd --- /dev/null +++ b/floor_common/lib/floor_common.dart @@ -0,0 +1,11 @@ +library floor; + +export 'package:floor_annotation/floor_annotation.dart'; +export 'package:floor_common/src/adapter/deletion_adapter.dart'; +export 'package:floor_common/src/adapter/insertion_adapter.dart'; +export 'package:floor_common/src/adapter/migration_adapter.dart'; +export 'package:floor_common/src/adapter/query_adapter.dart'; +export 'package:floor_common/src/adapter/update_adapter.dart'; +export 'package:floor_common/src/callback.dart'; +export 'package:floor_common/src/database.dart'; +export 'package:floor_common/src/migration.dart'; diff --git a/floor/lib/src/adapter/deletion_adapter.dart b/floor_common/lib/src/adapter/deletion_adapter.dart similarity index 95% rename from floor/lib/src/adapter/deletion_adapter.dart rename to floor_common/lib/src/adapter/deletion_adapter.dart index 1396fcaf..9a5b1721 100644 --- a/floor/lib/src/adapter/deletion_adapter.dart +++ b/floor_common/lib/src/adapter/deletion_adapter.dart @@ -1,7 +1,7 @@ import 'dart:async'; -import 'package:floor/src/util/primary_key_helper.dart'; -import 'package:sqflite/sqflite.dart'; +import 'package:floor_common/src/util/primary_key_helper.dart'; +import 'package:sqflite_common/sqlite_api.dart'; class DeletionAdapter { final DatabaseExecutor _database; diff --git a/floor/lib/src/adapter/insertion_adapter.dart b/floor_common/lib/src/adapter/insertion_adapter.dart similarity index 94% rename from floor/lib/src/adapter/insertion_adapter.dart rename to floor_common/lib/src/adapter/insertion_adapter.dart index 2f584d06..af154a88 100644 --- a/floor/lib/src/adapter/insertion_adapter.dart +++ b/floor_common/lib/src/adapter/insertion_adapter.dart @@ -1,8 +1,8 @@ import 'dart:async'; -import 'package:floor/src/extension/on_conflict_strategy_extensions.dart'; import 'package:floor_annotation/floor_annotation.dart'; -import 'package:sqflite/sqlite_api.dart'; +import 'package:floor_common/src/extension/on_conflict_strategy_extensions.dart'; +import 'package:sqflite_common/sqlite_api.dart'; class InsertionAdapter { final DatabaseExecutor _database; diff --git a/floor/lib/src/adapter/migration_adapter.dart b/floor_common/lib/src/adapter/migration_adapter.dart similarity index 90% rename from floor/lib/src/adapter/migration_adapter.dart rename to floor_common/lib/src/adapter/migration_adapter.dart index 6e726fd6..58d98a52 100644 --- a/floor/lib/src/adapter/migration_adapter.dart +++ b/floor_common/lib/src/adapter/migration_adapter.dart @@ -1,5 +1,5 @@ -import 'package:floor/src/migration.dart'; -import 'package:sqflite/sqflite.dart'; +import 'package:floor_common/src/migration.dart'; +import 'package:sqflite_common/sqlite_api.dart'; // ignore: avoid_classes_with_only_static_members abstract class MigrationAdapter { diff --git a/floor/lib/src/adapter/query_adapter.dart b/floor_common/lib/src/adapter/query_adapter.dart similarity index 98% rename from floor/lib/src/adapter/query_adapter.dart rename to floor_common/lib/src/adapter/query_adapter.dart index 8169c3a7..34c2cf6d 100644 --- a/floor/lib/src/adapter/query_adapter.dart +++ b/floor_common/lib/src/adapter/query_adapter.dart @@ -1,8 +1,9 @@ import 'dart:async'; +import 'package:sqflite_common/sqlite_api.dart'; import 'package:collection/collection.dart'; -import 'package:floor/src/util/string_utils.dart'; -import 'package:sqflite/sqflite.dart'; +import 'package:floor_common/src/util/string_utils.dart'; + import 'package:sqlparser/sqlparser.dart'; import '../util/constants.dart'; diff --git a/floor/lib/src/adapter/update_adapter.dart b/floor_common/lib/src/adapter/update_adapter.dart similarity index 93% rename from floor/lib/src/adapter/update_adapter.dart rename to floor_common/lib/src/adapter/update_adapter.dart index d83bd022..a39a8c75 100644 --- a/floor/lib/src/adapter/update_adapter.dart +++ b/floor_common/lib/src/adapter/update_adapter.dart @@ -1,9 +1,9 @@ import 'dart:async'; -import 'package:floor/src/extension/on_conflict_strategy_extensions.dart'; -import 'package:floor/src/util/primary_key_helper.dart'; import 'package:floor_annotation/floor_annotation.dart'; -import 'package:sqflite/sqlite_api.dart'; +import 'package:floor_common/src/extension/on_conflict_strategy_extensions.dart'; +import 'package:floor_common/src/util/primary_key_helper.dart'; +import 'package:sqflite_common/sqlite_api.dart'; class UpdateAdapter { final DatabaseExecutor _database; diff --git a/floor/lib/src/callback.dart b/floor_common/lib/src/callback.dart similarity index 95% rename from floor/lib/src/callback.dart rename to floor_common/lib/src/callback.dart index b0b558bd..9a25ef7a 100644 --- a/floor/lib/src/callback.dart +++ b/floor_common/lib/src/callback.dart @@ -1,6 +1,6 @@ import 'dart:async'; -import 'package:sqflite/sqflite.dart'; +import 'package:sqflite_common/sqlite_api.dart'; /// Callback class that can be attached to the Floor builder. class Callback { diff --git a/floor/lib/src/database.dart b/floor_common/lib/src/database.dart similarity index 92% rename from floor/lib/src/database.dart rename to floor_common/lib/src/database.dart index d8898ac4..5baf0237 100644 --- a/floor/lib/src/database.dart +++ b/floor_common/lib/src/database.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'package:meta/meta.dart'; -import 'package:sqflite/sqflite.dart' as sqflite; +import 'package:sqflite_common/sqlite_api.dart' as sqflite; /// Extend this class to enable database functionality. abstract class FloorDatabase { diff --git a/floor/lib/src/extension/on_conflict_strategy_extensions.dart b/floor_common/lib/src/extension/on_conflict_strategy_extensions.dart similarity index 92% rename from floor/lib/src/extension/on_conflict_strategy_extensions.dart rename to floor_common/lib/src/extension/on_conflict_strategy_extensions.dart index aff8afa0..13898261 100644 --- a/floor/lib/src/extension/on_conflict_strategy_extensions.dart +++ b/floor_common/lib/src/extension/on_conflict_strategy_extensions.dart @@ -1,5 +1,5 @@ import 'package:floor_annotation/floor_annotation.dart'; -import 'package:sqflite/sqlite_api.dart'; +import 'package:sqflite_common/sqlite_api.dart'; extension OnConflictStrategyExtensions on OnConflictStrategy { ConflictAlgorithm asSqfliteConflictAlgorithm() { diff --git a/floor/lib/src/migration.dart b/floor_common/lib/src/migration.dart similarity index 95% rename from floor/lib/src/migration.dart rename to floor_common/lib/src/migration.dart index 25d06da5..8eac3722 100644 --- a/floor/lib/src/migration.dart +++ b/floor_common/lib/src/migration.dart @@ -1,4 +1,4 @@ -import 'package:sqflite/sqflite.dart' as sqflite; +import 'package:sqflite_common/sqlite_api.dart' as sqflite; /// Base class for a database migration. /// diff --git a/floor/lib/src/util/constants.dart b/floor_common/lib/src/util/constants.dart similarity index 100% rename from floor/lib/src/util/constants.dart rename to floor_common/lib/src/util/constants.dart diff --git a/floor/lib/src/util/primary_key_helper.dart b/floor_common/lib/src/util/primary_key_helper.dart similarity index 100% rename from floor/lib/src/util/primary_key_helper.dart rename to floor_common/lib/src/util/primary_key_helper.dart diff --git a/floor/lib/src/util/string_utils.dart b/floor_common/lib/src/util/string_utils.dart similarity index 100% rename from floor/lib/src/util/string_utils.dart rename to floor_common/lib/src/util/string_utils.dart diff --git a/floor_common/pubspec.lock b/floor_common/pubspec.lock new file mode 100644 index 00000000..d772245d --- /dev/null +++ b/floor_common/pubspec.lock @@ -0,0 +1,627 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7" + url: "https://pub.dev" + source: hosted + version: "67.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d" + url: "https://pub.dev" + source: hosted + version: "6.4.1" + args: + dependency: transitive + description: + name: args + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + url: "https://pub.dev" + source: hosted + version: "2.4.2" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + build: + dependency: transitive + description: + name: build + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + build_config: + dependency: transitive + description: + name: build_config + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + url: "https://pub.dev" + source: hosted + version: "1.1.1" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1" + url: "https://pub.dev" + source: hosted + version: "4.0.1" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: "581bacf68f89ec8792f5e5a0b2c4decd1c948e97ce659dc783688c8a88fbec21" + url: "https://pub.dev" + source: hosted + version: "2.4.8" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: "4ae8ffe5ac758da294ecf1802f2aff01558d8b1b00616aa7538ea9a8a5d50799" + url: "https://pub.dev" + source: hosted + version: "7.3.0" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: fedde275e0a6b798c3296963c5cd224e3e1b55d0e478d5b7e65e6b540f363a0e + url: "https://pub.dev" + source: hosted + version: "8.9.1" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + charcode: + dependency: transitive + description: + name: charcode + sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306 + url: "https://pub.dev" + source: hosted + version: "1.3.1" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" + source: hosted + version: "2.0.3" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 + url: "https://pub.dev" + source: hosted + version: "4.10.0" + collection: + dependency: "direct dev" + description: + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" + source: hosted + version: "1.18.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + coverage: + dependency: transitive + description: + name: coverage + sha256: "8acabb8306b57a409bf4c83522065672ee13179297a6bb0cb9ead73948df7c76" + url: "https://pub.dev" + source: hosted + version: "1.7.2" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "99e066ce75c89d6b29903d788a7bb9369cf754f7b24bf70bf4b6d6d6b26853b9" + url: "https://pub.dev" + source: hosted + version: "2.3.6" + ffi: + dependency: transitive + description: + name: ffi + sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + file: + dependency: transitive + description: + name: file + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + floor_annotation: + dependency: "direct main" + description: + path: "../floor_annotation" + relative: true + source: path + version: "1.4.2" + floor_generator: + dependency: "direct dev" + description: + path: "../floor_generator" + relative: true + source: path + version: "1.4.2" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + graphs: + dependency: transitive + description: + name: graphs + sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 + url: "https://pub.dev" + source: hosted + version: "2.3.1" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + io: + dependency: transitive + description: + name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + url: "https://pub.dev" + source: hosted + version: "4.8.1" + lists: + dependency: transitive + description: + name: lists + sha256: "4ca5c19ae4350de036a7e996cdd1ee39c93ac0a2b840f4915459b7d0a7d4ab27" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + logging: + dependency: transitive + description: + name: logging + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + matcher: + dependency: "direct dev" + description: + name: matcher + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" + source: hosted + version: "0.12.16+1" + meta: + dependency: "direct main" + description: + name: meta + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + url: "https://pub.dev" + source: hosted + version: "1.11.0" + mime: + dependency: transitive + description: + name: mime + sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" + url: "https://pub.dev" + source: hosted + version: "1.0.5" + mockito: + dependency: "direct dev" + description: + name: mockito + sha256: "6841eed20a7befac0ce07df8116c8b8233ed1f4486a7647c7fc5a02ae6163917" + url: "https://pub.dev" + source: hosted + version: "5.4.4" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + path: + dependency: "direct main" + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 + url: "https://pub.dev" + source: hosted + version: "1.2.3" + shelf: + dependency: transitive + description: + name: shelf + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + url: "https://pub.dev" + source: hosted + version: "1.4.1" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e + url: "https://pub.dev" + source: hosted + version: "1.1.2" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" + url: "https://pub.dev" + source: hosted + version: "0.10.12" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + sqflite_common: + dependency: "direct main" + description: + name: sqflite_common + sha256: "3da423ce7baf868be70e2c0976c28a1bb2f73644268b7ffa7d2e08eab71f16a4" + url: "https://pub.dev" + source: hosted + version: "2.5.4" + sqflite_common_ffi: + dependency: "direct dev" + description: + name: sqflite_common_ffi + sha256: "4d6137c29e930d6e4a8ff373989dd9de7bac12e3bc87bce950f6e844e8ad3bb5" + url: "https://pub.dev" + source: hosted + version: "2.3.3" + sqlite3: + dependency: transitive + description: + name: sqlite3 + sha256: "072128763f1547e3e9b4735ce846bfd226d68019ccda54db4cd427b12dfdedc9" + url: "https://pub.dev" + source: hosted + version: "2.4.0" + sqlparser: + dependency: "direct main" + description: + name: sqlparser + sha256: "7b20045d1ccfb7bc1df7e8f9fee5ae58673fce6ff62cefbb0e0fd7214e90e5a0" + url: "https://pub.dev" + source: hosted + version: "0.34.1" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + strings: + dependency: transitive + description: + name: strings + sha256: b33f40c4dd3e597bf6d9e7f4f4dc282dad0f19b07d9f320cb5c2183859cbccf5 + url: "https://pub.dev" + source: hosted + version: "3.1.1" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558" + url: "https://pub.dev" + source: hosted + version: "3.1.0+1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test: + dependency: "direct dev" + description: + name: test + sha256: "7ee446762c2c50b3bd4ea96fe13ffac69919352bd3b4b17bac3f3465edc58073" + url: "https://pub.dev" + source: hosted + version: "1.25.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" + url: "https://pub.dev" + source: hosted + version: "0.7.0" + test_core: + dependency: transitive + description: + name: test_core + sha256: "2bc4b4ecddd75309300d8096f781c0e3280ca1ef85beda558d33fcbedc2eead4" + url: "https://pub.dev" + source: hosted + version: "0.6.0" + timing: + dependency: transitive + description: + name: timing + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + unicode: + dependency: transitive + description: + name: unicode + sha256: "0f69e46593d65245774d4f17125c6084d2c20b4e473a983f6e21b7d7762218f1" + url: "https://pub.dev" + source: hosted + version: "0.3.1" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: e7d5ecd604e499358c5fe35ee828c0298a320d54455e791e9dcf73486bc8d9f0 + url: "https://pub.dev" + source: hosted + version: "14.1.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + url: "https://pub.dev" + source: hosted + version: "0.5.1" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: "1d8e795e2a8b3730c41b8a98a2dff2e0fb57ae6f0764a1c46ec5915387d257b2" + url: "https://pub.dev" + source: hosted + version: "2.4.4" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" + source: hosted + version: "3.1.2" +sdks: + dart: ">=3.3.0 <4.0.0" diff --git a/floor_common/pubspec.yaml b/floor_common/pubspec.yaml new file mode 100644 index 00000000..d4a78d8c --- /dev/null +++ b/floor_common/pubspec.yaml @@ -0,0 +1,28 @@ +name: floor_common +description: > + The typesafe, reactive, and lightweight SQLite abstraction for your Flutter applications. + This library is the runtime dependency. +version: 1.2.0 +homepage: https://floor.codes +publish_to: none + +environment: + sdk: '>=3.2.6 <4.0.0' + +dependencies: + floor_annotation: + path: ../floor_annotation/ + meta: + path: ^1.9.0 + sqflite_common: ^2.5.3 + sqlparser: ^0.34.1 + +dev_dependencies: + build_runner: ^2.4.8 + collection: ^1.18.0 + floor_generator: + path: ../floor_generator/ + sqflite_common_ffi: ^2.3.2+1 + test: ^1.25.2 + matcher: ^0.12.16+1 + mockito: ^5.4.4 diff --git a/floor/test/adapter/deletion_adapter_test.dart b/floor_common/test/adapter/deletion_adapter_test.dart similarity index 97% rename from floor/test/adapter/deletion_adapter_test.dart rename to floor_common/test/adapter/deletion_adapter_test.dart index 306bf968..4c188c26 100644 --- a/floor/test/adapter/deletion_adapter_test.dart +++ b/floor_common/test/adapter/deletion_adapter_test.dart @@ -1,6 +1,6 @@ -import 'package:floor/src/adapter/deletion_adapter.dart'; -import 'package:flutter_test/flutter_test.dart'; +import 'package:floor_common/src/adapter/deletion_adapter.dart'; import 'package:mockito/mockito.dart'; +import 'package:test/test.dart'; import '../test_util/mocks.dart'; import '../test_util/person.dart'; diff --git a/floor/test/adapter/insertion_adapter_test.dart b/floor_common/test/adapter/insertion_adapter_test.dart similarity index 98% rename from floor/test/adapter/insertion_adapter_test.dart rename to floor_common/test/adapter/insertion_adapter_test.dart index a905ea2e..f8776d48 100644 --- a/floor/test/adapter/insertion_adapter_test.dart +++ b/floor_common/test/adapter/insertion_adapter_test.dart @@ -1,7 +1,7 @@ -import 'package:floor/floor.dart'; -import 'package:flutter_test/flutter_test.dart'; +import 'package:floor_common/floor_common.dart'; import 'package:mockito/mockito.dart'; -import 'package:sqflite/sqflite.dart'; +import 'package:sqflite_common/sqlite_api.dart'; +import 'package:test/test.dart'; import '../test_util/mocks.dart'; import '../test_util/person.dart'; diff --git a/floor/test/adapter/migration_adapter_test.dart b/floor_common/test/adapter/migration_adapter_test.dart similarity index 94% rename from floor/test/adapter/migration_adapter_test.dart rename to floor_common/test/adapter/migration_adapter_test.dart index 87f0d147..28cb0b9b 100644 --- a/floor/test/adapter/migration_adapter_test.dart +++ b/floor_common/test/adapter/migration_adapter_test.dart @@ -1,7 +1,7 @@ -import 'package:floor/src/adapter/migration_adapter.dart'; -import 'package:floor/src/migration.dart'; -import 'package:flutter_test/flutter_test.dart'; +import 'package:floor_common/src/adapter/migration_adapter.dart'; +import 'package:floor_common/src/migration.dart'; import 'package:mockito/mockito.dart'; +import 'package:test/test.dart'; import '../test_util/mocks.dart'; diff --git a/floor/test/adapter/query_adapter_test.dart b/floor_common/test/adapter/query_adapter_test.dart similarity index 99% rename from floor/test/adapter/query_adapter_test.dart rename to floor_common/test/adapter/query_adapter_test.dart index 063bf93b..566e5923 100644 --- a/floor/test/adapter/query_adapter_test.dart +++ b/floor_common/test/adapter/query_adapter_test.dart @@ -1,9 +1,8 @@ import 'dart:async'; -import 'package:floor/floor.dart'; -import 'package:floor/src/adapter/query_adapter.dart'; -import 'package:flutter_test/flutter_test.dart'; +import 'package:floor_common/src/adapter/query_adapter.dart'; import 'package:mockito/mockito.dart'; +import 'package:test/test.dart'; import '../test_util/mocks.dart'; import '../test_util/person.dart'; diff --git a/floor/test/adapter/update_adapter_test.dart b/floor_common/test/adapter/update_adapter_test.dart similarity index 97% rename from floor/test/adapter/update_adapter_test.dart rename to floor_common/test/adapter/update_adapter_test.dart index 963caa63..5a91f370 100644 --- a/floor/test/adapter/update_adapter_test.dart +++ b/floor_common/test/adapter/update_adapter_test.dart @@ -1,7 +1,7 @@ -import 'package:floor/floor.dart'; -import 'package:flutter_test/flutter_test.dart'; +import 'package:floor_common/floor_common.dart'; import 'package:mockito/mockito.dart'; -import 'package:sqflite/sqflite.dart'; +import 'package:sqflite_common/sqlite_api.dart'; +import 'package:test/test.dart'; import '../test_util/mocks.dart'; import '../test_util/person.dart'; diff --git a/floor/test/extension/on_conflict_strategy_extensions_test.dart b/floor_common/test/extension/on_conflict_strategy_extensions_test.dart similarity index 84% rename from floor/test/extension/on_conflict_strategy_extensions_test.dart rename to floor_common/test/extension/on_conflict_strategy_extensions_test.dart index bc1d945d..7183bbfb 100644 --- a/floor/test/extension/on_conflict_strategy_extensions_test.dart +++ b/floor_common/test/extension/on_conflict_strategy_extensions_test.dart @@ -1,7 +1,7 @@ -import 'package:floor/floor.dart'; -import 'package:floor/src/extension/on_conflict_strategy_extensions.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:sqflite/sqflite.dart'; +import 'package:floor_common/floor_common.dart'; +import 'package:floor_common/src/extension/on_conflict_strategy_extensions.dart'; +import 'package:sqflite_common/sqlite_api.dart'; +import 'package:test/test.dart'; void main() { group('asSqfliteConflictAlgorithm', () { diff --git a/floor/test/integration/autoincrement/autoinc_test.dart b/floor_common/test/integration/autoincrement/autoinc_test.dart similarity index 90% rename from floor/test/integration/autoincrement/autoinc_test.dart rename to floor_common/test/integration/autoincrement/autoinc_test.dart index 91d5cf7e..6d90351a 100644 --- a/floor/test/integration/autoincrement/autoinc_test.dart +++ b/floor_common/test/integration/autoincrement/autoinc_test.dart @@ -1,8 +1,10 @@ import 'dart:async'; -import 'package:floor/floor.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:sqflite/sqflite.dart' as sqflite; +import 'package:floor_common/floor_common.dart'; +import 'package:sqflite_common/sqlite_api.dart' as sqflite; +import 'package:test/test.dart'; + +import '../../test_util/database_factory.dart'; part 'autoinc_test.g.dart'; diff --git a/floor/test/integration/blob/blob_test.dart b/floor_common/test/integration/blob/blob_test.dart similarity index 89% rename from floor/test/integration/blob/blob_test.dart rename to floor_common/test/integration/blob/blob_test.dart index c332eb18..9ac9f7f3 100644 --- a/floor/test/integration/blob/blob_test.dart +++ b/floor_common/test/integration/blob/blob_test.dart @@ -2,9 +2,11 @@ import 'dart:async'; import 'dart:typed_data'; import 'package:collection/collection.dart'; -import 'package:floor/floor.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:sqflite/sqflite.dart' as sqflite; +import 'package:floor_common/floor_common.dart'; +import 'package:sqflite_common/sqlite_api.dart' as sqflite; +import 'package:test/test.dart'; + +import '../../test_util/database_factory.dart'; part 'blob_test.g.dart'; diff --git a/floor/test/integration/boolean_conversions/bool_test.dart b/floor_common/test/integration/boolean_conversions/bool_test.dart similarity index 93% rename from floor/test/integration/boolean_conversions/bool_test.dart rename to floor_common/test/integration/boolean_conversions/bool_test.dart index 5e478207..63daa368 100644 --- a/floor/test/integration/boolean_conversions/bool_test.dart +++ b/floor_common/test/integration/boolean_conversions/bool_test.dart @@ -1,8 +1,10 @@ import 'dart:async'; -import 'package:floor/floor.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:sqflite/sqflite.dart' as sqflite; +import 'package:floor_common/floor_common.dart'; +import 'package:sqflite_common/sqlite_api.dart' as sqflite; +import 'package:test/test.dart'; + +import '../../test_util/database_factory.dart'; part 'bool_test.g.dart'; diff --git a/floor/test/integration/dao/dog_dao.dart b/floor_common/test/integration/dao/dog_dao.dart similarity index 84% rename from floor/test/integration/dao/dog_dao.dart rename to floor_common/test/integration/dao/dog_dao.dart index c1eb8250..6a658207 100644 --- a/floor/test/integration/dao/dog_dao.dart +++ b/floor_common/test/integration/dao/dog_dao.dart @@ -1,4 +1,4 @@ -import 'package:floor/floor.dart'; +import 'package:floor_common/floor_common.dart'; import '../model/dog.dart'; diff --git a/floor/test/integration/dao/name_dao.dart b/floor_common/test/integration/dao/name_dao.dart similarity index 94% rename from floor/test/integration/dao/name_dao.dart rename to floor_common/test/integration/dao/name_dao.dart index 16491d05..318ef10d 100644 --- a/floor/test/integration/dao/name_dao.dart +++ b/floor_common/test/integration/dao/name_dao.dart @@ -1,4 +1,4 @@ -import 'package:floor/floor.dart'; +import 'package:floor_common/floor_common.dart'; import '../model/mutliline_name.dart'; import '../model/name.dart'; diff --git a/floor/test/integration/dao/person_dao.dart b/floor_common/test/integration/dao/person_dao.dart similarity index 98% rename from floor/test/integration/dao/person_dao.dart rename to floor_common/test/integration/dao/person_dao.dart index 89373073..80ff508a 100644 --- a/floor/test/integration/dao/person_dao.dart +++ b/floor_common/test/integration/dao/person_dao.dart @@ -1,4 +1,4 @@ -import 'package:floor/floor.dart'; +import 'package:floor_common/floor_common.dart'; import '../model/dog.dart'; import '../model/person.dart'; diff --git a/floor/test/integration/database.dart b/floor_common/test/integration/database.dart similarity index 66% rename from floor/test/integration/database.dart rename to floor_common/test/integration/database.dart index 58335e3d..5b73f708 100644 --- a/floor/test/integration/database.dart +++ b/floor_common/test/integration/database.dart @@ -1,8 +1,9 @@ import 'dart:async'; -import 'package:floor/floor.dart'; -import 'package:sqflite/sqlite_api.dart' as sqflite; +import 'package:floor_common/floor_common.dart'; +import 'package:sqflite_common/sqlite_api.dart' as sqflite; +import '../test_util/database_factory.dart'; import 'dao/dog_dao.dart'; import 'dao/person_dao.dart'; import 'model/dog.dart'; diff --git a/floor/test/integration/database_test.dart b/floor_common/test/integration/database_test.dart similarity index 99% rename from floor/test/integration/database_test.dart rename to floor_common/test/integration/database_test.dart index f4d94f1e..28dfe5cc 100644 --- a/floor/test/integration/database_test.dart +++ b/floor_common/test/integration/database_test.dart @@ -1,6 +1,6 @@ -import 'package:floor/floor.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:sqflite/sqflite.dart'; +import 'package:floor_common/floor_common.dart'; +import 'package:sqflite_common/sqlite_api.dart'; +import 'package:test/test.dart'; import '../test_util/extensions.dart'; import 'dao/dog_dao.dart'; diff --git a/floor/test/integration/fts/mail.dart b/floor_common/test/integration/fts/mail.dart similarity index 92% rename from floor/test/integration/fts/mail.dart rename to floor_common/test/integration/fts/mail.dart index 8a3fafe3..d7d5fe67 100644 --- a/floor/test/integration/fts/mail.dart +++ b/floor_common/test/integration/fts/mail.dart @@ -1,4 +1,4 @@ -import 'package:floor/floor.dart'; +import 'package:floor_common/floor_common.dart'; @Entity( tableName: 'mail', diff --git a/floor/test/integration/fts/mail_dao.dart b/floor_common/test/integration/fts/mail_dao.dart similarity index 93% rename from floor/test/integration/fts/mail_dao.dart rename to floor_common/test/integration/fts/mail_dao.dart index df1b7311..3ffce0e1 100644 --- a/floor/test/integration/fts/mail_dao.dart +++ b/floor_common/test/integration/fts/mail_dao.dart @@ -1,4 +1,4 @@ -import 'package:floor/floor.dart'; +import 'package:floor_common/floor_common.dart'; import 'mail.dart'; diff --git a/floor/test/integration/fts/mail_database.dart b/floor_common/test/integration/fts/mail_database.dart similarity index 57% rename from floor/test/integration/fts/mail_database.dart rename to floor_common/test/integration/fts/mail_database.dart index 4881f33e..631ad9fc 100644 --- a/floor/test/integration/fts/mail_database.dart +++ b/floor_common/test/integration/fts/mail_database.dart @@ -1,8 +1,9 @@ import 'dart:async'; -import 'package:floor/floor.dart'; -import 'package:sqflite/sqflite.dart' as sqflite; +import 'package:floor_common/floor_common.dart'; +import 'package:sqflite_common/sqlite_api.dart' as sqflite; +import '../../test_util/database_factory.dart'; import 'mail.dart'; import 'mail_dao.dart'; diff --git a/floor/test/integration/fts/mail_database_test.dart b/floor_common/test/integration/fts/mail_database_test.dart similarity index 98% rename from floor/test/integration/fts/mail_database_test.dart rename to floor_common/test/integration/fts/mail_database_test.dart index 9979cb04..c74b105b 100644 --- a/floor/test/integration/fts/mail_database_test.dart +++ b/floor_common/test/integration/fts/mail_database_test.dart @@ -1,4 +1,4 @@ -import 'package:flutter_test/flutter_test.dart'; +import 'package:test/test.dart'; import 'mail.dart'; import 'mail_dao.dart'; diff --git a/floor/test/integration/inheritance/dao_inheritance_test.dart b/floor_common/test/integration/inheritance/dao_inheritance_test.dart similarity index 88% rename from floor/test/integration/inheritance/dao_inheritance_test.dart rename to floor_common/test/integration/inheritance/dao_inheritance_test.dart index 2e13411d..e2d2c087 100644 --- a/floor/test/integration/inheritance/dao_inheritance_test.dart +++ b/floor_common/test/integration/inheritance/dao_inheritance_test.dart @@ -1,8 +1,10 @@ import 'dart:async'; -import 'package:floor/floor.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:sqflite/sqflite.dart' as sqflite; +import 'package:floor_common/floor_common.dart'; +import 'package:test/test.dart'; +import 'package:sqflite_common/sqlite_api.dart' as sqflite; + +import '../../test_util/database_factory.dart'; part 'dao_inheritance_test.g.dart'; diff --git a/floor/test/integration/inheritance/entity_inheritance_test.dart b/floor_common/test/integration/inheritance/entity_inheritance_test.dart similarity index 92% rename from floor/test/integration/inheritance/entity_inheritance_test.dart rename to floor_common/test/integration/inheritance/entity_inheritance_test.dart index c32162d8..9fd74438 100644 --- a/floor/test/integration/inheritance/entity_inheritance_test.dart +++ b/floor_common/test/integration/inheritance/entity_inheritance_test.dart @@ -1,8 +1,10 @@ import 'dart:async'; -import 'package:floor/floor.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:sqflite/sqflite.dart' as sqflite; +import 'package:floor_common/floor_common.dart'; +import 'package:sqflite_common/sqlite_api.dart' as sqflite; +import 'package:test/test.dart'; + +import '../../test_util/database_factory.dart'; part 'entity_inheritance_test.g.dart'; diff --git a/floor/test/integration/model/dog.dart b/floor_common/test/integration/model/dog.dart similarity index 95% rename from floor/test/integration/model/dog.dart rename to floor_common/test/integration/model/dog.dart index 2e2ff55b..cca83378 100644 --- a/floor/test/integration/model/dog.dart +++ b/floor_common/test/integration/model/dog.dart @@ -1,4 +1,4 @@ -import 'package:floor/floor.dart'; +import 'package:floor_common/floor_common.dart'; import 'person.dart'; diff --git a/floor/test/integration/model/mutliline_name.dart b/floor_common/test/integration/model/mutliline_name.dart similarity index 91% rename from floor/test/integration/model/mutliline_name.dart rename to floor_common/test/integration/model/mutliline_name.dart index f8954afe..b0d05817 100644 --- a/floor/test/integration/model/mutliline_name.dart +++ b/floor_common/test/integration/model/mutliline_name.dart @@ -1,4 +1,4 @@ -import 'package:floor/floor.dart'; +import 'package:floor_common/floor_common.dart'; @DatabaseView( ''' diff --git a/floor/test/integration/model/name.dart b/floor_common/test/integration/model/name.dart similarity index 90% rename from floor/test/integration/model/name.dart rename to floor_common/test/integration/model/name.dart index a465cb40..20006b9b 100644 --- a/floor/test/integration/model/name.dart +++ b/floor_common/test/integration/model/name.dart @@ -1,4 +1,4 @@ -import 'package:floor/floor.dart'; +import 'package:floor_common/floor_common.dart'; @DatabaseView( 'SELECT custom_name as name FROM person UNION SELECT name from dog', diff --git a/floor/test/integration/model/person.dart b/floor_common/test/integration/model/person.dart similarity index 92% rename from floor/test/integration/model/person.dart rename to floor_common/test/integration/model/person.dart index 5bdafe89..bfc9995d 100644 --- a/floor/test/integration/model/person.dart +++ b/floor_common/test/integration/model/person.dart @@ -1,4 +1,4 @@ -import 'package:floor/floor.dart'; +import 'package:floor_common/floor_common.dart'; @Entity( tableName: 'person', diff --git a/floor/test/integration/stream_query_test.dart b/floor_common/test/integration/stream_query_test.dart similarity index 99% rename from floor/test/integration/stream_query_test.dart rename to floor_common/test/integration/stream_query_test.dart index bb4f39b7..61a5813b 100644 --- a/floor/test/integration/stream_query_test.dart +++ b/floor_common/test/integration/stream_query_test.dart @@ -1,4 +1,4 @@ -import 'package:flutter_test/flutter_test.dart'; +import 'package:test/test.dart'; import '../test_util/extensions.dart'; import 'dao/person_dao.dart'; diff --git a/floor/test/integration/type_converter/order.dart b/floor_common/test/integration/type_converter/order.dart similarity index 90% rename from floor/test/integration/type_converter/order.dart rename to floor_common/test/integration/type_converter/order.dart index f5a9bdb8..5eec43a3 100644 --- a/floor/test/integration/type_converter/order.dart +++ b/floor_common/test/integration/type_converter/order.dart @@ -1,4 +1,4 @@ -import 'package:floor/floor.dart'; +import 'package:floor_common/floor_common.dart'; @entity class Order { diff --git a/floor/test/integration/type_converter/order_dao.dart b/floor_common/test/integration/type_converter/order_dao.dart similarity index 87% rename from floor/test/integration/type_converter/order_dao.dart rename to floor_common/test/integration/type_converter/order_dao.dart index 3a183874..d004afd2 100644 --- a/floor/test/integration/type_converter/order_dao.dart +++ b/floor_common/test/integration/type_converter/order_dao.dart @@ -1,4 +1,4 @@ -import 'package:floor/floor.dart'; +import 'package:floor_common/floor_common.dart'; import 'order.dart'; diff --git a/floor/test/integration/type_converter/order_database.dart b/floor_common/test/integration/type_converter/order_database.dart similarity index 64% rename from floor/test/integration/type_converter/order_database.dart rename to floor_common/test/integration/type_converter/order_database.dart index eedc7201..5cdfd1c3 100644 --- a/floor/test/integration/type_converter/order_database.dart +++ b/floor_common/test/integration/type_converter/order_database.dart @@ -1,8 +1,9 @@ import 'dart:async'; -import 'package:floor/floor.dart'; -import 'package:sqflite/sqflite.dart' as sqflite; +import 'package:floor_common/floor_common.dart'; +import 'package:sqflite_common/sqlite_api.dart' as sqflite; +import '../../test_util/database_factory.dart'; import 'order.dart'; import 'order_dao.dart'; import 'type_converter.dart'; diff --git a/floor/test/integration/type_converter/type_converter.dart b/floor_common/test/integration/type_converter/type_converter.dart similarity index 84% rename from floor/test/integration/type_converter/type_converter.dart rename to floor_common/test/integration/type_converter/type_converter.dart index e66e614a..a4867a17 100644 --- a/floor/test/integration/type_converter/type_converter.dart +++ b/floor_common/test/integration/type_converter/type_converter.dart @@ -1,4 +1,4 @@ -import 'package:floor/floor.dart'; +import 'package:floor_common/floor_common.dart'; class DateTimeConverter extends TypeConverter { @override diff --git a/floor/test/integration/type_converter/type_converter_database_test.dart b/floor_common/test/integration/type_converter/type_converter_database_test.dart similarity index 95% rename from floor/test/integration/type_converter/type_converter_database_test.dart rename to floor_common/test/integration/type_converter/type_converter_database_test.dart index 5a0ccc5e..b6199988 100644 --- a/floor/test/integration/type_converter/type_converter_database_test.dart +++ b/floor_common/test/integration/type_converter/type_converter_database_test.dart @@ -1,4 +1,4 @@ -import 'package:flutter_test/flutter_test.dart'; +import 'package:test/test.dart'; import 'order.dart'; import 'order_dao.dart'; diff --git a/floor/test/integration/type_converter/type_converter_test.dart b/floor_common/test/integration/type_converter/type_converter_test.dart similarity index 92% rename from floor/test/integration/type_converter/type_converter_test.dart rename to floor_common/test/integration/type_converter/type_converter_test.dart index c19d4168..0da29dfa 100644 --- a/floor/test/integration/type_converter/type_converter_test.dart +++ b/floor_common/test/integration/type_converter/type_converter_test.dart @@ -1,4 +1,4 @@ -import 'package:flutter_test/flutter_test.dart'; +import 'package:test/test.dart'; import 'type_converter.dart'; diff --git a/floor/test/integration/view/view_test.dart b/floor_common/test/integration/view/view_test.dart similarity index 95% rename from floor/test/integration/view/view_test.dart rename to floor_common/test/integration/view/view_test.dart index 997bb1b0..a1f0c96f 100644 --- a/floor/test/integration/view/view_test.dart +++ b/floor_common/test/integration/view/view_test.dart @@ -1,9 +1,10 @@ import 'dart:async'; -import 'package:floor/floor.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:sqflite/sqflite.dart' as sqflite; +import 'package:floor_common/floor_common.dart'; +import 'package:sqflite_common/sqlite_api.dart' as sqflite; +import 'package:test/test.dart'; +import '../../test_util/database_factory.dart'; import '../dao/dog_dao.dart'; import '../dao/name_dao.dart'; import '../dao/person_dao.dart'; diff --git a/floor_common/test/test_util/database_factory.dart b/floor_common/test/test_util/database_factory.dart new file mode 100644 index 00000000..7f4ee9c1 --- /dev/null +++ b/floor_common/test/test_util/database_factory.dart @@ -0,0 +1,16 @@ +import 'package:path/path.dart'; +import 'package:sqflite_common/sqlite_api.dart'; +import 'package:sqflite_common_ffi/sqflite_ffi.dart'; + +// infers factory as nullable without explicit type definition +final DatabaseFactory sqfliteDatabaseFactory = () { + sqfliteFfiInit(); + return databaseFactoryFfi; +}(); + +extension DatabaseFactoryExtension on DatabaseFactory { + Future getDatabasePath(final String name) async { + final databasesPath = await this.getDatabasesPath(); + return join(databasesPath, name); + } +} \ No newline at end of file diff --git a/floor/test/test_util/extensions.dart b/floor_common/test/test_util/extensions.dart similarity index 100% rename from floor/test/test_util/extensions.dart rename to floor_common/test/test_util/extensions.dart diff --git a/floor/test/test_util/mocks.dart b/floor_common/test/test_util/mocks.dart similarity index 100% rename from floor/test/test_util/mocks.dart rename to floor_common/test/test_util/mocks.dart diff --git a/floor/test/test_util/person.dart b/floor_common/test/test_util/person.dart similarity index 100% rename from floor/test/test_util/person.dart rename to floor_common/test/test_util/person.dart diff --git a/floor/test/util/primary_key_helper_test.dart b/floor_common/test/util/primary_key_helper_test.dart similarity index 94% rename from floor/test/util/primary_key_helper_test.dart rename to floor_common/test/util/primary_key_helper_test.dart index ac4c1707..3f8ff72a 100644 --- a/floor/test/util/primary_key_helper_test.dart +++ b/floor_common/test/util/primary_key_helper_test.dart @@ -1,5 +1,5 @@ -import 'package:floor/src/util/primary_key_helper.dart'; -import 'package:flutter_test/flutter_test.dart'; +import 'package:floor_common/src/util/primary_key_helper.dart'; +import 'package:test/test.dart'; void main() { group('Primary key WHERE clause', () { diff --git a/floor_ffi/.metadata b/floor_ffi/.metadata new file mode 100644 index 00000000..2ec1df35 --- /dev/null +++ b/floor_ffi/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: 5391447fae6209bb21a89e6a5a6583cac1af9b4b + channel: beta + +project_type: package diff --git a/floor_ffi/CHANGELOG.md b/floor_ffi/CHANGELOG.md new file mode 100644 index 00000000..cf125525 --- /dev/null +++ b/floor_ffi/CHANGELOG.md @@ -0,0 +1,344 @@ +# Changelog + +## 1.2.0 + +### Changes + +* Improve escaping by using library + +### 🐛 Bug Fixes + +* Bugfix/nullable transaction return + +### 🛠 Maintenance + +* Update dependencies + +## 1.1.0 + +All credits for this release go to mqus. + +### Changes + +* Update deps +* Increase test coverage +* Bump locked floor_generator version to 1.0.1 + +### 🚀 Features + +* Add onConfigure callback + +### 🐛 Bug Fixes + +* Retain index ordering + +## 1.0.1 + +### Changes + +* Bump mockito to 5.0.3 +* Update dependencies to null-safe versions + +### 🚀 Features + +* Improved Parameter mapping for query methods + +## 1.0.0 + +### Changes + +* Use stable Dart 2.12.0 + +### 🚀 Features + +* Make floor null-safe + +## 0.19.1 + +### Changes + +* Remove floor example to pass static analysis + +## 0.19.0 + +### Changes + +* Update website theme +* Update license with all authors +* Fix getting started syntax highlighting +* Improve FTS documentation +* Introduce tab navigation to website +* Fix typo in doc title +* Improve website +* Slim down README +* Create MkDocs website +* Add isolates section to README +* Run CI only on pushes to develop +* Use GitHub Discussions for ideas and feedback +* Add example to floor package + +### 🚀 Features + +* Add Full-text Search support + +### 🐛 Bug Fixes + +* Fix desktop database path retrieval + +## 0.18.0 + +* Documentation update on DateTimeConverter sample +* Change ForeignKeyAction to enum in the generator +* Add primary key auto increment test + +### 🚀 Features + +* Add support for WITH statements for DatabaseViews + +### 🐛 Bug Fixes + +* More tolerant query with list parameter parsing + +## 0.17.0 + +### 🐛 Bug Fixes + +* Generate distinct type converter instances +* Fix generation of DAO method with list argument using type converters + +## 0.16.0 + +### 🚀 Features + +* Add **experimental** support for type converters + +## 0.15.0 + +### Changes + +* Update dependencies + +### 🚀 Features + +* Add support for WITHOUT ROWID tables +* Check transaction method return types and allow non-void returns + +## 0.14.0 + +### Changes + +* Document entity inheritance and add integration test +* Raise minimum sqflite version to 1.3.0 +* add integration test for transaction rollback +* Mention missing null propagation in streams +* Fix types (integer instead of real) + +## 0.13.0 + +### ⚠️ Breaking Changes + +**You need to migrate the explicit usages of `OnConflictStrategy` and `ForeignKeyAction` from snake +case to camel case.** + +* Apply camel case to constants + +### Changes + +* Mention SQL centricity of Floor in README +* Add banner to README +* Update the description of the library +* Migrate OnConflictStrategy to enum +* Add more precise limitations of entity class and streams to README +* Add DAO inheritance example to README +* Fix database and DAO usage example in the README +* Update README.md +* Assert example app's behavior +* Mention that floor uses first constructor found in entity class +* Remove snapshot version instructions from README + +### 🚀 Features + +* Support Linux, macOS, Windows +* Implement simple Streams on DatabaseViews, fix multi-dao changelistener + +### 🐛 Bug Fixes + +* Await database path retrieval +* Fix boolean conversion issues, add regression test, fix indentation +* Fix wrongly parsed arguments in @Query + +## 0.12.0 + +### Changes + +* Ignore Getters&Setters +* Use Flutter bundled pub to get and upgrade project dependencies +* Generate database implementation on every CI run +* Throw exception when querying for unsupported type +* Add generated code for example app +* Add workflow scripts +* Run real database tests on development machine and CI + +### 🚀 Features + +* Support ByteArrays/Blobs +* Support inherited fields for entities and views +* Support database views +* Support inherited DAO methods +* Support asynchronous migrations + +### 🐛 Bug Fixes + +* Fix failing SQLite installation process on CI +* Fix failing stream query test + +## 0.11.0 + +### Changes + +* Refactor string utility function into extension function +* Refactor annotation check functions to use extension functions +* Refactor type check functions to use extension functions + +### 🚀 Features + +* Ignore fields of entities by adding ignore annotation +* Handle named constructor parameters and ignore field order +* Exclude static fields from entity mapping + +## 0.10.0 + +### Changes + +* Update dependencies +* Update README with correct instructions to initialize in memory database + +### 🐛 Bug Fixes + +* Make in-memory database actually be just in memory + +## 0.9.0 + +### 🐛 Bug Fixes + +* Make IN clauses work with strings +* Fix foreign key action string representation + +## 0.8.0 + +### Changes + +* Update README with clear package import instructions + +### 🚀 Features + +* Introduce static 'to map' functions +* Add optional callback functions when opening database + +### 🐛 Bug Fixes + +* Allow int and string (composite) primary keys + +## 0.7.0 + +### 🐛 Bug Fixes + +* Retain reactivity when using transactions + +## 0.6.0 + +### 🚀 Features + +* Add support for IN clauses in query statements +* Enable compound primary keys + +## 0.5.0 + +### Changes + +* Make tasks deletable in example app + +### 🚀 Features + +* Allow multiline string queries +* Allow void-return queries with arguments + +## 0.4.2 + +### 🐛 Bug Fixes + +* Fix query parameter substitution regex + +## 0.4.0 + +### Changes + +* Enable coverage report +* Simplify type assertions and add tests + +### 🚀 Features + +* Allow more convenient database initialization + +### 🐛 Bug Fixes + +* Use query argument binding instead of manual binding + +## 0.3.0 + +### Changes + +* Use TypeChecker for all annotations +* Add publishing instructions +* Remove unused annotation names +* Simplify the mapping from an entity to a map +* Fix database writer test +* Make stream emit query result on subscription +* Update example to use StreamBuilder +* Update README + +### 🐛 Bug Fixes + +* Correct mapper instance name referenced by generated query methods +* Fix adapter instances naming + +## 0.2.0 + +### Changes + +* Add database adapters +* Run floor Flutter tests +* Move value objects to value_objects directory +* Map source elements into value objects in processors +* Use GeneratorForAnnotation and TypeChecker to verify annotations +* Throw more specific errors on obfuscated database annotation + +### 🚀 Features + +* Add support for migrations +* Add support for returning Streams as query result +* Support accessing data from Data Access Objects +* Add entity classes to database annotation +* Add support for indices + +## 0.1.0 + +### 🚀 Features + +* Support conflict strategies when inserting and updating records +* Add support for running queries that return void +* Add support for foreign keys +* Add parameter verification for query methods +* Return deleted row count on delete +* Return updated rows count on update +* Return ID/s of inserted item/s +* Add support for transactions +* Add support for changing (insert, update, delete) lists +* Support custom entity name +* Enable NOT NULL columns +* Enable custom column name mapping +* Add delete methods code generation and fix update methods +* Add update methods code generation +* Add insert methods code generation +* Add code generator for query methods +* Code generation for database creation diff --git a/floor_ffi/LICENSE b/floor_ffi/LICENSE new file mode 100644 index 00000000..dd5b3a58 --- /dev/null +++ b/floor_ffi/LICENSE @@ -0,0 +1,174 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. diff --git a/floor_ffi/lib/floor_ffi.dart b/floor_ffi/lib/floor_ffi.dart new file mode 100644 index 00000000..9d108537 --- /dev/null +++ b/floor_ffi/lib/floor_ffi.dart @@ -0,0 +1,2 @@ +export 'package:floor_common/floor_common.dart'; +export 'package:floor_ffi/src/sqflite_database_factory.dart'; diff --git a/floor_ffi/lib/src/sqflite_database_factory.dart b/floor_ffi/lib/src/sqflite_database_factory.dart new file mode 100644 index 00000000..431afd6a --- /dev/null +++ b/floor_ffi/lib/src/sqflite_database_factory.dart @@ -0,0 +1,8 @@ +import 'package:sqflite_common/sqlite_api.dart'; +import 'package:sqflite_common_ffi/sqflite_ffi.dart'; + +// infers factory as nullable without explicit type definition +final DatabaseFactory sqfliteDatabaseFactory = () { + sqfliteFfiInit(); + return databaseFactoryFfi; +}(); diff --git a/floor_ffi/pubspec.lock b/floor_ffi/pubspec.lock new file mode 100644 index 00000000..2afe3734 --- /dev/null +++ b/floor_ffi/pubspec.lock @@ -0,0 +1,123 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + charcode: + dependency: transitive + description: + name: charcode + sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306 + url: "https://pub.dev" + source: hosted + version: "1.3.1" + collection: + dependency: transitive + description: + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" + source: hosted + version: "1.18.0" + ffi: + dependency: transitive + description: + name: ffi + sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + floor_annotation: + dependency: "direct main" + description: + path: "../floor_annotation" + relative: true + source: path + version: "1.4.2" + floor_common: + dependency: "direct main" + description: + path: "../floor_common" + relative: true + source: path + version: "1.2.0" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + meta: + dependency: "direct main" + description: + name: meta + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + url: "https://pub.dev" + source: hosted + version: "1.11.0" + path: + dependency: "direct main" + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + sha256: "28d8c66baee4968519fb8bd6cdbedad982d6e53359091f0b74544a9f32ec72d5" + url: "https://pub.dev" + source: hosted + version: "2.5.3" + sqflite_common_ffi: + dependency: "direct main" + description: + name: sqflite_common_ffi + sha256: "754927d82de369a6b9e760fb60640aa81da650f35ffd468d5a992814d6022908" + url: "https://pub.dev" + source: hosted + version: "2.3.2+1" + sqlite3: + dependency: transitive + description: + name: sqlite3 + sha256: "072128763f1547e3e9b4735ce846bfd226d68019ccda54db4cd427b12dfdedc9" + url: "https://pub.dev" + source: hosted + version: "2.4.0" + sqlparser: + dependency: transitive + description: + name: sqlparser + sha256: "7b20045d1ccfb7bc1df7e8f9fee5ae58673fce6ff62cefbb0e0fd7214e90e5a0" + url: "https://pub.dev" + source: hosted + version: "0.34.1" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: "271977ff1e9e82ceefb4f08424b8839f577c1852e0726b5ce855311b46d3ef83" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" +sdks: + dart: ">=3.3.0-279.1.beta <4.0.0" diff --git a/floor_ffi/pubspec.yaml b/floor_ffi/pubspec.yaml new file mode 100644 index 00000000..50d36991 --- /dev/null +++ b/floor_ffi/pubspec.yaml @@ -0,0 +1,19 @@ +name: floor_ffi +description: > + The typesafe, reactive, and lightweight SQLite abstraction for your Flutter applications. + This library is the runtime dependency. +version: 1.2.0 +homepage: https://floor.codes +publish_to: none + +environment: + sdk: '>=3.2.6 <4.0.0' + +dependencies: + floor_annotation: + path: ../floor_annotation/ + floor_common: + path: ../floor_common/ + meta: + path: ^1.9.0 + sqflite_common_ffi: ^2.3.2+1 diff --git a/tool/generate_test_database.sh b/tool/generate_test_database.sh index b79e978b..82efa5cb 100644 --- a/tool/generate_test_database.sh +++ b/tool/generate_test_database.sh @@ -1,4 +1,4 @@ #!/bin/bash -cd ../floor +cd ../floor_common flutter packages pub run build_runner build --delete-conflicting-outputs diff --git a/tool/upgrade.sh b/tool/upgrade.sh index 38e4ebb2..c9f9edd7 100644 --- a/tool/upgrade.sh +++ b/tool/upgrade.sh @@ -6,6 +6,10 @@ cd floor flutter packages pub upgrade cd .. +cd floor_common +flutter packages pub upgrade +cd .. + cd floor_annotation flutter packages pub upgrade cd ..