moor_generator support build 2.0.0

Created on 16 Mar 2021  路  12Comments  路  Source: simolus3/moor

I am using some different generators. kiwi_generator, retrofit_generator, json_serializable.

They are all using build 2.0.0 so for now I am stuck because the moor_generator is not yet supported to work with build 2.0.0

[WARNING] stderr: ../../../../.pub-cache/hosted/pub.dartlang.org/moor_generator-4.1.0/lib/src/backends/build/preprocess_builder.dart:74:51: Error: The argument type 'String' can't be assigned to the parameter type 'Uri'.
[WARNING] stderr:  - 'Uri' is from 'dart:core'.
[WARNING] stderr:               .map((stmt) => AssetId.resolve(stmt.importedFile, from: asset))
[WARNING] stderr:                                                   ^
[WARNING] stderr: ../../../../.pub-cache/hosted/pub.dartlang.org/moor_generator-4.1.0/lib/src/backends/build/build_backend.dart:23:39: Error: The argument type 'String' can't be assigned to the parameter type 'Uri'.
[WARNING] stderr:  - 'Uri' is from 'dart:core'.
[WARNING] stderr:     final from = AssetId.resolve(base.toString());
[WARNING] stderr:                                       ^
[WARNING] stderr: ../../../../.pub-cache/hosted/pub.dartlang.org/moor_generator-4.1.0/lib/src/backends/build/build_backend.dart:24:28: Error: The argument type 'String' can't be assigned to the parameter type 'Uri'.
[WARNING] stderr:  - 'Uri' is from 'dart:core'.
[WARNING] stderr:     return AssetId.resolve(import, from: from).uri;
[WARNING] stderr:                            ^
[WARNING] stderr: ../../../../.pub-cache/hosted/pub.dartlang.org/moor_generator-4.1.0/lib/src/backends/build/build_backend.dart:40:32: Error: The argument type 'String' can't be assigned to the parameter type 'Uri'.
[WARNING] stderr:  - 'Uri' is from 'dart:core'.
[WARNING] stderr:     return AssetId.resolve(uri.toString(), from: step.inputId);
[WARNING] stderr:                                ^
[WARNING] stderr: ../../../../.pub-cache/hosted/pub.dartlang.org/moor_generator-4.1.0/lib/src/backends/build/serialized_types.dart:134:67: Error: The argument type 'String' can't be assigned to the parameter type 'Uri'.
[WARNING] stderr:  - 'Uri' is from 'dart:core'.
[WARNING] stderr:           await buildStep.resolver.libraryFor(AssetId.resolve(uri.toString()));
[WARNING] stderr:     

Most helpful comment

I've just published moor_generator version 4.2.0 (nice!), which supports the latest build, source_gen, analyzer and dart_style packages.

All 12 comments

I got all the errors fixed except this one

image

Branch with all changes except the one in the picture. Can't figure out where I should get the workspace.
https://github.com/vanlooverenkoen/moor/tree/feature/%231100-build-2.0.0

I've already done some work to support the latest build version on my develop branch. I'll try to release that this week.

Ah damn I just added support for the latest build version

I will use my branch for now. No problem

Also besides that it would be really helpful to also upgrade the other dependencies which interact with build like json_annotations. That actually shouldn't be a problem since json_annotations >= 4.0.0 already depend on the new build 2.0.0. So once build is updated it would be really nice if you could update json_annotations too.

Anyways thanks for your great work and this cool package :)

Yeah that is required as well indeed

Wow thanks for that really quick response.

The power of mobile applications with push notifications 馃榾馃榾

I've already done some work to support the latest build version on my develop branch. I'll try to release that this week.

Can I use that branch until it's release on master and pub.dev?

I tried this in my pubspec.yaml

moor_generator:
    git:
      url: https://github.com/simolus3/moor.git
      ref: develop
      path: moor/moor_generator

but then I got this error

pub get failed (1; Could not find a file named "moor/moor_generator/pubspec.yaml" in https://github.com/simolus3/moor.git 1d08b73ed442910774638440f9d9d0277559179b.)

any suggestion please?

Its path: moor_generator, not path: moor/moor_generator.
This configuration works for me:

dev_dependencies:
  moor_generator:
    git:
      url: https://github.com/simolus3/moor.git
      ref: develop
      path: moor_generator
  build_runner:

dependency_overrides:
  moor:
    git:
      url: https://github.com/simolus3/moor.git
      ref: develop
      path: moor
  sqlparser:
    git:
      url: https://github.com/simolus3/moor.git
      ref: develop
      path: sqlparser

I've just published moor_generator version 4.2.0 (nice!), which supports the latest build, source_gen, analyzer and dart_style packages.

Was this page helpful?
0 / 5 - 0 ratings