dart-lang / build

A build system for Dart written in Dart
https://pub.dev/packages/build
BSD 3-Clause "New" or "Revised" License
790 stars 207 forks source link

Failed to precompile build_runner:graph_inspector #2109

Closed szepeshazi closed 5 years ago

szepeshazi commented 5 years ago

Using Dart VM version: 2.1.0 (Tue Nov 13 18:22:02 2018 +0100) on "windows_x64" with the following dev_dependencies in pubspec.yaml:

dev_dependencies:
  test: ^1.3.0
  grinder:
  build_runner: ^1.1.2
  build_test: ^0.10.3

Our Gitlab pipelines started to fail this morning when running pub get, with the following messages:

Resolving dependencies...
Got dependencies!
Precompiling executables...
Failed to precompile build_runner:graph_inspector:
file:///gyerunkanyukam/krafty/.pub-cache/hosted/pub.dartlang.org/build_runner_core-3.0.0/lib/src/environment/create_merged_dir.dart:72:24: Error: Map literal requires exactly two type arguments.
  final seen = <String>{};
                       ^^
file:///gyerunkanyukam/krafty/.pub-cache/hosted/pub.dartlang.org/build_runner_core-3.0.0/lib/src/environment/create_merged_dir.dart:73:29: Error: Map literal requires exactly two type arguments.
  final conflicts = <String>{};
                            ^^
file:///gyerunkanyukam/krafty/.pub-cache/hosted/pub.dartlang.org/build_runner_core-3.0.0/lib/src/environment/create_merged_dir.dart:77:15: Error: The method 'add' isn't defined for the class 'dart.core::Map<dynamic, dynamic>'.
Try correcting the name to the name of an existing method, or defining a method named 'add'.
    if (!seen.add(location)) conflicts.add(location);
              ^^^

There are many more of these. Is it possible that this came with the build, build_runner and other dependent package updates dated Mar 26, 2019 and Mar 27, 2019?

szepeshazi commented 5 years ago

I just reproduced this with a bare Stagehand console application and the above dependencies. Removing the caret syntax from build_runner dependency, i.e. build_runner: 1.1.2 instead of build_runner: ^1.1.2 fixes the issue.

jakemac53 commented 5 years ago

It looks like we accidentally published a version of build_runner_core which uses the new Set literals but doesn't have the proper minimum SDK constraint.

In the meantime you can either pin build_runner_core to an earlier version or update your sdk to 2.2.0.

jakemac53 commented 5 years ago

This should now be fixed, please run a pub upgrade to pick up the latest build_runner and build_runner_core. For now I just removed all set literals, and we will follow up in the near future with a new release that reverts that commit and sets the minimum constraint appropriately.

AkposCodex commented 5 years ago
[flutterweb] pub get
Resolving dependencies...
The current Dart SDK version is 2.4.0.

Because flutterweb depends on build_test >=0.1.1 <=0.10.3 which requires SDK version >=1.8.0 <2.0.0 or >=2.0.0-dev.32 <2.0.0, version solving failed.

I got this error when running pub get I just need some help I just started flutter web development and I cant even build my first project.

AkposCodex commented 5 years ago
dev_dependencies:
  # Enables the `pub run build_runner` command
  build_runner: 1.4.0
  # Includes the JavaScript compilers
  build_web_compilers: 2.0.0

  build_test: ^0.10.3

Editing my dependencies like this I was able to get build_runner to run but when running webdev again it gave me this error:

webdev could not run for this project.
Could not find a file named "pubspec.yaml" in "C:\flutter\.pub-cache\hosted\pub.dartlang.org\vm_service_lib-3.22.2+1"
jakemac53 commented 5 years ago

@AkposCodex You are hitting this issue https://github.com/dart-lang/build/issues/2109.

The best workaround is to delete the .pub-cache directly under your flutter sdk, and re-activate webdev.

AkposCodex commented 5 years ago

Ok I'll try it

AkposCodex commented 5 years ago

you mean the whole thing right?

jakemac53 commented 5 years ago

Yes the entire directory, that will make flutter packages <blah> use the normal global pub cache

AkposCodex commented 5 years ago

somehow the pub.dartlang.org folder gave itself admin priveleges and changed its attribute to read only and now I cant even access it

jakemac53 commented 5 years ago

Ok, another workaround if you can't delete that directory is to activate webdev using the dart sdk and not the flutter sdk.

This would mean using the normal pub tool instead of flutter packages pub, so pub global activate webdev (assuming the dart sdk is on your PATH). Then you should be able to run it from either sdk.

cgowthamanmca commented 4 years ago

@jakemac53 Thanks working good