Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Platforms added to Gemfile.lock

I'm trying to track down how a couple platforms were added to my Gemfile.lock without explicitly doing so. I must have overlooked these changes when adding new gems but I'm not able to reproduce the same Gemfile.lock platform additions when adding those same Gemfile changes.

Here is the commit where the new platforms were added.

#....
+gem 'sqreen'
+gem 'sanitize'
+

 # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
 gem 'jbuilder', '~> 2.5'
@@ -55,6 +57,8 @@ gem 'postmark-rails'
 group :development, :test do
   # Call 'byebug' anywhere in the code to stop execution and get a debugger console
   gem 'byebug', platform: :mri
+  gem 'capybara'
+  gem 'selenium-webdriver'
 end

And the changes to Gemfile.lock in the same commit:

 PLATFORMS
+  java
   ruby
+  x64-mingw32
+  x86-mingw32
+  x86-mswin32

I tried to reproduce the same modification in a test app but those platforms were not added to the Gemfile.lock

I noticed this when recently pushing to heroku:

Removing `Gemfile.lock` because it was generated on Windows.
remote:        Bundler will do a full resolve so native gems are handled properly.
remote:        This may result in unexpected gem versions being used in your app.
remote:        In rare occasions Bundler may not be able to resolve your dependencies at all.
remote:        https://devcenter.heroku.com/articles/bundler-windows-gemfile

I'm not developing on a windows machine and now platform specific gems are being added to Gemfile.lock for example:

ffi (1.9.18)
ffi (1.9.18-java)
ffi (1.9.18-x64-mingw32)
ffi (1.9.18-x86-mingw32)

I'm not entirely sure how the platforms were added. It's not advisable to modify the lock file directly but to appease the heroku warning should I explore removing all platform specific references and remove the non-ruby platforms in my lock file? Any advice here is welcome.

rails 5.1.3

like image 371
computer_smile Avatar asked Feb 13 '18 07:02

computer_smile


1 Answers

After digging into this with fresh eyes in the morning here's what happened.

I checked my bash history and saw that I ran bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java before the commit I posted in the question. This obviously adds more platforms in your Gemfile.lock and subsequently platform specific dependencies.

I believe I ran this in the terminal to get rid of what I thought was an error around tzinfo-data. More info on that "error" here https://github.com/tzinfo/tzinfo-data/issues/12.

Rather than editing the Gemfile.lock directly, I ran bundle lock --remove-platform x86-mingw32 x86-mswin32 x64-mingw32 java and this made the appropriate edits to my lock file. More info here http://bundler.io/v1.16/bundle_lock.html.

Heroku no longer throwing an error when deploying as expected. Hope this helps someone in the future.

like image 66
computer_smile Avatar answered Oct 23 '22 12:10

computer_smile