SiarheiFedartsou / fastlane-plugin-versioning

Extends fastlane versioning actions. Allows to set/get versions without using agvtool and do some other small tricks.
MIT License
504 stars 60 forks source link

[!] undefined method `split' for nil:NilClass (NoMethodError) #45

Open Robotex opened 4 years ago

Robotex commented 4 years ago

Traceback:

Traceback (most recent call last):
    31: from /Users/robotex/.rbenv/versions/2.5.3/bin/fastlane:23:in `<main>'
    30: from /Users/robotex/.rbenv/versions/2.5.3/bin/fastlane:23:in `load'
    29: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/bin/fastlane:23:in `<top (required)>'
    28: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/cli_tools_distributor.rb:119:in `take_off'
    27: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/commands_generator.rb:41:in `start'
    26: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/commands_generator.rb:349:in `run'
    25: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:in `run!'
    24: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:76:in `run!'
    23: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:in `run_active_command'
    22: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:153:in `run'
    21: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:in `call'
    20: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/commands_generator.rb:108:in `block (2 levels) in run'
    19: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/command_line_handler.rb:36:in `handle'
    18: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/lane_manager.rb:56:in `cruise_lane'
    17: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/runner.rb:45:in `execute'
    16: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/runner.rb:45:in `chdir'
    15: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
    14: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/lane.rb:33:in `call'
    13: from Fastfile:25:in `block (2 levels) in parsing_binding'
    12: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
    11: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/runner.rb:146:in `trigger_action_by_name'
    10: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/runner.rb:204:in `try_switch_to_lane'
     9: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/lane.rb:33:in `call'
     8: from Fastfile:4281:in `block (2 levels) in parsing_binding'
     7: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
     6: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
     5: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/runner.rb:227:in `execute_action'
     4: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/runner.rb:227:in `chdir'
     3: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/runner.rb:235:in `block in execute_action'
     2: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/actions/actions_helper.rb:50:in `execute_action'
     1: from /Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-2.136.0/fastlane/lib/fastlane/runner.rb:256:in `block (2 levels) in execute_action'
/Users/robotex/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fastlane-plugin-versioning-0.4.2/lib/fastlane/plugin/versioning/actions/increment_build_number_in_plist.rb:9:in `run': [!] undefined method `split' for nil:NilClass (NoMethodError)

Code:

increment_build_number_in_plist(target: target, plist_build_setting_support: true)

Edit: we use a incremental integer as build number, maybe the plugin doesn't support it?

jdouglas-nz commented 4 years ago

interesting.. I swear there are tests covering pure ints as build numbers. let me have a look

jdouglas-nz commented 4 years ago

I reckon there is some interesting things to do with specifying a target. the closest test looks like this one.

    it "should increment number to xcodeproj if the value is non literal with plist_build_setting_support: true" do
      result = Fastlane::FastFile.new.parse("lane :test do
        increment_build_number_in_plist(plist_build_setting_support: true)
      end").runner.execute(:test)

      expect(current_xcodeproj_build_number).to eq("2")
      expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::BUILD_NUMBER]).to eq("2")
    end
jdouglas-nz commented 4 years ago

@Robotex - looking at your stack trace - it points to this line: build_array = current_build_number.split(".").map(&:to_i) To me, that looks like it would cover it..

Is it just a single digit, i.e. 1000 / 1 or something like 1.2.3 ? If it's something else, please respond back with a couple examples

simonbromberg commented 3 years ago

Also having this issue. I was able to get the current build number with get_build_number_from_xcodeproj(…) and it is giving me a simple number like I expect (e.g. 2) but when I do increment_build_number_in_xcodeproj it seems (based on the error) that the value it's getting is nil somehow? I am guessing it's trying to get the build number from one of the targets and it can't find it, though I'm not sure which target is the problem. Does it ignore test targets?

Or it just isn't returning anything from get_first_build_number_in_xcodeproj.

In any case, it should probably fail more gracefully rather than crash trying to split a nil value.

Tulean commented 8 months ago

Do we have any solution for this? Trying to use increment_version_number_in_plist(plist_build_setting_support: true) and it is still giving me this error, even after manually updating in xcode UI version # and build #.