summaryrefslogtreecommitdiff
path: root/lib/bundler/spec_set.rb
AgeCommit message (Collapse)Author
2025-10-14[rubygems/rubygems] Removed legacy_check option from SpecSet#forHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/376e4ec8c7 Co-authored-by: David Rodríguez <2887858+deivid-rodriguez@users.noreply.github.com>
2025-10-10[rubygems/rubygems] Consolidate removal of `Bundler::SpecSet#-` and ↵David Rodríguez
`Bundler::SpecSet#<<` https://github.com/rubygems/rubygems/commit/aee50b31db
2025-06-23[rubygems/rubygems] Deprecate unused `Bundler#SpecSet` methodsDavid Rodríguez
https://github.com/rubygems/rubygems/commit/380c95ce05
2025-06-06Move most of Bundler::GemHelpers to Gem::PlatformSamuel Giddins
This will help centralize wheel platform selection logic eventually Signed-off-by: Samuel Giddins <segiddins@segiddins.me>
2025-04-15[rubygems/rubygems] Let `bundle lock --normalize-platforms` remove invalid ↵David Rodríguez
platforms https://github.com/rubygems/rubygems/commit/c39d2f84fd
2025-04-15[rubygems/rubygems] Raise an error if `bundle lock` target platform is ↵David Rodríguez
incompatible https://github.com/rubygems/rubygems/commit/282e4a8593
2025-04-14[rubygems/rubygems] Fix edge case making `bundle update` behave incorrectlyDavid Rodríguez
If both a native and a generic version are locked, but the native version is incompatible with the running Ruby, Bundler will still keep the native version in the lockfile, since it could be potentially useful when using other rubies. However, when `bundle update` is run, this was not the case because the locked native gems were not using the right source when materializing. They were using the lockfile source instead of the Gemfile source, and that meant they could not be found when materializing, because the lockfile source always uses local mode so does not see them. The effect of this was normally that they were incorrectly removed from the lockfile and a strange "this spec has been possibly yanked" was printed in verbose mode. However, in certain situations (i.e., when the generic gem would bring extra dependencies), it could also make `bundle update` crash. The solution is, when adding this extra locked specs to the result after resolving, maybe sure they inherit the source from the resolved specs, so they can be found when materializing. `bundle install` did not have the issue because it passes locked specs to the resolver, and assigns the right source to them in `Definition#converge_locked_specs`. https://github.com/rubygems/rubygems/commit/91ce881fda
2025-04-14[rubygems/rubygems] Fix `bundle lock --normalize-platforms` regressionDavid Rodríguez
https://github.com/rubygems/rubygems/commit/458fa5dc4c
2025-03-31[rubygems/rubygems] Remove edge cases for not removing invalid platformsDavid Rodríguez
Instead, remove them anytime we find dependencies don't match the lockfile for a platform, and then add them back after resolution if they ended up being valid. https://github.com/rubygems/rubygems/commit/220bd77887
2025-03-31[rubygems/rubygems] `SpecSet#add_extra_platforms!` doesn't need to return ↵David Rodríguez
anything https://github.com/rubygems/rubygems/commit/9fd92ade54
2025-02-14[rubygems/rubygems] Reset existing specs when using `Bundler::SpecSet#[]=`David Rodríguez
We have a flaky failure where to equal Bundler specs sneak into the same SpecSet. This seems like a vector where that could happen so trying this in case it fixes the flaky. https://github.com/rubygems/rubygems/commit/a33aeb3c4d
2025-02-14[rubygems/rubygems] Refactor SpecSet to not need resetDavid Rodríguez
https://github.com/rubygems/rubygems/commit/55af558124
2025-02-14[rubygems/rubygems] Simplify SpecSet#sortedDavid Rodríguez
https://github.com/rubygems/rubygems/commit/a3f365bbaa
2025-02-13[rubygems/rubygems] Move logic to materialize gems for cache to a new methodDavid Rodríguez
And make the current `materialize_strictly` private. https://github.com/rubygems/rubygems/commit/3fc2129147
2025-01-28[rubygems/rubygems] Define `Bundler::SpecSet#to_s`David Rodríguez
For better debuggability. https://github.com/rubygems/rubygems/commit/21d252fa7a
2025-01-14[rubygems/rubygems] Don't remove platform specific variants from the ↵David Rodríguez
lockfile unless necessary Even if they don't match the current Ruby version, they could still work in other rubies. So it's better to keep them. https://github.com/rubygems/rubygems/commit/9a3e583b0c Notes: Merged: https://github.com/ruby/ruby/pull/12568
2025-01-14[rubygems/rubygems] Tiny parameter renameDavid Rodríguez
Just for consistency, since all the other methods in this class that receive an array of dependencies use `deps`. https://github.com/rubygems/rubygems/commit/eca1341950 Notes: Merged: https://github.com/ruby/ruby/pull/12568
2025-01-14[rubygems/rubygems] Extract `SpecSet#version_for`David Rodríguez
https://github.com/rubygems/rubygems/commit/a76fd6d3bf Notes: Merged: https://github.com/ruby/ruby/pull/12568
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