If you vendorize a gemset that includes google-cloud-ruby (bundle package --all), the vendor folder will only include the google-protobuf .gem for the current platform. This results in a missing gem error if you try to bundle install --local on another platform.
For example: if I bundle package --all on OS X, vendor/cache will include google-protobuf-3.3.0-universal-darwin.gem. If I try to run bundle install --local inside a Docker container, the install fails because google-protobuf-3.3.0-x86_64-linux.gem does not exist.
As a workaround, it's possible to manually copy the set of platform variants into vendor/cache. But it's a bit of an annoyance since this has to be done each time you update the version of the gem.
This looks like a Bundler issue to me. Can you suggest any changes we can make to support the behavior you are looking for?
My understanding is that for Bundler to support multiple platforms you need to add the platform using bundle lock, and then to package using the --all-platforms option. But in my tests this doesn't work right, as I'm seeing the same behavior described in bundler/bundler#5863.
Thanks for the lead! Did some more tracing and there is a bug/undocumented quirk in bundler 1.15.1 where the --all-platforms flag doesn't work unless the specific_feature feature flag is tripped.
Here's what ended up working for me:
bundle config specific_platform true
bundle lock --add-platform=x86_64-linux
bundle package --all-platforms
This results in a vendor/cache with
google-protobuf-3.3.0-universal-darwin.gem
google-protobuf-3.3.0-x86_64-linux.gem
google-protobuf-3.3.0.gem
which works nicely because the platform-less version will compile at bundle install time on platforms without specific entries in vendor/cache.
Glad you figured it out. Thanks for sharing the solution!
Most helpful comment
Thanks for the lead! Did some more tracing and there is a bug/undocumented quirk in bundler 1.15.1 where the
--all-platformsflag doesn't work unless thespecific_featurefeature flag is tripped.Here's what ended up working for me:
This results in a vendor/cache with
which works nicely because the platform-less version will compile at
bundle installtime on platforms without specific entries in vendor/cache.