Skip to content

Conversation

NearTox
Copy link
Contributor

@NearTox NearTox commented Sep 25, 2025

close flutter/flutter#175071

Expand support build and source_gen versions to support build v4 and source_gen v4
Expand support analyzer version to allow to v8.

List which issues are fixed by this PR. You must list at least one issue.

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

@NearTox NearTox requested a review from chunhtai as a code owner September 25, 2025 16:56
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the dependency constraints for analyzer, build, and source_gen to support newer versions. The code has been updated to be compatible with the new APIs from these dependencies, primarily by replacing deprecated analyzer and source_gen APIs like element.name with element.displayName and TypeChecker.fromRuntime with TypeChecker.typeNamed. The changes look good, but I found one minor issue where a TypeChecker.typeNamed call is missing the inSdk: true parameter for a Dart SDK type.

analyzer: ">=7.4.0 <9.0.0"
async: ^2.8.0
build: ^3.0.0
build: ">=3.0.0 <5.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should use ^ syntax to avoid breaking change. same for source gen

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when i use
analyzer: ^8.0.0
build: ^4.0.0
source_gen: ^4.0.0

the build broken due the package: test that in flutter stable is pinned to 1.26.2 (currently not supports analyzer: ^8.0.0)

Because test >=1.25.9 <1.26.3 depends on analyzer >=6.0.0 <8.0.0 and test >=1.21.6 <1.24.4 depends on analyzer >=2.0.0 <6.0.0,
  test >=1.21.6 <1.24.4-∞ or >=1.25.9 <1.26.3-∞ requires analyzer >=2.0.0 <6.0.0 or >=6.0.0 <8.0.0.
And because test >=1.21.0 <1.21.6 depends on analyzer >=2.0.0 <5.0.0, test >=1.21.0 <1.24.4-∞ or >=1.25.9 <1.26.3-∞ requires
  analyzer >=2.0.0 <6.0.0 or >=6.0.0 <8.0.0.

(1) So, because test >=1.24.3 <1.25.13 depends on matcher >=0.12.16 <0.12.17 and test >=1.26.3 depends on test_api 0.7.7, test
>=1.21.0 requires analyzer >=2.0.0 <6.0.0 or >=6.0.0 <8.0.0 or matcher >=0.12.16 <0.12.17 or test_api 0.7.7.

Because test >=1.17.10 <1.20.0 depends on analyzer >=1.0.0 <3.0.0 and test >=1.16.6 <1.17.10 depends on analyzer ^1.0.0, test
  >=1.16.6 <1.20.0 requires analyzer >=1.0.0 <3.0.0.
And because test >=1.20.0 <1.21.2 depends on test_api 0.4.9, test >=1.16.6 <1.21.2 requires analyzer >=1.0.0 <3.0.0 or test_api
  0.4.9.
And because test >=1.21.0 requires analyzer >=2.0.0 <6.0.0 or >=6.0.0 <8.0.0 or matcher >=0.12.16 <0.12.17 or test_api 0.7.7
  (1), test >=1.16.6 requires analyzer >=1.0.0 <6.0.0 or >=6.0.0 <8.0.0 or matcher >=0.12.16 <0.12.17 or test_api 0.4.9 or 0.7.7.

(2) So, because every version of flutter_test from sdk depends on both matcher 0.12.17 and test_api 0.7.6, if flutter_test from sdk
and test >=1.16.6 then analyzer >=1.0.0 <6.0.0 or >=6.0.0 <8.0.0.

Because no versions of source_gen match >4.0.0 <4.0.1 and source_gen >=4.0.1 depends on analyzer ^8.1.1, source_gen >4.0.0
  requires analyzer ^8.1.1.
And because source_gen 4.0.0 depends on build ^3.0.0 and every version of go_router_builder from path depends on build ^4.0.0,
  if source_gen >=4.0.0 and go_router_builder from path then analyzer ^8.1.1.
And because if flutter_test from sdk and test >=1.16.6 then analyzer >=1.0.0 <6.0.0 or >=6.0.0 <8.0.0 (2), one of flutter_test
  from sdk or test >=1.16.6 or source_gen >=4.0.0 or go_router_builder from path must be false.
And because every version of go_router_builder from path depends on source_gen ^4.0.0 and go_router_builder_example depends on
  flutter_test from sdk, test >=1.16.6 is incompatible with go_router_builder from path.
So, because go_router_builder_example depends on both go_router_builder from path and test ^1.17.0, version solving failed.

Copy link
Contributor Author

@NearTox NearTox Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so as a workaround to be able to use the new version of analyzer I ended using version range
Curiously, doing this allows the installation of analyzer ^8
Additionally I think this would an intermediate version in order to be not wait until next flutter version (beta branch contains meta: 1.26.3)
additionally i wish in a near future (next flutter release) migrate away Elements2 like mentioned here PR#9649

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a note the currents checks do a test with both ranges (see Linux analyze stable)

analyzer: ^8.0.0
build: ^4.0.0
source_gen: ^4.0.0

and for downgrade (see Linux analyze_downgraded stable)

analyzer: ^7.0.0
build: ^3.0.0
source_gen: ^3.0.0

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

Successfully merging this pull request may close these issues.

[go_router_builder] Go Router Builder is not compatible with new build_runner 2.8.0
2 participants