summaryrefslogtreecommitdiff
path: root/lib/bundler/resolver.rb
AgeCommit message (Collapse)Author
2024-04-01[rubygems/rubygems] Improve error message when strict resolution filters out ↵David Rodriguez
everything https://github.com/rubygems/rubygems/commit/1ea44b3749
2024-04-01[rubygems/rubygems] Keep unfiltered versions separatelyDavid Rodriguez
https://github.com/rubygems/rubygems/commit/7b5cc51a96
2024-04-01[rubygems/rubygems] No need to check for root package every timeDavid Rodriguez
https://github.com/rubygems/rubygems/commit/6ca192649f
2024-04-01[rubygems/rubygems] No need for any version prioritization when building errorsDavid Rodriguez
We just need to filter versions belonging to the range, but don't need anything else. https://github.com/rubygems/rubygems/commit/8355a225d7
2024-04-01[rubygems/rubygems] Make it look more like BasicPackageSourceDavid Rodriguez
https://github.com/rubygems/rubygems/commit/bb5727934c
2024-04-01[rubygems/rubygems] Let GemVersionPromoter sort in preferred order directlyDavid Rodriguez
So that we don't need to reverse the Array. https://github.com/rubygems/rubygems/commit/aeea5e2e00
2024-04-01[rubygems/rubygems] No need to sort twice when filling versionsDavid Rodriguez
https://github.com/rubygems/rubygems/commit/13294528c4
2024-04-01[rubygems/rubygems] Rename method for clarityDavid Rodriguez
And also so that it matches the method used by main PubGrub sample resolver class. https://github.com/rubygems/rubygems/commit/0e612361b8
2023-12-07[rubygems/rubygems] Use modern hashes consistentlyDavid Rodríguez
https://github.com/rubygems/rubygems/commit/bb66253f2c
2023-10-16[rubygems/rubygems] Raise an error when top level dependency does not ↵David Rodríguez
resolve under all locked platforms https://github.com/rubygems/rubygems/commit/25304f3e8d
2023-10-16[rubygems/rubygems] Tweak platform mismatch resolution errorsDavid Rodríguez
https://github.com/rubygems/rubygems/commit/20460bc1ee
2023-10-03[rubygems/rubygems] Don't re-resolve with prereleases if unlocked gem has no ↵David Rodriguez
prereleases https://github.com/rubygems/rubygems/commit/d76dc70d90
2023-08-28[rubygems/rubygems] Don't check for circular deps on full index sourcesDavid Rodríguez
https://github.com/rubygems/rubygems/commit/d275cdccb1
2023-08-28[rubygems/rubygems] Refactor Fetcher#api_fetcher? and fetcher loading logicMartin Emde
https://github.com/rubygems/rubygems/commit/f664d60114
2023-06-20Merge rubygems/rubygems HEADHiroshi SHIBATA
Pick from https://github.com/rubygems/rubygems/commit/880dd95996c93adc1e032399816931b243c5fe17 Notes: Merged: https://github.com/ruby/ruby/pull/7961
2023-03-17Don´t consider platform specific candidates when `force_ruby_platform` setDavid Rodríguez
This was working fine for direct dependencies using `force_ruby_platform` explicitly through Gemfile, but not for indirect dependencies. In general, indirect dependencies do not have this property set, but in truffleruby this is different and the default value is to have it set.
2023-03-17Don't ignore pre-releases when there's only one candidateDavid Rodríguez
This should be a very rare edge case, however, it does happen when using a .dev version of Bundler because in that case, that's the only version that the resolver considers, and it should not be ignored. We could've special cased this specifically for Bundler, but I think it does make sense for every gem.
2023-02-21Merge rubygems/bundler masterHiroshi SHIBATA
Pick from https://github.com/rubygems/rubygems/commit/e9304aed7e43308b99e70c2f7b92028315fee8a5 Notes: Merged: https://github.com/ruby/ruby/pull/7345
2023-01-31Merge RubyGems/Bundler master.Hiroshi SHIBATA
Pick from https://github.com/rubygems/rubygems/commit/5ace20dbecfeaf09fba5f616193f3cfcff70ba00 Notes: Merged: https://github.com/ruby/ruby/pull/7203
2023-01-10Merge RubyGems and Bundler masterHiroshi SHIBATA
from https://github.com/rubygems/rubygems/commit/0635c1423db5d7c461d53bf0c3329bca75de7609 Notes: Merged: https://github.com/ruby/ruby/pull/7094
2023-01-10[rubygems/rubygems] Fix resolver edge caseDavid Rodríguez
Let it deal with legacy gems with equivalent version and different dependencies. https://github.com/rubygems/rubygems/commit/b430babe97
2022-12-25Update Bundler to 2.4.1 & and RubyGems to 3.4.1David Rodríguez
Notes: Merged: https://github.com/ruby/ruby/pull/7020
2022-12-24Merge RubyGems-3.4.0 and Bundler-2.4.0Hiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/6987
2022-12-20[rubygems/rubygems] Fix crash when building resolution errors with OR ↵David Rodríguez
requirements https://github.com/rubygems/rubygems/commit/8f287479bc Notes: Merged: https://github.com/ruby/ruby/pull/6966
2022-12-20[rubygems/rubygems] Slight tweak to error message buildingDavid Rodríguez
Let Pub Grub decide how the constraint should be displayed. https://github.com/rubygems/rubygems/commit/4f651b6429 Notes: Merged: https://github.com/ruby/ruby/pull/6966
2022-12-20[rubygems/rubygems] Detect circular dependency errorsDavid Rodríguez
https://github.com/rubygems/rubygems/commit/a8348d271d Notes: Merged: https://github.com/ruby/ruby/pull/6966
2022-12-20[rubygems/rubygems] Remove dead logicDavid Rodríguez
https://github.com/rubygems/rubygems/commit/950615405e Notes: Merged: https://github.com/ruby/ruby/pull/6966
2022-12-20[rubygems/rubygems] Extract a variable for consistencyDavid Rodríguez
https://github.com/rubygems/rubygems/commit/3f4b1c7a01 Notes: Merged: https://github.com/ruby/ruby/pull/6966
2022-12-09Merge RubyGems/Bundler masterHiroshi SHIBATA
Pick from https://github.com/rubygems/rubygems/commit/823c776d951f3c35094611473ec77f94e8bf6610 Notes: Merged: https://github.com/ruby/ruby/pull/6890
2022-11-12Migrate our resolver engine to PubGrubHiroshi SHIBATA
https://github.com/rubygems/rubygems/pull/5960 Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
2022-10-18Merge RubyGems/Bundler masterHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/6214d00b2315ed37c76b1fbc1c72f61f92ba5a65 Notes: Merged: https://github.com/ruby/ruby/pull/6578
2022-10-18[rubygems/rubygems] Simplify SpecGroup creationDavid Rodríguez
https://github.com/rubygems/rubygems/commit/788e46e152 Notes: Merged: https://github.com/ruby/ruby/pull/6578
2022-10-18[rubygems/rubygems] Remove dead codeDavid Rodríguez
https://github.com/rubygems/rubygems/commit/999b644708 Notes: Merged: https://github.com/ruby/ruby/pull/6578
2022-09-12[rubygems/rubygems] Use a single hash to keep track of prereleasesDavid Rodríguez
https://github.com/rubygems/rubygems/commit/9d7bd177b0
2022-09-12[rubygems/rubygems] Remove unnecessary sortingDavid Rodríguez
Already done by the gem version promoter. https://github.com/rubygems/rubygems/commit/aae2cc9fe0
2022-09-12[rubygems/rubygems] Let specs be sorted just once by the gem version promoterDavid Rodríguez
https://github.com/rubygems/rubygems/commit/3cea25a39d
2022-09-05Merge ↵Hiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/16c3535413afebcdbab7582c6017c27b5da8a8dc Notes: Merged: https://github.com/ruby/ruby/pull/6326
2022-08-25[rubygems/rubygems] Fix another regression for sorbetDavid Rodríguez
Recently a changed was introduced to update the resolver platforms after it has been created, in order to remove the "ruby" platform from it if it's to be removed from the lockfile. However, it did not update the `@resolving_only_for_ruby` instance variable in that case, so the resolver was not properly doing the right thing anymore. To fix this, I tweaked the code to restore not changing resolver platforms after the resolver has been instantiated. https://github.com/rubygems/rubygems/commit/8fbc30a1d0
2022-08-23Merge rubygems/bundler HEADHiroshi SHIBATA
Pick from https://github.com/rubygems/rubygems/commit/6b3a5a9ab0453463381a8164efb6298ea9eb776f Notes: Merged: https://github.com/ruby/ruby/pull/6268
2022-08-06[rubygems/rubygems] Fix yanked gems being unintentionally update when other ↵David Rodríguez
gems are unlocked This is a regression from a change intended to raise errors when user puts a gem under an incorrect source in the Gemfile by mistake. To fix the issue, we revert the change that caused it and implement it in a different way that restores the resolver independency from real specifications. Now it deals only with names and versions and does not try to materialize anything into real specifications before resolving. https://github.com/rubygems/rubygems/commit/d2bf1b86eb
2022-07-27[rubygems/rubygems] Completely drop base parameter from indexDavid Rodríguez
This parameter was coupling the concept of lockfile with the index. I don't think it's necessary. Also I believe it's causing some flaky test failures, which might leak into realworld issues. They are like this: ```` Invoking `/opt/hostedtoolcache/Ruby/3.0.4/x64/bin/ruby -I/home/runner/work/rubygems/rubygems/bundler/spec -r/home/runner/work/rubygems/rubygems/bundler/spec/support/artifice/fail.rb -r/home/runner/work/rubygems/rubygems/bundler/spec/support/hax.rb /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/bin/bundle lock` failed with output: ---------------------------------------------------------------------- --- ERROR REPORT TEMPLATE ------------------------------------------------------- ``` NoMethodError: undefined method `identifier' for #<Gem::Specification:0x00005639ad0db0a0 @extension_dir=nil, @full_gem_path=nil, @gem_dir=nil, @ignored=nil, @bin_dir=nil, @cache_dir=nil, @cache_file=nil, @doc_dir=nil, @ri_dir=nil, @spec_dir=nil, @spec_file=nil, @gems_dir=nil, @base_dir=nil, @loaded=false, @activated=false, @loaded_from=nil, @original_platform="ruby", @installed_by_version=nil, @autorequire=nil, @date=2022-07-25 00:00:00 UTC, @description="This is a completely fake gem, for testing purposes.", @email="foo@bar.baz", @homepage="http://example.com", @name="win32-process", @post_install_message=nil, @signing_key=nil, @summary="This is just a fake gem for testing", @version=#<Gem::Version "0.8.3">, @authors=["no one"], @bindir="bin", @cert_chain=[], @dependencies=[<Gem::Dependency type=:runtime name="ffi" requirements=">= 1.0.0">], @executables=[], @extensions=[], @extra_rdoc_files=[], @files=[], @licenses=[], @metadata={}, @platform="ruby", @rdoc_options=[], @require_paths=["lib"], @required_ruby_version=#<Gem::Requirement:0x00005639ad0dbc80 @requirements=[[">=", #<Gem::Version "0">]]>, @required_rubygems_version=#<Gem::Requirement:0x00005639ad0dba50 @requirements=[[">=", #<Gem::Version "0">]]>, @requirements=[], @rubygems_version="3.2.33", @specification_version=4, @test_files=[], @new_platform="ruby", @full_name="win32-process-0.8.3", @has_rdoc=true, @license=["MIT"] win32-process-0.8.3> /home/runner/work/rubygems/rubygems/bundler/tmp/rubygems/lib/rubygems/specification.rb:2116:in `method_missing' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/remote_specification.rb:115:in `method_missing' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/lazy_specification.rb:34:in `eql?' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/index.rb:189:in `eql?' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/index.rb:189:in `search_by_dependency' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/index.rb:96:in `local_search' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/index.rb:64:in `unsorted_search' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/index.rb:60:in `search' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/resolver.rb:179:in `results_for' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/resolver.rb:113:in `search_for' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/resolver.rb:216:in `block in sort_dependencies' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/resolver.rb:207:in `each' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/resolver.rb:207:in `sort_by' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/resolver.rb:207:in `sort_dependencies' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb:60:in `block in sort_dependencies' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb:77:in `with_no_such_dependency_error_handling' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb:59:in `sort_dependencies' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:754:in `push_state_for_requirements' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:744:in `require_nested_dependencies_for' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:727:in `activate_new_spec' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:684:in `attempt_to_activate' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:254:in `process_topmost_state' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb:182:in `resolve' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb:43:in `resolve' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/resolver.rb:50:in `start' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/resolver.rb:24:in `resolve' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/definition.rb:480:in `reresolve' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/definition.rb:283:in `resolve' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/definition.rb:181:in `resolve_remotely!' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/cli/lock.rb:53:in `run' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/cli.rb:674:in `lock' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/cli.rb:31:in `dispatch' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/cli.rb:25:in `start' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/exe/bundle:48:in `block in <top (required)>' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/gems/bundler-2.4.0.dev/exe/bundle:36:in `<top (required)>' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/bin/bundle:23:in `load' /home/runner/work/rubygems/rubygems/bundler/tmp/1/gems/system/bin/bundle:23:in `<main>' ``` ```` I think the issue is that now we eagerly materialize some base specifications before resolving in order to give better errors if user specified an incorrect source in the Gemfile. This means that the key for the index hash will have heterogeneous specification objects (some LazySpecification, some real Specification), and `LazySpecification#eql?` is incompatible with that. By dropping the base parameter from the index, we should no longer have these heterogenous objects as hash keys. https://github.com/rubygems/rubygems/commit/dc179d41c3
2022-07-26Merge rubygems/bundler HEADHiroshi SHIBATA
Merge from https://github.com/rubygems/rubygems/commit/2af2520b4a7ab1c6eb1fdc3d2ef4d8c062d96ad7 Notes: Merged: https://github.com/ruby/ruby/pull/6184
2022-07-13Merge RubyGems and Bundler masterHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/6124
2022-06-24Sync RubyGems & Bundler with upstream repoDavid Rodríguez
Notes: Merged: https://github.com/ruby/ruby/pull/6054
2022-05-31[rubygems/rubygems] Give better conflict resolution adviceDavid Rodríguez
This alternative really uses only the Gemfile, and can never end up being absurd, because it will never be suggested when there's no lockfile, and it suggests deleting the lockfile. https://github.com/rubygems/rubygems/commit/5d154dd50e
2022-05-24[rubygems/rubygems] Fix crash when printing resolution conflicts on metadata ↵David Rodríguez
requirements https://github.com/rubygems/rubygems/commit/b69e1e9374
2022-05-20Merge RubyGems and Bundler HEADHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/125415593ead9ab69a9f0bb5392c9d7ec61b1f51
2022-04-28Merge ↵Hiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/3f7d0352e84b29d4a2d4cd93b31e5ebdb5f79cc6 Notes: Merged: https://github.com/ruby/ruby/pull/5669
2022-02-01Sync latest Bundler & RubyGemsDavid Rodríguez
Notes: Merged: https://github.com/ruby/ruby/pull/5512
2022-01-19Merge rubygems/rubygems HEAD.Hiroshi SHIBATA
Picked at 12aeef6ba9a3be0022be9934c1a3e4c46a03ed3a Notes: Merged: https://github.com/ruby/ruby/pull/5462