summaryrefslogtreecommitdiff
path: root/lib/bundler/spec_set.rb
AgeCommit message (Collapse)Author
2025-05-22Merge RubyGems-3.6.9 and Bundler-2.6.9Hiroshi SHIBATA
2025-05-22Merge RubyGems-3.6.8 and Bundler-2.6.8Hiroshi SHIBATA
2025-04-08Merge RubyGems-3.6.7 and Bundler-2.6.7Hiroshi SHIBATA
2025-02-20Merge RubyGems-3.6.4 and Bundler-2.6.4Hiroshi SHIBATA
2025-02-20Merge RubyGems-3.6.3 and Bundler-2.6.3Hiroshi SHIBATA
2024-11-26[rubygems/rubygems] Remove no longer necessary codeDavid Rodríguez
https://github.com/rubygems/rubygems/commit/9ea1539b08
2024-11-26[rubygems/rubygems] Avoid needing a second pass to ignore unlocked gemsDavid Rodríguez
When converging locked specifications to select the ones that should be preserved while resolving, we can avoid having to do a second pass to ignore the ones that have been explicitly unlocked. https://github.com/rubygems/rubygems/commit/411742703e
2024-11-26[rubygems/rubygems] Allow some materialized specs to be missingDavid Rodríguez
As long as some spec in the materialization is complete. https://github.com/rubygems/rubygems/commit/9a673b0bbb
2024-11-26[rubygems/rubygems] Deprecate `check` parameter to `Bundler::SpecSet#for`David Rodríguez
https://github.com/rubygems/rubygems/commit/3041b3d784
2024-11-26[rubygems/rubygems] Keep track of materializations in the original resolveDavid Rodríguez
This gives more flexibility to allow further improvements. https://github.com/rubygems/rubygems/commit/f11a890f5e
2024-11-26[rubygems/rubygems] Create LazySpecifications directly with ↵David Rodríguez
most_specific_locked_platform So there's no need to pass it around in so many places. https://github.com/rubygems/rubygems/commit/784ab7481b
2024-11-26[rubygems/rubygems] Simplify moreDavid Rodríguez
https://github.com/rubygems/rubygems/commit/a2bb68a29b
2024-11-26[rubygems/rubygems] Remove no longer necessary codeDavid Rodríguez
https://github.com/rubygems/rubygems/commit/e1caeecdf8
2024-11-26[rubygems/rubygems] Use `platform` local variableDavid Rodríguez
https://github.com/rubygems/rubygems/commit/6a6041d073
2024-11-08[rubygems/rubygems] Warn on insecure materializationDavid Rodríguez
https://github.com/rubygems/rubygems/commit/bc2537de71
2024-11-08[rubygems/rubygems] Reduce global stateDavid Rodríguez
https://github.com/rubygems/rubygems/commit/43c0c41c6b
2024-10-26Normalize lockfile platformsDavid Rodríguez
2024-08-05Fix truffleruby removing gems from lockfileDavid Rodríguez
When resolving on truffleruby, and multiple platforms are included in the lockfile, Bundler will not respect existing platforms, but always force ruby variants. That means removal of existing version specific variants, introducing lockfile churn between implementations. To prevent this, we introduce the distinction between `Dependency#force_ruby_platform`, only settable via Gemfile, and `Dependency#default_force_ruby_platform`, which is always true on truffleruby for certain dependency names. This way, when resolving lockfile gems for other platforms on truffleruby, we keep platform specific variants in the lockfile. However, that introduces the problem that if only platform specific variants are locked in the lockfile, Bundler won't be able to materialize on truffleruby because the generic variant will be missing. To fix this additional problem, we make sure the generic "ruby" platform is always added when resolving on truffleruby.
2024-07-23[rubygems/rubygems] Fix `bundle exec gem uninstall`David Rodríguez
* `bundle exec` assigns `Gem::Specification.all` to the set of specs known to Bundler (a `Bundler::SpecSet`). * `gem uninstall` recently started calling `#delete` on the set of specs stored in `Gem::Specification#all`. This, in RubyGems, is just an array of specs, so has a `#delete` method that receives a single element. * However, at some point I added a `SpecSet#delete` method that takes an array of specs, breaking the "Array-like" contract and making `gem uninstall` break when run in a `bundle exec` context. The fix is to make `Bundler::SpecSet#delete` handle being given a single spec. https://github.com/rubygems/rubygems/commit/e3acb7b01d
2024-07-09[rubygems/rubygems] Refactor selecting specs from a SpecSetDavid Rodríguez
https://github.com/rubygems/rubygems/commit/bcbbff5149
2024-07-09[rubygems/rubygems] Resolve all platforms directlyDavid Rodríguez
Instead of having to do a complete pass after resolve. To do this, we add to the ruby group all the platform specs with the same dependencies as the ruby specs. https://github.com/rubygems/rubygems/commit/e50415f2a6
2024-05-24[rubygems/rubygems] Fix performance regression on applications with a local ↵David Rodríguez
cache Even if all gems are properly installed and no resolve is needed, we recently started always reading all packages in `vendor/cache` and extracting specifications from them. This commit fixes the problem by longer making considering cached specs the default and only enable them when a resolve is actually needed. https://github.com/rubygems/rubygems/commit/edeb2c42bf
2024-05-16[rubygems/rubygems] Fix regression when caching gems from secondary sourcesDavid Rodriguez
If `cache_all_platforms` setting is enabled, the secondary source was no longer considering cached gems. That means that if the remote secondary source has removed its gems, then this was now resulting in an error while before the previously cached gem from the source would still be used. This commit restores previous behavior. https://github.com/rubygems/rubygems/commit/2d2cd00255
2024-04-17[rubygems/rubygems] Excluding local platform from lockfile should not affect ↵Mike Dalessio
musl vs gnu case This case is for not locking things like `arm-darwin-23` when the lockfile already includes `arm-darwin`, so that we don't infinitely keep redundant versioned platforms in the lockfile when not necessary. We detect this with `Gem::Platform#===`. For example, `Gem::Platform.new("arm-darwin-23") === Gem::Platform.new("arm-darwin")` but they're not `==`. However, in the case of `-musl` vs `-gnu`, those act as the platform "version", but `===` is not commutative for them. This is explained in `===` docs. We only want to exclude the local platform in situations when `Gem::Platform#===` is actually commutative. https://github.com/rubygems/rubygems/commit/8099c4face
2024-01-31[rubygems/rubygems] Fix musl platform not being added to the lockfileDavid Rodriguez
https://github.com/rubygems/rubygems/commit/235f7b4266
2024-01-11Complete missing specs for platforms after resolutionDavid Rodríguez
If two platform specific variants have different dependencies, then resolution may fallback to the non platform specific variant. However, the platform specific variants that have the same dependencies as the non specific one can still be kept. Do a pass to complete those after resolution.
2024-01-11[rubygems/rubygems] Move resetting the spec set to where it becomes necessaryDavid Rodríguez
https://github.com/rubygems/rubygems/commit/a8b547c6b1
2024-01-11[rubygems/rubygems] Extract a couple of helper methodsDavid Rodríguez
https://github.com/rubygems/rubygems/commit/880a4eae7f
2024-01-11[rubygems/rubygems] Remove methods to clarify what they doDavid Rodríguez
https://github.com/rubygems/rubygems/commit/1d15d8a8ff
2024-01-11[rubygems/rubygems] Extract `SpecSet#reset!` helperDavid Rodríguez
https://github.com/rubygems/rubygems/commit/41f9b4d940
2023-12-22Merge RubyGems-3.5.2 and Bundler-2.5.2Hiroshi SHIBATA
2023-11-22[rubygems/rubygems] Fix universal lockfiles regressionDavid Rodriguez
If a platform specific variant would not match the current Ruby, we would still be considering it compatible with the initial resolution and adding its platform to the lockfile, but we would later fail to materialize it for installation due to not really being compatible. Fix is to only add platforms for variants that are also compatible with current Ruby and RubyGems versions. https://github.com/rubygems/rubygems/commit/75d1290843
2023-11-13[rubygems/rubygems] Automatically lock extra ruby platformsDavid Rodríguez
Since we started locking the specific platform in the lockfile, that has created an annoying situation for users that don't develop on Linux. They will create a lockfile on their machines, locking their local platform, for example, darwin. But then that lockfile won't work automatically when deploying to Heroku for example, because the lockfile is frozen and the Linux platform is not included. There's the chance though that resolving against two platforms (Linux + the local platform) won't succeed while resolving for just the current platform will. So, instead, we check other platform specific variants available for the resolution we initially found, and lock those platforms and specs too if they satisfy the resolution. This is only done when generating new lockfiles from scratch, existing lockfiles should keep working as before, and it's only done for "ruby platforms", i.e., not Java or Windows which have their own complexities, and so are excluded. With this change, we expect that MacOS users can bundle locally and deploy to Heroku without needing to do anything special. https://github.com/rubygems/rubygems/commit/5f24f06bc5
2023-11-13[rubygems/rubygems] Remove unused `SpecSet#merge`David Rodríguez
https://github.com/rubygems/rubygems/commit/53e0490b55
2023-11-08[rubygems/rubygems] Simplify selecting specs with `force_ruby_platform` setDavid Rodríguez
https://github.com/rubygems/rubygems/commit/5f90a43635 Co-authored-by: Martin Emde <martin.emde@gmail.com>
2023-10-16[rubygems/rubygems] Automatically remove invalid platforms before re-resolvingDavid Rodríguez
https://github.com/rubygems/rubygems/commit/40989271dd
2023-10-15[rubygems/rubygems] Fix force_ruby_platform: when the lockfile only locks ↵Samuel Giddins
the ruby platform https://github.com/rubygems/rubygems/commit/7c50064c3c
2023-04-06[rubygems/rubygems] Fix resolver hangs when dealing with an incomplete lockfileDavid Rodríguez
While working on locking multiple platforms by default, I got an infinite resolution loop in one of our resolver specs. The culprit ended up being that when dealing with lockfile specs with incomplete dependencies (spec appears in lockfile, but its dependencies don't), those specs were not being properly expired and that tripped up resolution. The issue for some reason only manifests when dealing with multiple lockfile platforms, that's why it only manifested when working on locking multiple platforms by default. https://github.com/rubygems/rubygems/commit/4ca72913bb
2023-04-06Revert "Refactor incomplete specs handling"David Rodríguez
This reverts commit 69580f8b72f41c58cae57d1ada4db909922b3891.
2023-04-06[rubygems/rubygems] Revert "Reuse `SpecSet#materialize` logic"David Rodríguez
This reverts commit https://github.com/rubygems/rubygems/commit/a20585b4512d. https://github.com/rubygems/rubygems/commit/aa9102659e
2023-03-23Reuse `SpecSet#materialize` logicDavid Rodríguez
Notes: Merged: https://github.com/ruby/ruby/pull/7582
2023-03-23Refactor incomplete specs handlingDavid Rodríguez
Recent bugs fixed made me realize we were relying on state too much here. We only need to keep incomplete specs to be able to expire them and retry resolution without them locked. If we use a separate class, we can do that more transparently and handle them just like we handle "missing specs". Notes: Merged: https://github.com/ruby/ruby/pull/7582
2023-03-23Don't remove RUBY platform when healing a lockfile with missing specsDavid Rodríguez
Notes: Merged: https://github.com/ruby/ruby/pull/7582
2023-03-23Don't remove RUBY platform when healing a lockfile with missing specsDavid Rodríguez
Notes: Merged: https://github.com/ruby/ruby/pull/7582
2023-03-17[rubygems/rubygems] Fix incorrect error message when multiple platforms are ↵David Rodríguez
locked https://github.com/rubygems/rubygems/commit/24d2bf9cb2
2023-03-02[rubygems/rubygems] Regenerate lockfile if spec list is invalid/empty.Ellen Marie Dash
https://github.com/rubygems/rubygems/commit/d2c56315e2
2023-03-01[rubygems/rubygems] Auto-heal on corrupted lockfile with missing depsDaniel Colson
Following up on https://github.com/rubygems/rubygems/pull/6355, which turned a crash into a nicer error message, this commit auto-heals the corrupt lockfile instead. In this particular case (a corrupt Gemfile.lock with missing dependencies) the LazySpecification will not have accurate dependency information, we have to materialize the SpecSet to determine there are missing dependencies. We've already got a way to handle this, via `SpecSet#incomplete_specs`, but it wasn't quite working for this case because we'd get to `@incomplete_specs += lookup[name]` and `lookup[name]` would be empty for the dependency. With this commit we catch it a bit earlier, marking the parent spec containing the missing dependency as incomplete. https://github.com/rubygems/rubygems/commit/486ecb8f20
2022-12-24Merge RubyGems-3.4.0 and Bundler-2.4.0Hiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/6987
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-09-12[rubygems/rubygems] Remove unnecessary spec sortingDavid Rodríguez
Specs in a SpecSet with the same name are only sorted by platform priority when they are read. No need to sort everything eagerly. https://github.com/rubygems/rubygems/commit/aeafff52df