Skip to content

Commit

Permalink
Merge pull request #4042 from rubygems/another_cache_plus_specific_pl…
Browse files Browse the repository at this point in the history
…atform_issue

Fix issue with `cache_all_platforms` and `specific_platform` configured

(cherry picked from commit e0f6ce6)
  • Loading branch information
deivid-rodriguez committed Dec 7, 2020
1 parent 1ab5489 commit deabba7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bundler/lib/bundler/installer.rb
Expand Up @@ -299,7 +299,7 @@ def create_bundle_path

# returns whether or not a re-resolve was needed
def resolve_if_needed(options)
if !@definition.unlocking? && !options["force"] && !options["all-platforms"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
if !@definition.unlocking? && !options["force"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
return false if @definition.nothing_changed? && !@definition.missing_specs?
end

Expand Down
1 change: 1 addition & 0 deletions bundler/lib/bundler/spec_set.rb
Expand Up @@ -100,6 +100,7 @@ def materialized_for_all_platforms
@specs.map do |s|
next s unless s.is_a?(LazySpecification)
s.source.dependency_names = names if s.source.respond_to?(:dependency_names=)
s.source.remote!
spec = s.__materialize__
raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
spec
Expand Down
19 changes: 17 additions & 2 deletions bundler/spec/install/gemfile/specific_platform_spec.rb
Expand Up @@ -25,12 +25,27 @@
])
end

it "caches both the universal-darwin and ruby gems when --all-platforms is passed" do
it "caches both the universal-darwin and ruby gems when --all-platforms is passed and properly picks them up on further bundler invocations" do
setup_multiplatform_gem
gemfile(google_protobuf)
bundle "package --all-platforms"
bundle "cache --all-platforms"
expect([cached_gem("google-protobuf-3.0.0.alpha.5.0.5.1"), cached_gem("google-protobuf-3.0.0.alpha.5.0.5.1-universal-darwin")]).
to all(exist)

bundle "install --verbose"
expect(err).to be_empty
end

it "caches both the universal-darwin and ruby gems when cache_all_platforms is configured and properly picks them up on further bundler invocations" do
setup_multiplatform_gem
gemfile(google_protobuf)
bundle "config set --local cache_all_platforms true"
bundle "cache"
expect([cached_gem("google-protobuf-3.0.0.alpha.5.0.5.1"), cached_gem("google-protobuf-3.0.0.alpha.5.0.5.1-universal-darwin")]).
to all(exist)

bundle "install --verbose"
expect(err).to be_empty
end

it "caches multiplatform git gems with a single gemspec when --all-platforms is passed" do
Expand Down

0 comments on commit deabba7

Please sign in to comment.