Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with cache_all_platforms and specific_platform configured #4042

Merged
merged 4 commits into from Oct 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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