localizely/intl_utils

Upgrade analyzer > 4.0

Closed this issue · 15 comments

Upgrade analyzer > 4.0

When will you update already? How long can I wait?

Hi all,

Could you give us more details regarding how analyzer dependency blocks you?

Also, until we find out what's wrong, does the global usage of the intl_utils package work for you?

flutter pub global activate intl_utils
flutter pub global run intl_utils:generate

Getting below error while running the flutter pub get

Failed to build intl_utils:generate:
../../.pub-cache/hosted/pub.dartlang.org/intl_utils-2.6.1/lib/src/intl_translation/extract_messages.dart:62:8: Error: Error when reading '../../.pub-cache/hosted/pub.dartlang.org/analyzer-4.1.0/lib/dart/ast/standard_ast_factory.dart': No such file or directory
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
^
../../.pub-cache/hosted/pub.dartlang.org/intl_utils-2.6.1/lib/src/intl_translation/extract_messages.dart:209:7: Error: Undefined name 'astFactory'.
astFactory.formalParameterList(Token(TokenType.OPEN_PAREN, 0), [], null,
^^^^^^^^^^
pub finished with exit code 1

This is a blocker for us and cant upgrade to flutter 3.0. Appreciate if you could please prioritize this ticket. Thanks.

@Saurabh-Detharia @prijupaul
Did you try the workaround that @lzoran proposed above?
It should not be a blocker for you that way

Also, until we find out what's wrong, does the global usage of the intl_utils package work for you?

flutter pub global activate intl_utils
flutter pub global run intl_utils:generate

@Saurabh-Detharia @prijupaul Did you try the workaround that @lzoran proposed above? It should not be a blocker for you that way

Also, until we find out what's wrong, does the global usage of the intl_utils package work for you?

flutter pub global activate intl_utils
flutter pub global run intl_utils:generate

Yes, I tried. But it didn't help me.

@Saurabh-Detharia
What issues you have with that workaround?
Assuming you removed intl_utils from dev_dependencies in pubspec.yaml file for the workaround.

The issue was, not removed intl_utils from dependencies in pubspec.yaml file for the workaround.

The above command fixes the issue. However, it does not work from fastlane

sh("flutter pub global run intl_utils:generate")

I have this command in fastlane and it complains it cant find pubspec.yaml file.
Can i provide the path to pubspec.yaml file?

I can't use Drift as a dependency, since it depends on analyzer 4.x or higher, and I use intl_utils for CI/CD.

intl_utils should upgrade from analyzer 2.8.0 to 4.1.0.

Because drift_dev >=1.7.0 depends on analyzer ^4.0.0 and intl_utils 2.6.1 depends on analyzer >=2.0.0 <4.0.0, drift_dev >=1.7.0 is incompatible with intl_utils 2.6.1.
And because no versions of intl_utils match >2.6.1 <3.0.0, drift_dev >=1.7.0 is incompatible with intl_utils ^2.6.1.
So, because eosol_leansteps depends on both intl_utils ^2.6.1 and drift_dev ^1.7.0, version solving failed.

@navaronbracke Did you try using intl_utils in CI/CD as a global dependency?
As suggested here #81 (comment)

Because of technical requirements, we went with another database in the end. Regardless, I'd be happy to look into migrating the package to a newer version of the analyzer, but I haven't heard back from the language team just yet over the AST factory deprecation.

@lzoran I made a dependency override to update to 4.1.0 or 4.2.0 and it crashes:

../../.pub-cache/hosted/pub.dartlang.org/intl_utils-2.6.1/lib/src/intl_translation/extract_messages.dart:62:8: Error: Error when reading '../../.pub-cache/hosted/pub.dartlang.org/analyzer-4.2.0/lib/dart/ast/standard_ast_factory.dart': No such file or directory
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
       ^
../../.pub-cache/hosted/pub.dartlang.org/dart_style-2.2.0/lib/src/source_visitor.dart:5:8: Error: Error when reading '../../.pub-cache/hosted/pub.dartlang.org/analyzer-4.2.0/lib/dart/ast/standard_ast_factory.dart': No such file or directory
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
       ^
../../.pub-cache/hosted/pub.dartlang.org/dart_style-2.2.0/lib/src/source_visitor.dart:2701:22: Error: Type 'TypeName' not found.
  void visitTypeName(TypeName node) {
                     ^^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/intl_utils-2.6.1/lib/src/intl_translation/extract_messages.dart:209:7: Error: Undefined name 'astFactory'.
      astFactory.formalParameterList(Token(TokenType.OPEN_PAREN, 0), [], null,
      ^^^^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/dart_style-2.2.0/lib/src/source_visitor.dart:1276:14: Error: Undefined name 'astFactory'.
      return astFactory.propertyAccess(
             ^^^^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/dart_style-2.2.0/lib/src/source_visitor.dart:1284:14: Error: Undefined name 'astFactory'.
      return astFactory.methodInvocation(
             ^^^^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/dart_style-2.2.0/lib/src/source_visitor.dart:1302:14: Error: Undefined name 'astFactory'.
      return astFactory.indexExpressionForTarget2(
             ^^^^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/dart_style-2.2.0/lib/src/source_visitor.dart:1326:21: Error: The getter 'astFactory' isn't defined for the class 'SourceVisitor'.
 - 'SourceVisitor' is from 'package:dart_style/src/source_visitor.dart' ('../../.pub-cache/hosted/pub.dartlang.org/dart_style-2.2.0/lib/src/source_visitor.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'astFactory'.
    var newTarget = astFactory.parenthesizedExpression(
                    ^^^^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/dart_style-2.2.0/lib/src/source_visitor.dart:1337:11: Error: The getter 'astFactory' isn't defined for the class 'SourceVisitor'.
 - 'SourceVisitor' is from 'package:dart_style/src/source_visitor.dart' ('../../.pub-cache/hosted/pub.dartlang.org/dart_style-2.2.0/lib/src/source_visitor.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'astFactory'.
    visit(astFactory.expressionStatement(
          ^^^^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/dart_style-2.2.0/lib/src/source_visitor.dart:1338:9: Error: The getter 'astFactory' isn't defined for the class 'SourceVisitor'.
 - 'SourceVisitor' is from 'package:dart_style/src/source_visitor.dart' ('../../.pub-cache/hosted/pub.dartlang.org/dart_style-2.2.0/lib/src/source_visitor.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'astFactory'.
        astFactory.cascadeExpression(newTarget, cascade.cascadeSections),
        ^^^^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/dart_style-2.2.0/lib/src/source_visitor.dart:1357:13: Error: The getter 'astFactory' isn't defined for the class 'SourceVisitor'.
 - 'SourceVisitor' is from 'package:dart_style/src/source_visitor.dart' ('../../.pub-cache/hosted/pub.dartlang.org/dart_style-2.2.0/lib/src/source_visitor.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'astFactory'.
      visit(astFactory.assignmentExpression(
            ^^^^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/dart_style-2.2.0/lib/src/source_visitor.dart:2701:22: Error: 'TypeName' isn't a type.
  void visitTypeName(TypeName node) {
                     ^^^^^^^^

I require that this support 4.1.0 or greater because I use chopper and it requires 4.1.0 or more :(

Because intl_utils 2.6.1 depends on analyzer >=2.0.0 <4.0.0 and chopper_generator 4.0.6 depends on analyzer ^4.1.0, intl_utils 2.6.1 is incompatible with chopper_generator 4.0.6.
So, because client depends on both chopper_generator 4.0.6 and intl_utils 2.6.1, version solving failed.
pub get failed (1; So, because client depends on both chopper_generator 4.0.6 and intl_utils 2.6.1, version solving failed.)

There is PR for this issue (PR#83).
I believe that we will release the new version with a fix soon.

Until we release it, maybe using the package from GitHub might help.

dev_dependencies:
  intl_utils:
    git:
      url: https://github.com/Freedomiza/intl_utils
      ref: master

This issue should be fixed with the latest version - intl_utils 2.7.0.

Closing this ticket now.
Please feel free to reply/reopen if the problem still exists.