Upgrade to build 2.0

This commit is contained in:
Simon Binder 2021-03-16 09:47:09 +01:00
parent 06ba6e1f2e
commit c32ccac756
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
6 changed files with 20 additions and 18 deletions

View File

@ -18,7 +18,7 @@ dependencies:
sqlite3: ">=0.1.9-nullsafety <2.0.0"
dev_dependencies:
build_test: ^1.3.0
build_test: ^2.0.0
build_runner_core: ^6.1.0
moor_generator: any
uuid: ^3.0.0-nullsafety.0
@ -33,3 +33,5 @@ dependency_overrides:
path: ../moor_generator
sqlparser:
path: ../sqlparser
# todo: Remove once mockito version 5.0.2 is released
build: ^2.0.0

View File

@ -21,8 +21,8 @@ class BuildBackend extends Backend {
@override
Uri resolve(Uri base, String import) {
final from = AssetId.resolve(base.toString());
return AssetId.resolve(import, from: from).uri;
final from = AssetId.resolve(base);
return AssetId.resolve(Uri.parse(import), from: from).uri;
}
}
@ -38,7 +38,7 @@ class BuildBackendTask extends BackendTask {
Uri get entrypoint => step.inputId.uri;
AssetId _resolve(Uri uri) {
return AssetId.resolve(uri.toString(), from: step.inputId);
return AssetId.resolve(uri, from: step.inputId);
}
@override

View File

@ -72,7 +72,8 @@ class PreprocessBuilder extends Builder {
parsed.rootNode.allDescendants
.whereType<ImportStatement>()
.map((stmt) => AssetId.resolve(stmt.importedFile, from: asset))
.map((stmt) =>
AssetId.resolve(Uri.parse(stmt.importedFile), from: asset))
.where((importedId) =>
!seenFiles.contains(importedId) &&
!queue.contains(importedId))

View File

@ -131,8 +131,7 @@ class TypeDeserializer {
}
}
} else {
final library =
await buildStep.resolver.libraryFor(AssetId.resolve(uri.toString()));
final library = await buildStep.resolver.libraryFor(AssetId.resolve(uri));
_lastSession ??= library?.session;
return library;
}

View File

@ -28,21 +28,21 @@ dependencies:
sqlparser: ^0.14.0
# Dart analysis
analyzer: "^1.0.0"
analyzer: "^1.1.0"
analyzer_plugin_fork: "^0.5.0"
source_span: ^1.5.5
# Build system
build: ^1.6.0
build_resolvers: ^1.5.1
build: ^2.0.0
build_resolvers: ^2.0.0
build_config: '>=0.3.1 <1.0.0'
dart_style: ^1.3.3
source_gen: ^0.9.4
dev_dependencies:
test: ^1.6.0
build_runner: ^1.6.7
build_test: ^1.3.6
test: ^1.16.0
build_runner: ^1.12.0
build_test: ^2.0.0
json_serializable: ^4.0.0
executables:

View File

@ -44,8 +44,8 @@ class TestBackend extends Backend {
@override
Uri resolve(Uri base, String import) {
final from = AssetId.resolve(base.toString());
return AssetId.resolve(import, from: from).uri;
final from = AssetId.resolve(base);
return AssetId.resolve(Uri.parse(import), from: from).uri;
}
}
@ -63,17 +63,17 @@ class _TestBackendTask extends BackendTask {
@override
Future<String> readMoor(Uri path) async {
await backend._ready;
return backend.fakeContent[AssetId.resolve(path.toString())];
return backend.fakeContent[AssetId.resolve(path)];
}
@override
Future<LibraryElement> resolveDart(Uri path) async {
await backend._ready;
return await backend._resolver.libraryFor(AssetId.resolve(path.toString()));
return await backend._resolver.libraryFor(AssetId.resolve(path));
}
@override
Future<bool> exists(Uri uri) async {
return backend.fakeContent.containsKey(AssetId.resolve(uri.toString()));
return backend.fakeContent.containsKey(AssetId.resolve(uri));
}
}