Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build_runner 2.1.7/2.1.8 causes code generation to fail with several InconsistentAnalysisExceptions #3271

Closed
Pante opened this issue Mar 24, 2022 · 11 comments

Comments

@Pante
Copy link

Pante commented Mar 24, 2022

  • Dart version: 2.16.1
  • Flutter version: 2.10.3
  • Package used: build_runner: ^2.1.7
  • Platforms: Windows & Linux (not tested on MacOS)

After upgrading build_runner from 2.1.6 to 2.1.7/2.1.8, the following combination of packages seems to cause code generation to fail with several InconsistentAnalysisExceptions. Downgrading to 2.1.6 and cleaning build_runner's cache resolves the problem.

The packages (taken from pubspec.lock):

auto_route:
  dependency: "direct main"
  description:
    name: auto_route
    url: "https://pub.dartlang.org"
  source: hosted
  version: "3.2.4"

auto_route_generator:
  dependency: "direct dev"
  description:
    name: auto_route_generator
    url: "https://pub.dartlang.org"
  source: hosted
  version: "3.2.3"

build_runner:
  dependency: "direct dev"
  description:
    name: build_runner
    url: "https://pub.dartlang.org"
  source: hosted
  version: "2.1.8"

mockito:
  dependency: "direct dev"
  description:
    name: mockito
    url: "https://pub.dartlang.org"
  source: hosted
  version: "5.1.0"

Causes the code generation to fail with the following logs:

[INFO] Running build...
[INFO] 1.0s elapsed, 0/16 actions completed.
[INFO] 3.1s elapsed, 0/16 actions completed.
[INFO] 4.1s elapsed, 0/16 actions completed.
[INFO] 9.4s elapsed, 0/16 actions completed.
[INFO] 17.2s elapsed, 0/16 actions completed.
[WARNING] No actions completed for 17.2s, waiting on:
  - auto_route_generator:autoRouteGenerator on test/flutter_test_config.dart
  - auto_route_generator:autoRouteGenerator on test/models/checklist/checklists_test.dart
  - auto_route_generator:autoRouteGenerator on test/mock_provider.dart
  - auto_route_generator:autoRouteGenerator on test/models/checklist/checklist_conflict_resolution_test.dart
  - auto_route_generator:autoRouteGenerator on test/models/checklist/checklist_model_test.dart
  .. and 11 more

[SEVERE] auto_route_generator:autoRouteGenerator on test/mock_provider.dart:

InconsistentAnalysisException: Requested result might be inconsistent with previously returned results

[SEVERE] auto_route_generator:autoRouteGenerator on test/models/checklist/checklist_conflict_resolution_test.dart:
<snipped>

[INFO] 24.0s elapsed, 53/69 actions completed.
[INFO] 25.0s elapsed, 68/83 actions completed.
[SEVERE] auto_route_generator:autoRouteGenerator on lib/views/authentication/sign_in/sign_in.dart:

InconsistentAnalysisException: Requested result might be inconsistent with previously returned results
<snipped>

[SEVERE] mockito:mockBuilder on test/models/template/templates_test.dart:

InconsistentAnalysisException: Requested result might be inconsistent with previously returned results
<snipped>
@Pante Pante changed the title build_runner 2.1.8 causes code generation to fail with several InconsistentAnalysisExceptions build_runner 2.1.7/2.1.8 causes code generation to fail with several InconsistentAnalysisExceptions Mar 24, 2022
@kasipavankumar
Copy link

Same here except downgrading to 2.1.6 doesn't resolve the issue. 🤔

@aitinsan
Copy link

Have the same issue. looks like there were no changes on build_runner, but it depends on so many packages. maybe a problem with them?

@Hoang-Nguyenn
Copy link

same issue now :( wait for response

@Petri-Oosthuizen
Copy link

Petri-Oosthuizen commented Mar 24, 2022

[TEMPORARY SOLUTION]

Scanning through the dependencies I saw that analyzer (3.4.0) was updated recently, reverting to the previous version of the package fixes build_runner code generation.

You can get around this issue for now with:

dependency_overrides:
  analyzer: 3.3.1

Linking pull request 3269.

@demsey2
Copy link

demsey2 commented Mar 24, 2022

I downgraded to build_runner 2.1.5 and I have analyzer 2.8.0 that works

@kasipavankumar
Copy link

[TEMPORARY SOLUTION]

Scanning through the dependencies I saw that analyzer (3.4.0) was updated recently, reverting to the previous version of the package fixes build_runner code generation.

You can get around this issue for now with:

dependency_overrides:
  analyzer: 3.3.1

PS: I might've jinxed it: 666-dart-build-fail

Confirmed, this works! Thanks @Petri-Oosthuizen

@olegsvs
Copy link

olegsvs commented Mar 24, 2022

Same here except downgrading to 2.1.6 doesn't resolve the issue. 🤔

it's work

@jakemac53
Copy link
Contributor

cc @scheglov

@jakemac53
Copy link
Contributor

related to dart-lang/sdk#48658

The best solution for now is as suggested to pin analyzer to 3.3.1:

dependency_overrides:
  analyzer: 3.3.1

Hoping to get a revert of 3.4.0 published until we can figure out the best resolution.

@jakemac53
Copy link
Contributor

It looks like this should be resolved in analyzer: 3.4.1. I will close for now but if anybody is still experiencing issues please comment and let us know.

@olucasgomes
Copy link

olucasgomes commented Apr 8, 2022

relacionado a dart-lang/sdk#48658

A melhor solução por enquanto é sugerida para fixar o analisador em 3.3.1:

dependency_overrides :
   analisador : 3.3.1

Esperando obter uma reversão de 3.4.0 publicado até que possamos descobrir a melhor resolução.

Pra mim, resolveu o problema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants