fastlane-plugin-versioning icon indicating copy to clipboard operation
fastlane-plugin-versioning copied to clipboard

`[!] undefined method 'scheme' for an instance of Hash` on `get_build_number_from_xcodeproj.rb:81`

Open corujautx opened this issue 5 months ago • 1 comments

Hi! I'm running on Ruby 3.3.4 and having trouble with this on CI.

This is my call:

latest_build_number = lane_context[SharedValues::LATEST_TESTFLIGHT_BUILD_NUMBER]

current_build_number = get_build_number_from_xcodeproj(
  xcodeproj: XCODEPROJ,
  scheme: options[:scheme],
  build_configuration_name: options[:build_configuration],
  skip_package_dependencies_resolution: true
).to_i

puts("Testflight build number: #{latest_build_number} | Current build number: #{current_build_number}")

if latest_build_number >= current_build_number
  increment_build_number_in_xcodeproj(
    build_number: (latest_build_number + 1).to_s,
    xcodeproj: XCODEPROJ,
    scheme: options[:scheme],
    build_configuration_name: options[:build_configuration],
    skip_package_dependencies_resolution: true
  )
end

And it fails on get_build_number_from_xcodeproj running from GitHub Actions:

/Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-plugin-versioning-0.6.0/lib/fastlane/plugin/versioning/actions/get_build_number_from_xcodeproj.rb:81:in `get_build_number_using_scheme': [!] undefined method `scheme' for an instance of Hash (NoMethodError)

        UI.***_error! "Cannot resolve $(CURRENT_PROJECT_VERSION) in for the scheme #{config.scheme} with the name #{params.configuration}" if build_number.nil? || build_number.empty?
                                                                                            ^^^^^^^
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-plugin-versioning-0.6.0/lib/fastlane/plugin/versioning/actions/get_build_number_from_xcodeproj.rb:19:in `run'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/runner.rb:263:in `block (2 levels) in execute_action'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/actions/actions_helper.rb:69:in `execute_action'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/runner.rb:255:in `block in execute_action'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/runner.rb:229:in `chdir'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/runner.rb:229:in `execute_action'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
    from Fastfile:103:in `block (2 levels) in parsing_binding'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/lane.rb:41:in `call'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/runner.rb:204:in `try_switch_to_lane'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/runner.rb:146:in `trigger_action_by_name'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
    from Fastfile:153:in `block (2 levels) in parsing_binding'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/lane.rb:41:in `call'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/runner.rb:45:in `chdir'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/runner.rb:45:in `execute'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/lane_manager.rb:46:in `cruise_lane'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/command_line_handler.rb:34:in `handle'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/commands_generator.rb:110:in `block (2 levels) in run'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/commander-4.6.0/lib/commander/command.rb:187:in `call'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/commander-4.6.0/lib/commander/command.rb:157:in `run'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/commander-4.6.0/lib/commander/runner.rb:444:in `run_active_command'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:124:in `run!'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/commander-4.6.0/lib/commander/delegates.rb:18:in `run!'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/commands_generator.rb:363:in `run'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/commands_generator.rb:43:in `start'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/cli_tools_distributor.rb:123:in `take_off'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/bin/fastlane:23:in `<top (required)>'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/bin/fastlane:25:in `load'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/bin/fastlane:25:in `<top (required)>'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/cli/exec.rb:58:in `load'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/cli/exec.rb:58:in `kernel_load'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/cli/exec.rb:23:in `run'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/cli.rb:455:in `exec'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/cli.rb:35:in `dispatch'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/cli.rb:29:in `start'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/exe/bundle:28:in `block in <top (required)>'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/exe/bundle:20:in `<top (required)>'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/bin/bundle:25:in `load'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/bin/bundle:25:in `<main>'
/Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-plugin-versioning-0.6.0/lib/fastlane/plugin/versioning/actions/get_build_number_from_xcodeproj.rb:81:in `get_build_number_using_scheme': undefined method `scheme' for an instance of Hash (NoMethodError)

        UI.***_error! "Cannot resolve $(CURRENT_PROJECT_VERSION) in for the scheme #{config.scheme} with the name #{params.configuration}" if build_number.nil? || build_number.empty?
                                                                                            ^^^^^^^
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-plugin-versioning-0.6.0/lib/fastlane/plugin/versioning/actions/get_build_number_from_xcodeproj.rb:19:in `run'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/runner.rb:263:in `block (2 levels) in execute_action'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/actions/actions_helper.rb:69:in `execute_action'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/runner.rb:255:in `block in execute_action'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/runner.rb:229:in `chdir'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/runner.rb:229:in `execute_action'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
    from Fastfile:103:in `block (2 levels) in parsing_binding'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/lane.rb:41:in `call'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/runner.rb:204:in `try_switch_to_lane'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/runner.rb:146:in `trigger_action_by_name'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
    from Fastfile:153:in `block (2 levels) in parsing_binding'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/lane.rb:41:in `call'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/runner.rb:45:in `chdir'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/runner.rb:45:in `execute'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/lane_manager.rb:46:in `cruise_lane'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/command_line_handler.rb:34:in `handle'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/commands_generator.rb:110:in `block (2 levels) in run'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/commander-4.6.0/lib/commander/command.rb:187:in `call'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/commander-4.6.0/lib/commander/command.rb:157:in `run'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/commander-4.6.0/lib/commander/runner.rb:444:in `run_active_command'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:124:in `run!'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/commander-4.6.0/lib/commander/delegates.rb:18:in `run!'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/commands_generator.rb:363:in `run'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/commands_generator.rb:43:in `start'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/fastlane/lib/fastlane/cli_tools_distributor.rb:123:in `take_off'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/gems/fastlane-2.222.0/bin/fastlane:23:in `<top (required)>'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/bin/fastlane:25:in `load'
    from /Users/runner/work/<redacted>/<redacted>/vendor/bundle/ruby/3.3.0/bin/fastlane:25:in `<top (required)>'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/cli/exec.rb:58:in `load'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/cli/exec.rb:58:in `kernel_load'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/cli/exec.rb:23:in `run'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/cli.rb:455:in `exec'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/cli.rb:35:in `dispatch'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/cli.rb:29:in `start'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/exe/bundle:28:in `block in <top (required)>'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/lib/ruby/gems/3.3.0/gems/bundler-2.5.18/exe/bundle:20:in `<top (required)>'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/bin/bundle:25:in `load'
    from /Users/runner/hostedtoolcache/Ruby/3.3.4/arm64/bin/bundle:25:in `<main>'

Not sure what I'm doing wrong here. From what I can see on get_build_number_from_xcodeproj.rb:81 we have a call directly to .scheme from the hash set-up earlier in the function: my Ruby is a bit rusty, but shouldn't it be #{config[:scheme]} instead of #{config.scheme} in the string it is trying to print?

Gemfile.lock has fastlane-plugin-versioning (0.6.0)

corujautx avatar Sep 10 '24 00:09 corujautx