angular icon indicating copy to clipboard operation
angular copied to clipboard

Incompatible with latest version of Analyzer

Open supermuka opened this issue 5 years ago • 6 comments

None of the recent versions of the Angular package are compatible with the latest version of the Analyzer package 0.39.2+1.

pub get update shows:

Because angular >= depends on analyzer ^0.37.0 and auge_web depends on analyzer ^0.39.2+1, angular >=6.0.0-alpha+1 is forbidden. So, because auge_web depends on angular ^6.0.0-alpha+1, version solving failed.

  • Dart SDK Version (dart --version) 2.7
  • AngularDart Version 6.0.0-alpha+1
  • Whether you are using Windows, macOS, or Linux Windows
  • Whether you are using Chrome, Safari, Firefox, Edge Chrome

supermuka avatar Dec 16 '19 11:12 supermuka

As mentioned in https://github.com/dart-lang/angular/issues/1860#issuecomment-565643006, you can use dependency_overrides to override the analyzer constraint.

leonsenft avatar Dec 16 '19 17:12 leonsenft

@leonsenft: FYI: While the overrides may work in many cases, there were a few non-trivial changes between package:analyzer 0.37 and 0.39, and for a non-angular use-case we had breaking changes when doing the override.

isoos avatar Jan 03 '20 14:01 isoos

Overriding analyzer is not the magic solution as it breaks some others packages on build. In my project, I tried many times but impossible to use analyzer> 0.38.3 Hope you'll upgrade Angular to be compatible with analyzer 0.39+ soon

e-belair avatar Feb 26 '20 16:02 e-belair

@leonsenft Updating to analyzer ^0.39.0 with dependency_overrides fails on webdev build with the following error:

[SEVERE] ../../../.pub-cache/hosted/pub.dartlang.org/angular-6.0.0-alpha+1/lib/src/compiler/analyzed_class.dart:64:15: Error: The method 'isEquivalentTo' isn't defined for the class 'DartType'. - 'DartType' is from 'package:analyzer/dart/element/type.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/analyzer-0.39.8/lib/dart/element/type.dart').Try correcting the name to the name of an existing method, or defining a method named 'isEquivalentTo'.  return type.isEquivalentTo(string);
Unhandled exception:
Bad state: Unable to start build daemon.
#0      _handleDaemonStartup (package:build_daemon/client.dart:82:5)
<asynchronous suspension>
#1      BuildDaemonClient.connect (package:build_daemon/client.dart:183:11)
<asynchronous suspension>
#2      connectClient (package:webdev/src/daemon_client.dart:17:23)
#3      _startBuildDaemon (package:webdev/src/serve/dev_workflow.dart:26:18)
#4      DevWorkflow.start (package:webdev/src/serve/dev_workflow.dart:194:24)
#5      ServeCommand.run (package:webdev/src/command/serve_command.dart:101:27)
<asynchronous suspension>
#6      CommandRunner.runCommand (package:args/command_runner.dart:197:27)
#7      _CommandRunner.runCommand (package:webdev/src/webdev_command_runner.dart:38:24)
#8      CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:112:25)
#9      new Future.sync (dart:async/future.dart:224:31)

ganigeorgiev avatar May 10 '20 15:05 ganigeorgiev

Angular (5.3.1)

We can't update builder libraries with important fixes for us because they depend on the latest analyzer version. And angular doesn't compile with this analyzer version.

[SEVERE] angular:angular on lib/src/smth.dart: Unhandled exception in the AngularDart compiler!
Please report a bug: https://github.com/dart-lang/angular/issues/newBad state: Provider.useFactory must be a Function, but got type Smth Function() instead with type element null
...

svarl avatar May 12 '20 13:05 svarl

This problem is becoming more pressing every day. Developers outside of Google are from now on basically bound to the SDK version <dart-sdk 2.14.0-91.0.dev because angular 6.0.1 depends on analyzer ^0.40.0

See also https://github.com/dart-lang/sdk/issues/46482

dependency_overrides:
  analyzer: ^1.0.0
Working dir: D:\dart-apps\webV\gdv\gdv_app
"D:\dart-sdk\dart-sdk 2.14.0-241.0.dev\bin\dart.exe" pub get
Resolving dependencies...
Because analyzer >=1.0.0 depends on package_config ^2.0.0 and angular_compiler 1.0.1 depends on package_config ^1.9.3, analyzer >=1.0.0 is incompatible with angular_compiler 1.0.1.
And because angular 6.0.1 depends on angular_compiler 1.0.1 and no versions of angular match >6.0.1 <7.0.0, analyzer >=1.0.0 is incompatible with angular ^6.0.1.
So, because gdv_app depends on both angular ^6.0.1 and analyzer ^1.0.0, version solving failed.

stephan-gruen avatar Jul 14 '21 10:07 stephan-gruen