Search code examples
iosbundlergemfilegemfile.lockjazzy

Why does my iOS project Gemfile bundle update unconsistently?


I have a simple Gemfile for an iOS project using cocoapods:

# frozen_string_literal: true
source "https://rubygems.org"

gem 'cocoapods'
gem 'fastlane'
gem 'jazzy'

I've tried to update my bundle by a bundle update and jazzy went from version 0.8.2 to 0.0.14 so I rolled back my Gemfile.lock and did 3 invidual updates of my 3 gems and everything went fine, ie jazzy was still in version 0.8.2.

I redid a bundle update and, again, jazzy went from version 0.8.2 to 0.0.14.

What am I missing here? Why do I get a different set of versions with the same constraints?

A gist with more details about the content of the files: https://gist.github.com/dirtyhenry/135ec7ef73f873d5ac3236bc3da633ba


Solution

  • The issue is dependency hell.

    Fastlane depends on xcpretty, which depends on rouge of major version 2 (~>2.0.7) and jazzy itself depends on different versions of rouge, major version 1 (~> 1.5) so, bundler tries to resolve highest version of jazzy to reuse existing rouge dependency (which is 0.0.14).

    However, you can force bundler to use version 0.8.2 an more of jazzy, add to your Gemfile:

    gem 'jazzy', '>=0.8.2'
    

    instead of

    gem 'jazzy'
    

    And perform bundle update again.

    See more details on versioning in bundler docs