angulardart / angular

Fast and productive web framework provided by Dart
https://pub.dev/packages/angular
MIT License
1.83k stars 231 forks source link

Application no longer building with Dart 2.14 and cannot update dependencies #1969

Closed parnham closed 3 years ago

parnham commented 3 years ago

With the latest Dart SDK I get the following build error

[SEVERE] angular:angular on lib/entities/status.dart:

Bad state: Unexpected diagnostics:
/usr/lib/dart/lib/core/int.dart:117:18 - Operator declarations must be preceded by the keyword 'operator'.
/usr/lib/dart/lib/core/int.dart:117:16 - Methods must have an explicit list of parameters.
/usr/lib/dart/lib/core/int.dart:117:18 - A function body must be provided.

And then the build stalls indefinitely waiting on sources that require code gen via json_serializable.

Unfortunately I cannot try updating to a newer version of json_serializable to see if this fixes the issue because of the dependency limitations of angular. Newer null-safety ported versions of json_serializable and our own library for translation code gen rely on build >= 2.0.0 but angular and associated dependencies such as angular_components are still locked to build 1.x.

Any attempt to update the other dependencies results in a failed pub get but the application will no longer build and produces errors I don't understand.

insinfo commented 3 years ago

I'm also having this problem, did you find any solution?

Dart SDK version: 2.14.1 (stable) (Wed Sep 8 13:33:08 2021 +0200) on "windows_x64"

webdev serve --auto refresh
[INFO] Building new asset graph completed, took 6.2s
[INFO] Checking for unexpected pre-existing outputs. completed, took 1ms
[INFO] Serving `web` on http://127.0.0.1:8080
[WARNING] angular:angular on web/main.dart: Your current `analyzer` version may not fully support your current SDK version.

Please try upgrading to the latest `analyzer` by running `pub upgrade`.

Analyzer language version: 2.12.0
SDK language version: 2.14.0

If you are getting this message and have the latest analyzer please file
an issue at https://github.com/dart-lang/sdk/issues/new with the title
"No published analyzer available for language version 2.14.0".
Please search the issue tracker first and thumbs up and/or subscribe to
existing issues if present to avoid duplicates.

[SEVERE] angular:angular on web/main.dart: Bad state: Unexpected diagnostics:
C:\tools\dart-sdk\lib\core\int.dart:117:18 - Operator declarations must be preceded by the keyword 'operator'.
C:\tools\dart-sdk\lib\core\int.dart:117:16 - Methods must have an explicit list of parameters.
C:\tools\dart-sdk\lib\core\int.dart:117:18 - A function body must be provided.

[SEVERE] angular:angular on web/main.dart: Bad state: Unexpected diagnostics:
C:\tools\dart-sdk\lib\core\int.dart:117:18 - Operator declarations must be preceded by the keyword 'operator'.
C:\tools\dart-sdk\lib\core\int.dart:117:16 - Methods must have an explicit list of parameters.
C:\tools\dart-sdk\lib\core\int.dart:117:18 - A function body must be provided.

[WARNING] No actions completed for 15.1s, waiting on:
  - build_web_compilers:entrypoint on web/main.dart

[WARNING] No actions completed for 15.0s, waiting on:
  - build_web_compilers:entrypoint on web/main.dart

[WARNING] No actions completed for 15.1s, waiting on:
  - build_web_compilers:entrypoint on web/main.dart  

[WARNING] No actions completed for 15.0s, waiting on:
  - build_web_compilers:entrypoint on web/main.dart  

[WARNING] No actions completed for 15.1s, waiting on:
  - build_web_compilers:entrypoint on web/main.dart  

[WARNING] No actions completed for 15.0s, waiting on:
  - build_web_compilers:entrypoint on web/main.dart  

[WARNING] No actions completed for 15.1s, waiting on:
  - build_web_compilers:entrypoint on web/main.dart  

[WARNING] No actions completed for 15.0s, waiting on:
  - build_web_compilers:entrypoint on web/main.dart

[WARNING] No actions completed for 15.0s, waiting on:
  - build_web_compilers:entrypoint on web/main.dart

[WARNING] No actions completed for 15.1s, waiting on:
  - build_web_compilers:entrypoint on web/main.dart

pubspec.yaml

name: covid_browser
description: A web app that uses AngularDart Components
# version: 1.0.0
# homepage: https://www.example.com

environment:
  sdk: '>=2.10.0 <3.0.0'

dependencies:
  angular: ^6.0.0
  angular_components: ^1.0.2
  angular_router: ^2.0.0
  angular_forms: ^3.0.0
  sembast_web: ^1.2.0
  sass_builder: ^2.1.3
  intl: '>=0.16.1 < 0.17.9'
  uuid: '>=2.2.2 < 3.0.9'
  crossplat_objectid: ^2.1.4  
  #dio: ^3.0.10
  http: '>=0.12.2 < 0.13.5'
  excel: ^1.1.5

  covid_core:
    path: ../covid_core

dev_dependencies:
  angular_test: ^3.0.0                                                                                                 
  build_runner: ^1.10.4                                                                                                   
  build_test: ^1.3.0                                                                                              
  build_web_compilers: ^2.12.0                                                                                
  pedantic: ^1.9.2                                                                                               
  test: ^1.15.4
parnham commented 3 years ago

I'm afraid that I've not found a solution yet. I thought it might be related to angular + json_serializable since our build was getting stuck on the JSON entities, but I can see from your pubspec that you're not using json_serializable so it must be something else.

It's affecting all 3 of our current angular apps and since both serve and build stalls it has the unfortunate side effect of causing the runners on our build server to be tied up.

insinfo commented 3 years ago

Posso confirmar que funciona no dart 2.12 e no 2.13 mas não funciona no dart 2.14. It seems to be a problem in dart-sdk, I opened a problem there. https://github.com/dart-lang/sdk/issues/47191

geaden commented 3 years ago

Downgrading dart to 2.13.4 helped to resolve the issue. You can find packages for previous versions here https://dart.dev/tools/sdk/archive

kevmoo commented 3 years ago

I've started publishing versions that support the latest Dart