Skip to content

Conversation

@NatsuOnFire
Copy link
Contributor

No description provided.

@cla-bot cla-bot bot added the cla: yes label Nov 6, 2025
@NatsuOnFire NatsuOnFire force-pushed the update_source_gen_v4 branch 6 times, most recently from 666d445 to dc59fd5 Compare November 12, 2025 22:17
@nirinchev nirinchev requested a review from Copilot December 1, 2025 02:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request upgrades the source_gen dependency to version 4.0.0 and updates related dependencies across the repository. This upgrade requires changes to accommodate breaking API changes in the analyzer and build_test packages, including the transition from deprecated element APIs to newer fragment-based APIs.

Key changes:

  • Updated source_gen from 2.0.0 to 4.0.0 and analyzer from 7.3.0 to 8.0.0
  • Migrated from deprecated element APIs (name, enclosingElement3, parameters, etc.) to newer alternatives (displayName, enclosingElement, formalParameters)
  • Updated test utilities to use new build_test v3.0.0 API (result.readerWriter instead of InMemoryAssetWriter)

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/realm_generator/pubspec.yaml Updated core dependencies including source_gen, analyzer, build, and build_test
packages/realm_generator/test/test_util.dart Migrated test builder usage from InMemoryAssetWriter to result.readerWriter API
packages/realm_generator/test/common.dart Changed from AnalysisError to Diagnostic for error handling
packages/realm_generator/lib/src/type_checkers.dart Replaced TypeChecker.fromRuntime with TypeChecker.typeNamed
packages/realm_generator/lib/src/realm_field_info.dart Updated field name access from name to displayName
packages/realm_generator/lib/src/field_element_ex.dart Migrated multiple deprecated element APIs to current versions
packages/realm_generator/lib/src/error.dart Changed enclosingElement3 to enclosingElement
packages/realm_generator/lib/src/element.dart Updated from getElementDeclaration to getFragmentDeclaration API
packages/realm_generator/lib/src/dart_type_ex.dart Replaced TypeChecker.fromRuntime with TypeChecker.typeNamed and added package specifications
packages/realm_generator/lib/src/class_element_ex.dart Changed name to displayName for element access
packages/ejson_lint/pubspec.yaml Updated analyzer and custom_lint_builder dependencies
packages/ejson_lint/lib/src/lints/*.dart Migrated lint rules to use DiagnosticSeverity, DiagnosticReporter, and fragment-based APIs
packages/ejson_generator/pubspec.yaml Updated source_gen, analyzer, build, and build_test dependencies
packages/ejson_generator/test/compile_test.dart Migrated test builder usage to result.readerWriter API
packages/ejson_generator/lib/src/generator.dart Changed from parameters to formalParameters and name to displayName
packages/ejson_analyzer/pubspec.yaml Updated analyzer and source_gen dependencies
packages/ejson_analyzer/lib/src/ejson_analyzer_base.dart Replaced TypeChecker.fromRuntime with TypeChecker.typeNamed
packages/*/pubspec.yaml Updated SDK constraint to ^3.7.0 and various lints/test dependencies
CHANGELOG.md Documented the dependency updates

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@NatsuOnFire NatsuOnFire force-pushed the update_source_gen_v4 branch 2 times, most recently from 35ca095 to ca18d1b Compare December 1, 2025 09:47
@NatsuOnFire
Copy link
Contributor Author

@nirinchev
I don't understand why the CI isn't working. Do you have any idea?

@mszczesniak94
Copy link

mszczesniak94 commented Dec 2, 2025

@NatsuOnFire I checked your branch (with flutter 3.35.5) and when running melos bs I encountered issues with the realm_tests package:

  - realm_tests
    └> packages/realm/tests
       └> Failed to install.

Resolving dependencies...
Note: test_api is pinned to version 0.7.6 by flutter_test from the flutter SDK.
See https://dart.dev/go/sdk-version-pinning for details.
Because test >=1.27.0 depends on test_api 0.7.8 and test >=1.26.3 <1.27.0 depends on test_api 0.7.7, test >=1.26.3 requires test_api 0.7.7 or 0.7.8.
And because every version of flutter_test from sdk depends on test_api 0.7.6, flutter_test from sdk is incompatible with test >=1.26.3.
So, because realm_tests depends on both flutter_test from sdk and test ^1.26.3, version solving failed.
Failed to update packages.
BootstrapException: Failed to install.: realm_tests at /Users/marcinszczesniak/Mobile/realm-dart/packages/realm/tests.

It seems that the dependencies require a higher version of test_api than the one bundled with the current Flutter SDK. If you want to revert to an older test_api, it looks like analytics would also need to be downgraded from version 8 to 7.

One solution I found is that the latest Flutter version (^3.38) satisfies the required test_api constraints, and the bootstrap process completes successfully.

So it appears you may need to either downgrade some dependencies or upgrade Flutter to ^3.38.0 (I checked you branch with flutter 3.38.3 and everything seems ok)

Hope this helps!

@NatsuOnFire
Copy link
Contributor Author

NatsuOnFire commented Dec 2, 2025

Thanks @mszczesniak94
I upgrade all packages to test 1.27 and flutter 3.38 🙂

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants