mirror of https://github.com/AMT-Cheif/drift.git
Use melos to manage packages (#2060)
This commit is contained in:
parent
24316c80a6
commit
8e9e7fc291
|
@ -67,7 +67,8 @@ jobs:
|
|||
echo "LD_LIBRARY_PATH=/tmp/sqlite/out" >> $GITHUB_ENV
|
||||
- name: Check sqlite3 version
|
||||
run: sqlite3 --version
|
||||
- run: dart pub upgrade
|
||||
- run: dart pub global activate melos && melos bootstrap --scope drift_docs
|
||||
working-directory: .
|
||||
- run: dart run build_runner build
|
||||
- run: dart test
|
||||
|
||||
|
@ -94,7 +95,8 @@ jobs:
|
|||
echo "LD_LIBRARY_PATH=/tmp/sqlite/out" >> $GITHUB_ENV
|
||||
- name: Check sqlite3 version
|
||||
run: sqlite3 --version
|
||||
- run: dart pub upgrade
|
||||
- run: dart pub global activate melos && melos bootstrap --scope drift
|
||||
working-directory: .
|
||||
- name: Get dependencies for plugin
|
||||
run: |
|
||||
echo "dependency_overrides:" >> pubspec_overrides.yaml
|
||||
|
@ -128,7 +130,8 @@ jobs:
|
|||
# setup
|
||||
- uses: actions/checkout@v2
|
||||
- uses: dart-lang/setup-dart@v1
|
||||
- run: dart pub upgrade
|
||||
- run: dart pub global activate melos && melos bootstrap --scope drift_dev
|
||||
working-directory: .
|
||||
# analysis
|
||||
- run: dart format -o none --set-exit-if-changed .
|
||||
name: dartfmt
|
||||
|
@ -202,6 +205,8 @@ jobs:
|
|||
chmod a+x /tmp/sqlite/out/sqlite3
|
||||
echo "/tmp/sqlite/out" >> $GITHUB_PATH
|
||||
echo "LD_LIBRARY_PATH=/tmp/sqlite/out" >> $GITHUB_ENV
|
||||
- run: dart pub global activate melos && melos bootstrap --no-flutter
|
||||
working-directory: .
|
||||
- run: tool/misc_integration_test.sh
|
||||
|
||||
# upload_coverage:
|
||||
|
|
|
@ -18,3 +18,4 @@ flutter_export_environment.sh
|
|||
docs/**/*.g.dart
|
||||
|
||||
*/build/
|
||||
**/pubspec_overrides.yaml
|
||||
|
|
13
README.md
13
README.md
|
@ -4,6 +4,7 @@ _Note: Moor has been renamed to drift_
|
|||
|
||||
[![Build Status](https://api.cirrus-ci.com/github/simolus3/moor.svg)](https://github.com/simolus3/drift/actions/workflows/main.yml/badge.svg)
|
||||
[![Chat on Gitter](https://img.shields.io/gitter/room/moor-dart/community)](https://gitter.im/moor-dart/community)
|
||||
[![Using melos](https://img.shields.io/badge/maintained%20with-melos-f700ff.svg?style=flat-square)](https://github.com/invertase/melos)
|
||||
|
||||
## Proudly Sponsored by [Stream 💙](https://getstream.io/chat/sdk/android/?utm_source=Moor&utm_medium=Github_Repo_Content_Ad&utm_content=Developer&utm_campaign=Moor_July2022_AndroidChatSDK_klmh22)
|
||||
|
||||
|
@ -52,9 +53,10 @@ If you have any questions, feedback or ideas, feel free to [create an
|
|||
issue](https://github.com/simolus3/drift/issues/new). If you enjoy this
|
||||
project, I'd appreciate your [🌟 on GitHub](https://github.com/simolus3/drift/).
|
||||
|
||||
-----
|
||||
## Working on this project
|
||||
|
||||
Important packages in this repo:
|
||||
This repository contains a number of packages making up the drift project, most
|
||||
notably:
|
||||
|
||||
- `drift`: The main runtime for drift, which provides most apis
|
||||
- `drift_dev`: The compiler for drift tables, databases and daos. It
|
||||
|
@ -62,3 +64,10 @@ Important packages in this repo:
|
|||
- `sqlparser`: A sql parser and static analyzer, written in pure Dart. This package can be used without drift to perform analysis on sql statements.
|
||||
It's on pub at
|
||||
[![sqlparser](https://img.shields.io/pub/v/sqlparser.svg)](https://pub.dev/packages/sqlparser)
|
||||
|
||||
We use [melos](https://melos.invertase.dev/) to manage the different packages
|
||||
in this repository.
|
||||
|
||||
You can install it with `dart pub global activate melos`. If your Dart SDK was
|
||||
installed as part of Flutter, you can then run `melos bootstrap` to provision
|
||||
all dependencies. Otherwise, run `flutter pub global run melos bootstrap`.
|
||||
|
|
|
@ -45,13 +45,6 @@ dev_dependencies:
|
|||
|
||||
|
||||
dependency_overrides:
|
||||
drift:
|
||||
path: ../drift
|
||||
drift_dev:
|
||||
path: ../drift_dev
|
||||
sqlparser:
|
||||
path: ../sqlparser
|
||||
|
||||
# todo: Remove after https://github.com/dart-lang/mime/pull/43
|
||||
mime:
|
||||
git:
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
dependency_overrides:
|
||||
drift_dev:
|
||||
path: ../drift_dev
|
||||
sqlparser:
|
||||
path: ../sqlparser
|
|
@ -1,5 +0,0 @@
|
|||
dependency_overrides:
|
||||
drift:
|
||||
path: ../drift
|
||||
sqlparser:
|
||||
path: ../sqlparser
|
|
@ -24,10 +24,6 @@ dev_dependencies:
|
|||
drift_testcases:
|
||||
path: ../extras/integration_tests/drift_testcases
|
||||
|
||||
dependency_overrides:
|
||||
drift:
|
||||
path: ../drift/
|
||||
|
||||
flutter:
|
||||
assets:
|
||||
- test_asset.db
|
||||
|
|
|
@ -38,13 +38,3 @@ dev_dependencies:
|
|||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
# We override dependencies to ensure that we always use the packages from
|
||||
# this repository. In your app, just depend on the latest drift version.
|
||||
dependency_overrides:
|
||||
drift:
|
||||
path: ../../drift
|
||||
drift_dev:
|
||||
path: ../../drift_dev
|
||||
sqlparser:
|
||||
path: ../../sqlparser
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
# We override dependencies to ensure that we always use the packages from
|
||||
# this repository. In your app, just depend on the latest drift version by
|
||||
# removing the `pubspec_overrides.yaml` file.
|
||||
dependency_overrides:
|
||||
drift:
|
||||
path: ../../drift
|
||||
drift_dev:
|
||||
path: ../../drift_dev
|
||||
sqlparser:
|
||||
path: ../../sqlparser
|
|
@ -16,11 +16,3 @@ dev_dependencies:
|
|||
build_web_compilers: ^3.2.1
|
||||
flutter_lints: ^1.0.4
|
||||
drift_dev:
|
||||
|
||||
dependency_overrides:
|
||||
drift:
|
||||
path: ../../drift
|
||||
drift_dev:
|
||||
path: ../../drift_dev
|
||||
sqlparser:
|
||||
path: ../../sqlparser
|
||||
|
|
|
@ -13,11 +13,3 @@ dev_dependencies:
|
|||
drift_dev:
|
||||
build_runner: ^2.0.0
|
||||
test: ^1.15.4
|
||||
|
||||
dependency_overrides:
|
||||
drift:
|
||||
path: ../../drift
|
||||
drift_dev:
|
||||
path: ../../drift_dev
|
||||
sqlparser:
|
||||
path: ../../sqlparser
|
||||
|
|
|
@ -16,11 +16,3 @@ dev_dependencies:
|
|||
build_web_compilers: ^3.2.3
|
||||
lints: ^2.0.0
|
||||
drift_dev:
|
||||
|
||||
dependency_overrides:
|
||||
drift:
|
||||
path: ../../drift
|
||||
drift_dev:
|
||||
path: ../../drift_dev
|
||||
sqlparser:
|
||||
path: ../../sqlparser
|
||||
|
|
|
@ -13,11 +13,3 @@ dev_dependencies:
|
|||
drift_dev: ^2.0.0-dev
|
||||
built_value_generator: ^8.1.1
|
||||
build_runner: ^2.0.0
|
||||
|
||||
dependency_overrides:
|
||||
drift:
|
||||
path: ../../drift
|
||||
drift_dev:
|
||||
path: ../../drift_dev
|
||||
sqlparser:
|
||||
path: ../../sqlparser
|
||||
|
|
|
@ -108,8 +108,8 @@ class User extends DataClass implements Insertable<User> {
|
|||
}
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(id, name, birthDate, profilePicture, preferences);
|
||||
int get hashCode => Object.hash(id, name, birthDate,
|
||||
$driftBlobEquality.hash(profilePicture), preferences);
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
|
@ -117,7 +117,8 @@ class User extends DataClass implements Insertable<User> {
|
|||
other.id == this.id &&
|
||||
other.name == this.name &&
|
||||
other.birthDate == this.birthDate &&
|
||||
other.profilePicture == this.profilePicture &&
|
||||
$driftBlobEquality.equals(
|
||||
other.profilePicture, this.profilePicture) &&
|
||||
other.preferences == this.preferences);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:analyzer/dart/analysis/analysis_context_collection.dart';
|
||||
import 'package:analyzer/dart/analysis/results.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
/// Lists all top-level API members of a package.
|
||||
Future<void> main() async {
|
||||
final dir = Directory.current.path;
|
||||
final context =
|
||||
AnalysisContextCollection(includedPaths: [dir]).contextFor(dir);
|
||||
|
||||
final names = <String>{};
|
||||
|
||||
await for (final libFile in Directory(p.join(dir, 'lib')).list()) {
|
||||
final result = await context.currentSession.getUnitElement(libFile.path);
|
||||
|
||||
if (result is UnitElementResult) {
|
||||
final ns = result.element.library.exportNamespace;
|
||||
names.addAll(ns.definedNames.keys);
|
||||
} else {
|
||||
stderr.writeln('Could not analyze ${libFile.path}');
|
||||
}
|
||||
}
|
||||
|
||||
await stderr.flush();
|
||||
names.forEach(print);
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
name: tooling
|
||||
publish_to: none
|
||||
description: Tools used during development or in CI runs
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
|
||||
dependencies:
|
||||
analyzer: ^2.5.0
|
||||
path: ^1.8.0
|
|
@ -0,0 +1,40 @@
|
|||
name: drift
|
||||
repository: https://github.com/simolus3/drift
|
||||
|
||||
packages:
|
||||
- docs
|
||||
- drift
|
||||
- drift_sqflite
|
||||
- drift_dev
|
||||
- sqlparser
|
||||
- examples/*
|
||||
- extras/benchmarks
|
||||
- extras/drift_postgres
|
||||
- extras/encryption
|
||||
- extras/integration_tests/*
|
||||
- extras/plugin_example
|
||||
|
||||
command:
|
||||
bootstrap:
|
||||
usePubspecOverrides: true
|
||||
|
||||
scripts:
|
||||
check_format:
|
||||
run: dart format -o none --set-exit-if-changed .
|
||||
|
||||
analyze:
|
||||
run: dart analyze --fatal-infos
|
||||
exec: {concurrency: 1}
|
||||
|
||||
build:
|
||||
run: flutter pub run build_runner build --delete-conflicting-outputs
|
||||
exec: {concurrency: 1}
|
||||
select-package:
|
||||
depends-on: build_runner
|
||||
|
||||
test:
|
||||
run: dart test
|
||||
exec: {concurrency: 1}
|
||||
select-package:
|
||||
depends-on: test
|
||||
ignore: drift_postgres # this is an integration test
|
|
@ -1,24 +1,2 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
function generate() {
|
||||
echo "------------- Generate: $1 -------------"
|
||||
pushd $1 > /dev/null
|
||||
dart pub upgrade
|
||||
dart run build_runner build --delete-conflicting-outputs
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
generate 'drift'
|
||||
generate 'drift_dev'
|
||||
generate 'docs'
|
||||
generate 'extras/benchmarks'
|
||||
generate 'extras/integration_tests/drift_testcases'
|
||||
generate 'extras/integration_tests/web'
|
||||
generate 'examples/app'
|
||||
generate 'examples/encryption'
|
||||
generate 'examples/flutter_web_worker_example'
|
||||
generate 'examples/migrations_example'
|
||||
generate 'examples/web_worker_example'
|
||||
generate 'examples/with_built_value'
|
||||
melos run build
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
rm -f moor/LICENSE
|
||||
rm -f moor_flutter/LICENSE
|
||||
rm -f moor_generator/LICENSE
|
||||
|
||||
cp LICENSE moor/LICENSE
|
||||
cp LICENSE moor_flutter/LICENSE
|
||||
cp LICENSE moor_generator/LICENSE
|
|
@ -1,45 +1,2 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
function run_test() {
|
||||
echo "------------- Running test: $1 -------------"
|
||||
pushd $1 > /dev/null
|
||||
dart pub upgrade
|
||||
dart format -o none --set-exit-if-changed .
|
||||
dart analyze --fatal-infos --fatal-warnings
|
||||
if [[ "$2" == 'vm+web' ]]; then
|
||||
dart test -p vm
|
||||
dart test -p chrome
|
||||
elif [[ "$2" == 'web-only' ]]; then
|
||||
dart test -p chrome
|
||||
else
|
||||
dart test -p vm
|
||||
fi
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
function run_test_flutter() {
|
||||
echo "------------- Running flutter test: $1 -------------"
|
||||
pushd $1 > /dev/null
|
||||
flutter pub upgrade
|
||||
flutter clean
|
||||
dart format -o none --set-exit-if-changed .
|
||||
flutter analyze --fatal-infos --fatal-warnings
|
||||
flutter test $2
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
cd ..
|
||||
|
||||
if [[ "$1" == 'flutter' ]]; then
|
||||
run_test_flutter 'drift_sqflite' 'integration_test'
|
||||
run_test_flutter 'examples/app'
|
||||
run_test_flutter 'extras/integration_tests/ffi_on_flutter' 'integration_test/drift_native.dart'
|
||||
else
|
||||
run_test 'drift' 'vm+web'
|
||||
run_test 'drift_dev'
|
||||
run_test 'sqlparser'
|
||||
run_test 'examples/migrations_example'
|
||||
run_test 'extras/integration_tests/web' 'web-only'
|
||||
run_test 'extras/drift_postgres'
|
||||
fi
|
||||
melos test
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
find ../ -name pubspec.yaml -execdir dart pub upgrade \;
|
||||
#!/bin/bash
|
||||
melos exec -- dart pub upgrade
|
||||
|
|
Loading…
Reference in New Issue