summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2025-02-19[rubygems/rubygems] Make sure empty gems are not reinstalled every timeDavid Rodríguez
Unfortunately this requires reverting a previous enhancement of reinstalling gems if they incorrectly ship with an empty installation dir. However, there's no way to distinguish this kind of bad state from a gem that's empty for real, for example, sorbet-static-and-runtime. This reverts commit https://github.com/rubygems/rubygems/commit/9720a9b980d2, and adds a spec to make sure empty gems are not reinstalled every time. https://github.com/rubygems/rubygems/commit/7c102394af
2025-02-18[rubygems/rubygems] Fix Bundler incorrectly downgrading direct dependenciesDavid Rodríguez
There's no reason to call `converge_specs` when adding additional lower bound requirements to prevent downgrades, and it actually causes the extra requirements to be missed sometimes. Loop over the originally locked specs directly, adding the additional precaution of not adding the requirement if the Gemfile dependency has changed and it no longer matches the locked spec. https://github.com/rubygems/rubygems/commit/5154506912
2025-02-18[rubygems/rubygems] Don't try to skip requirements to prevent downgradesDavid Rodríguez
These don't really hurt, so I'm not sure why I introduced it. https://github.com/rubygems/rubygems/commit/85b6b405ac
2025-02-18[rubygems/rubygems] Fix locked gems being upgraded when locked dependencies ↵David Rodríguez
are incorrect Resolver had internal logic to prioritize locked versions when sorting versions, however part of it was not being actually hit because of how unlocking worked in the resolver: a package was allow to be unlocked when that was explicit requested or when the list of unlocks was empty. That did not make a lot of sense and other cases were working because the explicit list of unlocks was getting "artificially filled". Now we consider a package unlocked when explicitly requested (`bundle update <package>`), or when everything is being unlocked (`bundle install` with no lockfile or `bundle update`). This makes things simpler and gets the edge case added as a test case working as expected. https://github.com/rubygems/rubygems/commit/b8e55087f0
2025-02-18[rubygems/rubygems] Refactor finding dependency changesDavid Rodríguez
https://github.com/rubygems/rubygems/commit/d8c4754d8f
2025-02-18[rubygems/rubygems] Improve processing and categorizing unlock informationDavid Rodríguez
https://github.com/rubygems/rubygems/commit/516430c3ec
2025-02-17[rubygems/rubygems] Make Bundler never instantiate development dependenciesDavid Rodríguez
Bundler does not really have a concept of "development dependencies", like RubyGems has. Bundler has the more generic concept of "groups". Under the hood, the `gemspec` DSL will put gemspec development dependencies under a `:development` Gemfile group, but there's no reason to instantiate these as development dependencies, they are regular runtime dependencies, except that they belong in a group named :development. By never instantiating development dependencies at all, we avoid having to introduce hacks to "undo" the type Bundler does not know about, and I also think the error messages read better. https://github.com/rubygems/rubygems/commit/9a06fa5bda
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 hacks to integrate with RubyGemsDavid Rodríguez
https://github.com/rubygems/rubygems/commit/33d91de732
2025-02-14[rubygems/rubygems] Simplify SpecSet#sortedDavid Rodríguez
https://github.com/rubygems/rubygems/commit/a3f365bbaa
2025-02-14[rubygems/rubygems] Raise error when lockfile is missing deps in frozen modeDavid Rodríguez
And avoid installing any gems. https://github.com/rubygems/rubygems/commit/c12700c7e4
2025-02-14[rubygems/rubygems] Deprecate legacy windows platforms (mswin, mingw) in the ↵johnnyshields
Bundler DSL, in favor of using `platform :windows` This commit is only deprecation and does not change/remove any actual functionality. https://github.com/rubygems/rubygems/commit/0ca6dc3984
2025-02-14[rubygems/rubygems] Fix legacy windows platform values no longer workingDavid Rodríguez
https://github.com/rubygems/rubygems/commit/de8b3016db
2025-02-13[ruby/prism] No writing to numbered parametersKevin Newton
Fixes [Bug #21117] https://github.com/ruby/prism/commit/19d4bab5a0
2025-02-13[Feature #21116] Extract RJIT as a third-party gemNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12740
2025-02-13[rubygems/rubygems] `--prefer-local` should resolve to latest version if no ↵David Rodríguez
gems are available locally Filtering out remote specs should only apply where there are locally installed specs. Otherwise they should always be considered. https://github.com/rubygems/rubygems/commit/118f8389a1
2025-02-13[rubygems/rubygems] Fix incorrect error message in frozen modeDavid Rodríguez
When Bundler refuses to install in frozen mode, sometimes it would incorrectly claim that some dependencies have been added to the Gemfile when that's not really the case. Fix that by making sure `locked_dependencies` always has all locked dependencies, even when unlocking, Additionally, the suggestion to run `bundle install` is also confusing when unlocking, since `bundle update` is what has been run. So skip that part as well when unlocking. https://github.com/rubygems/rubygems/commit/64d84ad7d8
2025-02-13[rubygems/rubygems] Fix `type` and `gemfile` not getting reported as invalid ↵David Rodríguez
options https://github.com/rubygems/rubygems/commit/5b6077a1e8
2025-02-13[rubygems/rubygems] Materializing specs for vendor/cache should not be strictDavid Rodríguez
Platforms specific gems not compatible with the current Ruby should not make `bundle cache` fail and should not get removed from the cache since they still may be useful in other rubies. https://github.com/rubygems/rubygems/commit/717b43f565
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-02-13[rubygems/rubygems] Remove unnecessary source changeDavid Rodríguez
We materializing for installation, we already do this, and we materializing for cache, it does not seem necessary. https://github.com/rubygems/rubygems/commit/1a983c6cbc
2025-02-13[rubygems/rubygems] Extract some common materialization logic to a methodDavid Rodríguez
https://github.com/rubygems/rubygems/commit/32982fcd33
2025-02-13[rubygems/rubygems] Make LazySpecification#__materialize__ privateDavid Rodríguez
And rename it to something better. https://github.com/rubygems/rubygems/commit/321174d1ad
2025-02-10[rubygems/rubygems] Allocate strings from Requirement match only onceDavid Rodríguez
https://github.com/rubygems/rubygems/commit/c65b8644e6 Co-authored-by: Samuel Giddins <segiddins@segiddins.me>
2025-02-06[rubygems/rubygems] Add `irb` to a Gemfile for a newly created gemyuuji.yaginuma
I think we need this to silence the following warning when running `bin/console` with Ruby 3.4 ``` ./bin/console:10: warning: irb was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0. You can add irb to your Gemfile or gemspec to silence this warning. ``` https://github.com/rubygems/rubygems/commit/c46230c856
2025-02-06[rubygems/rubygems] Auto-heal empty installation directoryDavid Rodríguez
https://github.com/rubygems/rubygems/commit/9720a9b980
2025-02-06[rubygems/rubygems] Refine messages about gem installations being missingDavid Rodríguez
The previous wording was too specific, there may be situations when the gem has actually never installed (so never deleted either). https://github.com/rubygems/rubygems/commit/e4a0d71fbe
2025-02-06[rubygems/rubygems] Don't potentially load remote metadata when expanding ↵David Rodríguez
dependencies For installed specifications, we can ignore any constraints they may have, since we know they match the current version of Ruby or otherwise would not be installed. For remote specifications, we already resolve optimistically without metadata and retry force-fetching it if necessary. If in the future we support resolving against a Ruby version different that the one being run, we'll probably need to change this but now it's unnecessary and saves some memory. ### Before Total allocated: 262.99 MB (3177437 objects) Total retained: 115.91 MB (1297821 objects) ### After Total allocated: 259.89 MB (3134199 objects) Total retained: 115.05 MB (1283779 objects) https://github.com/rubygems/rubygems/commit/201c1863fc
2025-02-06[rubygems/rubygems] Move expanding dependencies with metadata to ↵David Rodríguez
specification classes https://github.com/rubygems/rubygems/commit/7f921aa46e
2025-02-06[rubygems/rubygems] Metadata dependencies can be `Gem::Dependency` instancesDavid Rodríguez
They use less memory that way. When resolving from scratch a Gemfile including only `"gem "rails", "~> 8.0.1"`, I get the following results: ### Before Total allocated: 265.06 MB (3186053 objects) Total retained: 116.98 MB (1302280 objects) ### After Total allocated: 262.99 MB (3177437 objects) Total retained: 115.91 MB (1297821 objects) https://github.com/rubygems/rubygems/commit/a4ef9c5f56
2025-02-06[rubygems/rubygems] Remove unnecessary remapping of dependenciesDavid Rodríguez
Sometimes we'll resolve using bare `Gem::Dependency` instances rather than `Bundler::Dependency` instances, which is fine, simpler, and saves some memory. When resolving from scratch a Gemfile including only `"gem "rails", "~> 8.0.1"`, I get the following results: ### Before Total allocated: 277.48 MB (3384318 objects) Total retained: 117.53 MB (1338657 objects) ### After Total allocated: 265.06 MB (3186053 objects) Total retained: 116.98 MB (1302280 objects) https://github.com/rubygems/rubygems/commit/c6dc2966c5
2025-02-06[rubygems/rubygems] Make `Bundler::Dependency` more memory efficientDavid Rodríguez
When resolving from scratch a Gemfile including only `"gem "rails", "~> 8.0.1"`, I get the following results: ### Before Total allocated: 288.21 MB (3498515 objects) Total retained: 119.10 MB (1357976 objects) ### After Total allocated: 277.44 MB (3383182 objects) Total retained: 117.55 MB (1338622 objects) https://github.com/rubygems/rubygems/commit/2d3d6e5015
2025-02-06[rubygems/rubygems] Lazily parse dependencies in EndpointSpecificationDavid Rodríguez
Since not every dependency gets referenced. When resolving from scratch a Gemfile including only `"gem "rails", "~> 8.0.1"`, I get the following results: ### Before Total allocated: 295.01 MB (3624335 objects) Total retained: 119.31 MB (1364474 objects) ### After Total allocated: 288.21 MB (3498515 objects) Total retained: 119.10 MB (1357976 objects) https://github.com/rubygems/rubygems/commit/61eee39d81 Co-authored-by: Samuel Giddins <segiddins@segiddins.me>
2025-02-06Improve bundled gems warning messagesDavid Rodríguez
Currently evenn if the require actually fails, they suggest that the file was actually loaded, which is confusing. I reworded them to reduce this confusion.
2025-02-06Rename "gem" to "name"David Rodríguez
The name "gem" could be confused with RubyGems activation method.
2025-02-06Simplify bundled gems warnings implementationDavid Rodríguez
Most of the stuff is not actually necessary.
2025-02-06Remove unnecessary SINCE_FAST_PATH constantDavid Rodríguez
If anything, I think this may be causing some false positives.
2025-02-05[rubygems/rubygems] Deprecate `CurrentRuby#maglev?` and other related maglev ↵Edouard CHIN
methods: - Follow up to https://github.com/rubygems/rubygems/pull/8430#discussion_r1927239555. The maglev platform was not supported by Bundler, so calling `gem "foo", platforms: ["maglev"]` would raise an error. The helpers added in the `CurrentRuby` class were used at a time when maglev was supported (as explained in https://github.com/rubygems/rubygems/commit/45ec86e2e528). Support of maglev was most likely dropped at some point and the helpers in the `CurrentRuby` class were not deprecated/removed. We decided to deprecate them now. https://github.com/rubygems/rubygems/commit/66388babf8
2025-02-05Expand stub-out scope of Fiddle.dlopenHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12616
2025-02-04[ruby/resolv] Load win32/resolv with rake testHiroshi SHIBATA
https://github.com/ruby/resolv/commit/3ecfce3626
2025-02-03[ruby/weakref] Add missing block parameterNikita Shilnikov
A block is part of the Delegator's contract. Ruby 3.4 issues a warning if a block is passed but unused. This commit fixes the warning by adding a block to the argument list. https://github.com/ruby/weakref/commit/9495ec9191
2025-02-03[rubygems/rubygems] Raise a simpler error when RubyGems fails to activate a ↵David Rodríguez
dependency If you force uninstall a dependency but leave other gems depending on it, those gems will fail to be activated. In that case, RubyGems prints a rather complicated error: ``` $ rails --version /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1413:in 'block in Gem::Specification#activate_dependencies': Could not find 'activesupport' (= 8.0.1) among 478 total gem(s) (Gem::MissingSpecError) Checked in 'GEM_PATH=/Users/deivid/.local/share/gem/ruby/3.4.0:/Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/gems/3.4.0' at: /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/gems/3.4.0/specifications/railties-8.0.1.gemspec, execute `gem env` for more information from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1399:in 'Array#each' from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1399:in 'Gem::Specification#activate_dependencies' from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1381:in 'Gem::Specification#activate' from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems.rb:283:in 'block in Gem.activate_bin_path' from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems.rb:282:in 'Thread::Mutex#synchronize' from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems.rb:282:in 'Gem.activate_bin_path' from /Users/deivid/.asdf/installs/ruby/3.4.1/bin/rails:25:in '<main>' /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/dependency.rb:303:in 'Gem::Dependency#to_specs': Could not find 'activesupport' (= 8.0.1) - did find: [activesupport-7.1.3,activesupport-7.0.8.7] (Gem::MissingSpecVersionError) Checked in 'GEM_PATH=/Users/deivid/.local/share/gem/ruby/3.4.0:/Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/gems/3.4.0' , execute `gem env` for more information from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1411:in 'block in Gem::Specification#activate_dependencies' from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1399:in 'Array#each' from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1399:in 'Gem::Specification#activate_dependencies' from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1381:in 'Gem::Specification#activate' from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems.rb:283:in 'block in Gem.activate_bin_path' from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems.rb:282:in 'Thread::Mutex#synchronize' from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems.rb:282:in 'Gem.activate_bin_path' from /Users/deivid/.asdf/installs/ruby/3.4.1/bin/rails:25:in '<main>' ``` With this commit, the error becomes a bit simpler to parse: ``` $ rails --version /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1421:in 'block in Gem::Specification#activate_dependencies': Could not find 'activesupport' (= 8.0.1) among 478 total gem(s) (Gem::MissingSpecError) Checked in 'GEM_PATH=/Users/deivid/.local/share/gem/ruby/3.4.0:/Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/gems/3.4.0' at: /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/gems/3.4.0/specifications/railties-8.0.1.gemspec, execute `gem env` for more information from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1407:in 'Array#each' from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1407:in 'Gem::Specification#activate_dependencies' from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1389:in 'Gem::Specification#activate' from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems.rb:283:in 'block in Gem.activate_bin_path' from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems.rb:282:in 'Thread::Mutex#synchronize' from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems.rb:282:in 'Gem.activate_bin_path' from /Users/deivid/.asdf/installs/ruby/3.4.1/bin/rails:25:in '<main>' ``` And also, we reduce exception based control flow in our code. https://github.com/rubygems/rubygems/commit/7e48c49f2d
2025-01-31Stop generating binstubs for Bundler itselfDavid Rodríguez
2025-01-31[rubygems/rubygems] Fix `bundle console` unnecessarily trying to load IRB twiceDavid Rodríguez
https://github.com/rubygems/rubygems/commit/f9bf58573f
2025-01-31[rubygems/rubygems] Remove unnecessary error handlingDavid Rodríguez
These gems always define their main namespace and I don't think that will ever change. https://github.com/rubygems/rubygems/commit/6663cbed53
2025-01-31[rubygems/rubygems] Consolidate the platform into a single list:Edouard CHIN
- Similar change than https://github.com/rubygems/rubygems/commit/29a1be0008e6, keep a single source of truth where we store the platform. The only change worth highlighing is the platform "maglev". It was not part of the supported platform of dependencies, so calling `gem 'foo', plaftorm: 'maglev'` would not work. However, it was supposed to according to https://github.com/rubygems/rubygems/commit/45ec86e2e528. That's why it was possible to do `Bundler.current_ruby.maglev?` or `Bundler.current_ruby.maglev_30?`. I didn't change the current behaviour and maglev is not supported, though I kept the `*maglev` methods as I believe CurrentRuby is public API. https://github.com/rubygems/rubygems/commit/29e219ebcf
2025-01-31[rubygems/rubygems] Consolidated the Ruby version list:Edouard CHIN
- We keep 2 list of supported ruby versions and each time a new ruby version is released we need to maintain both list. Forgetting to update one would prevent users from adding gem for a specific plaftorm (i.e. https://github.com/rubygems/rubygems/commit/7cd19d824d17 and https://github.com/rubygems/rubygems/commit/5462322f8f0c). Extracted the list from the Dependency class and moved it to the CurrentRuby class (which I believe was originally added for that reason). https://github.com/rubygems/rubygems/commit/a91edd6c1f
2025-01-31[rubygems/rubygems] Add ruby_34 and ruby_35 as valid platform:Edouard CHIN
- Fix https://github.com/rubygems/rubygems/pull/8427 - Similar to https://github.com/rubygems/rubygems/commit/7cd19d824d17. Tweaked a bit the test supposed to prevent this error by checking whether the dep respond to these methods. https://github.com/rubygems/rubygems/commit/62012eaeb6
2025-01-29[ruby/error_highlight] Ensure first_line and last_line are setYusuke Endoh
Fixes https://github.com/ruby/error_highlight/pull/58 https://github.com/ruby/error_highlight/commit/9ddc1f31a9