tianhaoz95 / fastlane-plugin-flutter_version

Fastlane plugin to retrieve version code for Flutter projects.
https://tianhaoz95.github.io/fastlane-plugin-flutter_version
MIT License
107 stars 14 forks source link

[BUG] "Read pubspec.yaml failed" on a YAML file that contains aliases on Ruby 3+ #223

Open derTuca opened 1 year ago

derTuca commented 1 year ago

Describe the bug "Read pubspec.yaml failed" on a YAML file that contains aliases on Linux (Fedora 38, tried using both bash and zsh). The same project works fine on macOS Ventura.

In the case of the yaml file below, the relevant alias is isar_version.

To Reproduce Steps to reproduce the behavior:

  1. Use the pubspec.yaml file attached below
  2. Use flutter_version in android/fastlane/Fastfile
  3. Run the fastlane lane
  4. See error

Expected behavior The YAML file should be parsed successfully.

Desktop (please complete the following information):

Additional context YAML file:

name: app
description: App client app

publish_to: "none"

version: 1.1.2+33

environment:
  sdk: ">=3.0.0 <4.0.0"

isar_version: &isar_version 3.1.0+1
dependencies:
  another_flushbar: ^1.12.30
  asn1lib: ^1.4.1
  auto_route: ^7.4.0
  auto_size_text: ^3.0.0
  background_locator_2: ^2.0.6
  clock: ^1.1.1
  collection: ^1.17.1
  convenient_test: ^1.2.1
  cupertino_icons: ^1.0.5
  dartz: ^0.10.1
  dio: ^5.2.1+1
  dio_http2_adapter: ^2.3.0
  dio_smart_retry: ^5.0.0
  easy_localization: ^3.0.2
  fast_rsa: ^3.5.7
  flutter:
    sdk: flutter
  flutter_blurhash: ^0.7.0
  flutter_carousel_widget: ^2.0.4
  flutter_dialogs: ^3.0.0
  flutter_dotenv: ^5.1.0
  flutter_hooks: ^0.20.0
  flutter_image_compress: ^2.0.3
  flutter_map: ^5.0.0
  flutter_map_animations: ^0.4.0
  flutter_map_location_marker: ^7.0.0
  # TODO: Use version once plugin is updated to support Flutter Map v5 ( https://github.com/lpongetti/flutter_map_marker_cluster )
  flutter_map_marker_cluster:
    git:
      url: https://github.com/andreystavitsky/flutter_map_marker_cluster.git
      ref: master
  flutter_map_tile_caching: ^9.0.0-dev.3
  flutter_secure_storage: ^8.0.0
  flutter_svg: ^2.0.7
  freezed_annotation: ^2.2.0
  geolocator: ^9.0.2
  hooks_riverpod: ^2.3.6
  http_parser: ^4.0.2
  image_picker: ^1.0.0
  infinite_scroll_pagination: ^3.2.0
  isar: *isar_version
  isar_flutter_libs: *isar_version
  json_annotation: ^4.8.1
  jwt_decoder: ^2.0.1
  latlong2: ^0.9.0
  logger: ^2.0.1
  onesignal_flutter: ^3.5.0
  open_mail_app: ^0.4.5
  package_info_plus: ^4.0.2
  path_provider: ^2.0.15
  permission_handler: ^10.3.0
  pointycastle: ^3.7.3
  pretty_dio_logger: ^1.3.1
  restart_app: ^1.2.1
  retrofit: ^4.0.1
  riverpod_annotation: ^2.1.1
  sentry_dio: ^7.8.0
  sentry_flutter: ^7.8.0
  shared_preferences: ^2.1.2
  shimmer: ^3.0.0
  sliver_tools: ^0.2.10
  socket_io_client: ^2.0.2
  stack_trace: ^1.11.0
  timeago: ^3.3.0
  transparent_pointer: ^1.0.0
  tuple: ^2.0.2
  url_launcher: ^6.1.11
  visibility_detector: ^0.4.0+2
  web_socket_channel: ^2.4.0

dev_dependencies:
  auto_route_generator: ^7.1.1
  build_runner: ^2.4.4
  convenient_test_dev: ^1.3.0
  custom_lint: ^0.4.0
  darq: ^2.0.0
  flutter_flavorizr: ^2.2.1
  flutter_launcher_icons: ^0.13.1
  flutter_native_splash: ^2.3.1
  flutter_test:
    sdk: flutter
  freezed: ^2.3.4
  integration_test:
    sdk: flutter
  isar_generator: *isar_version
  json_serializable: ^6.7.0
  mockito: ^5.4.1
  retrofit_generator: ^7.0.2
  riverpod_generator: ^2.2.3
  riverpod_lint: ^1.4.0
  sentry_dart_plugin: ^1.0.0
  surf_lint_rules: ^3.0.0

Error log:

/home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-plugin-flutter_version-1.1.15/lib/fastlane/plugin/flutter_version/actions/flutter_version_action.rb:18:in `rescue in run': \e[31m[!] Read pubspec.yaml failed\e[0m (RuntimeError)
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-plugin-flutter_version-1.1.15/lib/fastlane/plugin/flutter_version/actions/flutter_version_action.rb:14:in `run'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/runner.rb:263:in `block (2 levels) in execute_action'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/actions/actions_helper.rb:69:in `execute_action'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/runner.rb:255:in `block in execute_action'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/runner.rb:229:in `chdir'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/runner.rb:229:in `execute_action'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
        from Fastfile:49:in `block (2 levels) in parsing_binding'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/lane.rb:33:in `call'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/runner.rb:45:in `chdir'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/runner.rb:45:in `execute'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/lane_manager.rb:47:in `cruise_lane'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/command_line_handler.rb:36:in `handle'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/commands_generator.rb:110:in `block (2 levels) in run'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/commander-4.6.0/lib/commander/command.rb:187:in `call'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/commander-4.6.0/lib/commander/command.rb:157:in `run'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/commander-4.6.0/lib/commander/runner.rb:444:in `run_active_command'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:124:in `run!'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/commander-4.6.0/lib/commander/delegates.rb:18:in `run!'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/commands_generator.rb:354:in `run'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/commands_generator.rb:43:in `start'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/cli_tools_distributor.rb:123:in `take_off'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/bin/fastlane:23:in `<top (required)>'
        from /home/alex/.rbenv/versions/3.1.2/bin/fastlane:25:in `load'
        from /home/alex/.rbenv/versions/3.1.2/bin/fastlane:25:in `<top (required)>'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/cli/exec.rb:58:in `load'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/cli/exec.rb:58:in `kernel_load'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/cli/exec.rb:23:in `run'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/cli.rb:492:in `exec'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/cli.rb:34:in `dispatch'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/cli.rb:28:in `start'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/exe/bundle:45:in `block in <top (required)>'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/exe/bundle:33:in `<top (required)>'
        from /home/alex/.rbenv/versions/3.1.2/bin/bundle:25:in `load'
        from /home/alex/.rbenv/versions/3.1.2/bin/bundle:25:in `<main>'
/home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:430:in `visit_Psych_Nodes_Alias': Unknown alias: isar_version (Psych::BadAlias)
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:345:in `block in revive_hash'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each_slice'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `revive_hash'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:167:in `visit_Psych_Nodes_Mapping'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:345:in `block in revive_hash'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each_slice'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `revive_hash'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:167:in `visit_Psych_Nodes_Mapping'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:318:in `visit_Psych_Nodes_Document'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych.rb:335:in `safe_load'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych.rb:370:in `load'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych.rb:671:in `block in load_file'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych.rb:670:in `open'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych.rb:670:in `load_file'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-plugin-flutter_version-1.1.15/lib/fastlane/plugin/flutter_version/actions/flutter_version_action.rb:15:in `run'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/runner.rb:263:in `block (2 levels) in execute_action'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/actions/actions_helper.rb:69:in `execute_action'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/runner.rb:255:in `block in execute_action'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/runner.rb:229:in `chdir'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/runner.rb:229:in `execute_action'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
        from Fastfile:49:in `block (2 levels) in parsing_binding'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/lane.rb:33:in `call'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/runner.rb:45:in `chdir'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/runner.rb:45:in `execute'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/lane_manager.rb:47:in `cruise_lane'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/command_line_handler.rb:36:in `handle'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/commands_generator.rb:110:in `block (2 levels) in run'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/commander-4.6.0/lib/commander/command.rb:187:in `call'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/commander-4.6.0/lib/commander/command.rb:157:in `run'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/commander-4.6.0/lib/commander/runner.rb:444:in `run_active_command'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:124:in `run!'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/commander-4.6.0/lib/commander/delegates.rb:18:in `run!'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/commands_generator.rb:354:in `run'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/commands_generator.rb:43:in `start'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/fastlane/lib/fastlane/cli_tools_distributor.rb:123:in `take_off'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/fastlane-2.214.0/bin/fastlane:23:in `<top (required)>'
        from /home/alex/.rbenv/versions/3.1.2/bin/fastlane:25:in `load'
        from /home/alex/.rbenv/versions/3.1.2/bin/fastlane:25:in `<top (required)>'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/cli/exec.rb:58:in `load'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/cli/exec.rb:58:in `kernel_load'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/cli/exec.rb:23:in `run'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/cli.rb:492:in `exec'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/cli.rb:34:in `dispatch'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/cli.rb:28:in `start'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/exe/bundle:45:in `block in <top (required)>'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
        from /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.10/exe/bundle:33:in `<top (required)>'
        from /home/alex/.rbenv/versions/3.1.2/bin/bundle:25:in `load'
        from /home/alex/.rbenv/versions/3.1.2/bin/bundle:25:in `<main>'
welcome[bot] commented 1 year ago

Thanks for opening your first issue here!

tianhaoz95 commented 1 year ago

Interesting, looks like the parser doesn't like isar_version alias, but by just looking at it I'm not sure how that could happen... Let me find some time to repro this.

derTuca commented 1 year ago

That's what struck me as well but the really weird fact is that the same file works on my Mac. I'll also try it on Windows when I get my hands on that.

Take all the time that you need, thanks!

derTuca commented 1 year ago

Ok, the issue seems to be with the Ruby version. On the mac I had Ruby 2.6.10 and on Fedora I had Ruby 3.1.2. I've installed Ruby 3.1.2 on the Mac and it stopped working on there as well.

[EDIT] Ruby 3.1.4 and 3.2.2 also do not work.

simplenotezy commented 3 months ago

Can confirm we have the same issue

simplenotezy commented 3 months ago

But I do not think it is related to ruby version, as we have another version running version 3, without issues

simplenotezy commented 3 months ago

@tianhaoz95 I've tried a few different things but it keeps failing

simplenotezy commented 3 months ago

Also just tried downgrading with rbenv to 2.6.10:

/Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-plugin-flutter_version-1.1.15/lib/fastlane/plugin/flutter_version/actions/flutter_version_action.rb:18:in `rescue in run': [!] Read pubspec.yaml failed (RuntimeError)
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-plugin-flutter_version-1.1.15/lib/fastlane/plugin/flutter_version/actions/flutter_version_action.rb:14:in `run'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/runner.rb:263:in `block (2 levels) in execute_action'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/actions/actions_helper.rb:69:in `execute_action'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/runner.rb:255:in `block in execute_action'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/runner.rb:229:in `chdir'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/runner.rb:229:in `execute_action'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
    from Fastfile:10:in `get_version_name'
    from Fastfile:55:in `block (2 levels) in parsing_binding'
    from Fastfile:53:in `chdir'
    from Fastfile:53:in `block in parsing_binding'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/lane.rb:41:in `call'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/runner.rb:45:in `chdir'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/runner.rb:45:in `execute'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/lane_manager.rb:46:in `cruise_lane'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/command_line_handler.rb:34:in `handle'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/commands_generator.rb:110:in `block (2 levels) in run'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/commander-4.6.0/lib/commander/command.rb:187:in `call'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/commander-4.6.0/lib/commander/command.rb:157:in `run'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/commander-4.6.0/lib/commander/runner.rb:444:in `run_active_command'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:124:in `run!'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/commander-4.6.0/lib/commander/delegates.rb:18:in `run!'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/commands_generator.rb:363:in `run'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/commands_generator.rb:43:in `start'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/cli_tools_distributor.rb:123:in `take_off'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/bin/fastlane:23:in `<top (required)>'
    from /Users/mf/.rbenv/versions/2.6.10/bin/fastlane:23:in `load'
    from /Users/mf/.rbenv/versions/2.6.10/bin/fastlane:23:in `<main>'
/Users/mf/.rbenv/versions/2.6.10/lib/ruby/2.6.0/psych.rb:577:in `initialize': No such file or directory @ rb_sysopen - ../pubspec.yaml (Errno::ENOENT)
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/2.6.0/psych.rb:577:in `open'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/2.6.0/psych.rb:577:in `load_file'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-plugin-flutter_version-1.1.15/lib/fastlane/plugin/flutter_version/actions/flutter_version_action.rb:15:in `run'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/runner.rb:263:in `block (2 levels) in execute_action'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/actions/actions_helper.rb:69:in `execute_action'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/runner.rb:255:in `block in execute_action'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/runner.rb:229:in `chdir'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/runner.rb:229:in `execute_action'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
    from Fastfile:10:in `get_version_name'
    from Fastfile:55:in `block (2 levels) in parsing_binding'
    from Fastfile:53:in `chdir'
    from Fastfile:53:in `block in parsing_binding'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/lane.rb:41:in `call'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/runner.rb:45:in `chdir'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/runner.rb:45:in `execute'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/lane_manager.rb:46:in `cruise_lane'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/command_line_handler.rb:34:in `handle'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/commands_generator.rb:110:in `block (2 levels) in run'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/commander-4.6.0/lib/commander/command.rb:187:in `call'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/commander-4.6.0/lib/commander/command.rb:157:in `run'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/commander-4.6.0/lib/commander/runner.rb:444:in `run_active_command'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:124:in `run!'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/commander-4.6.0/lib/commander/delegates.rb:18:in `run!'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/commands_generator.rb:363:in `run'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/commands_generator.rb:43:in `start'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/fastlane/lib/fastlane/cli_tools_distributor.rb:123:in `take_off'
    from /Users/mf/.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/fastlane-2.220.0/bin/fastlane:23:in `<top (required)>'
    from /Users/mf/.rbenv/versions/2.6.10/bin/fastlane:23:in `load'
    from /Users/mf/.rbenv/versions/2.6.10/bin/fastlane:23:in `<main>'
simplenotezy commented 3 months ago

Also uninstalled rbenv and tried installing fastlane with brew; same result unfortunately

simplenotezy commented 3 months ago

What's interesting is, if I remove the build number from the version code in pubspec it fails with:

[!] Verson code indicator (+) not found in pubspec.yml (RuntimeError)

So it does indeed read from the file

nt4f04uNd commented 3 months ago

In my case the reason was actually that inside Fastlane script I changed the working folder to be something else, so the default relative path ../pubspec.yaml would no longer be valid.

But I found that it's possible to change it via PUBSPEC_LOCATION env variable, so in case of GitHub actions it would look like this:

    - name: 🚀🤖 Build & deploy Android release
      shell: bash
      run: |
        cd android
        bundle exec fastlane android beta
      env:
        PUBSPEC_LOCATION: ${{ github.workspace }}/pubspec.yaml
simplenotezy commented 3 months ago

In my case the reason was actually that inside Fastlane script I changed the working folder to be something else, so the default relative path ../pubspec.yaml would no longer be valid.

But I found that it's possible to change it via PUBSPEC_LOCATION env variable, so in case of GitHub actions it would look like this:


    - name: 🚀🤖 Build & deploy Android release

      shell: bash

      run: |

        cd android

        bundle exec fastlane android beta

      env:

        PUBSPEC_LOCATION: ${{ github.workspace }}/pubspec.yaml

Thanks. That wasn't my case, as I tested that by removing the build number. That would lead to a different error, meaning that it would actually read the pubspec file

thealmamun commented 1 month ago

for me it works like this

`lane :version_number_flutter do vcode = flutter_version( pubspec_location: './pubspec.yaml', should_omit_version_code: true)["version_name"]

puts "Formatted build prefix: #{vcode}"

end`