Samuel Giddins
c0a1e877b3
Move most of Bundler::GemHelpers to Gem::Platform
...
This will help centralize wheel platform selection logic eventually
Signed-off-by: Samuel Giddins <segiddins@segiddins.me>
2025-06-06 10:22:18 +09:00
David Rodríguez
1929e73a36
[rubygems/rubygems] Raise an error if bundle lock
target platform is incompatible
...
282e4a8593
2025-04-15 16:47:21 +09:00
Hiroshi SHIBATA
c9e07da51d
[rubygems/rubygems] Resolved Lint/ShadowingOuterLocalVariable warning
...
01a14a7073
2025-03-27 16:57:10 +09:00
Hartley McGuire
752a1d7854
[rubygems/rubygems] Implement pub_grub strategy interface
...
My application spends more than 30% of time during `bundle update`
comparing versions due to versions being sorted inside
next_package_to_try. This has been addressed in pub_grub by defining a
strategy interface (a `#next_package_and_version` method) which allows
consumers to have finer control over the heuristic to select the next
package to try.
This commit implements the new strategy interface to remove extraneous
version sorting (previously in next_package_to_try) since only the final
count of versions is used.
Combined with a previous change to pub_grub (already applied to
Bundler), this commit results in `bundle update` taking only half the
time it did on 2.6.5.
62f69e27f0
2025-03-27 13:57:26 +09:00
David Rodríguez
cdbadafd25
[rubygems/rubygems] Fix resolver issue due to ill-defined version ranges being created
...
f2f2ac9680
2025-02-21 11:31:44 +09:00
David Rodríguez
ee03df26ba
[rubygems/rubygems] --prefer-local
should resolve to latest version if no gems are available locally
...
Filtering out remote specs should only apply where there are locally
installed specs. Otherwise they should always be considered.
118f8389a1
2025-02-13 09:37:51 +09:00
David Rodríguez
0b1b8bc3ec
[rubygems/rubygems] Don't remove platform specific variants from the 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.
9a3e583b0c
2025-01-14 12:24:37 +09:00
David Rodríguez
2b91a56d40
[rubygems/rubygems] Remove no longer necessary code
...
9ea1539b08
2024-11-26 15:11:05 +09:00
David Rodríguez
e15921c694
[rubygems/rubygems] Create LazySpecifications directly with most_specific_locked_platform
...
So there's no need to pass it around in so many places.
784ab7481b
2024-11-26 15:11:05 +09:00
David Rodríguez
963f98a94f
[rubygems/rubygems] Enable Performance/MapCompact
cop
...
0c3a65871a
2024-11-26 15:11:05 +09:00
David Rodríguez
4addaaf4df
[rubygems/rubygems] More aggressive Performance/FlatMap
cop configuration
...
d8d68cc00e
2024-11-26 15:11:05 +09:00
David Rodríguez
2569413b1c
[rubygems/rubygems] Fix --prefer-local
flag
...
The original implementation of this flag was too naive and all it did
was restricting gems to locally installed versions if there are any
local versions installed.
However, it should be much smarter. For example:
* It should fallback to remote versions if locally installed version
don't satisfy the requirements.
* It should pick locally installed versions even for subdependencies not
yet discovered.
This commit fixes both issues by using a smarter approach similar to how
we resolve prereleases:
* First resolve optimistically using only locally installed gems.
* If any conflicts are found, scan those conflicts, allow remote
versions for the specific gems that run into conflicts, and
re-resolve.
607a3bf479
Co-authored-by: Gourav Khunger <gouravkhunger18@gmail.com>
2024-08-22 11:48:32 +00:00
David Rodríguez
203051d839
[rubygems/rubygems] Fix bad grammar in log message
...
bea4c1ad79
2024-08-22 11:48:31 +00:00
David Rodríguez
140d8318db
[rubygems/rubygems] Fix generic platform gems getting incorrectly removed when locked for a specific platform
...
If they are already in the lockfile as the most specific variant for a
platform, we shouldn't change that unless explicitly unlocking.
a901660498
2024-07-09 16:34:09 +00:00
David Rodríguez
dd05191bc3
[rubygems/rubygems] Resolve all platforms directly
...
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.
e50415f2a6
2024-07-09 16:34:08 +00:00
David Rodríguez
086cde1651
[rubygems/rubygems] Instantiate Resolver::SpecGroup
with explicit priority
...
e2c1bc1b6c
2024-07-09 16:34:07 +00:00
David Rodríguez
5fdfdc30f1
[rubygems/rubygems] Let resolver consider unique specs from the beginning
...
It results in more consistent error messages.
a4b34361cc
2024-07-09 16:34:07 +00:00
David Rodriguez
e2a1d0b53d
[rubygems/rubygems] Improve error message when strict resolution filters out everything
...
1ea44b3749
2024-04-01 15:03:28 +00:00
David Rodriguez
f80bb3837c
[rubygems/rubygems] Keep unfiltered versions separately
...
7b5cc51a96
2024-04-01 15:03:27 +00:00
David Rodriguez
bfdbdf7aae
[rubygems/rubygems] No need to check for root package every time
...
6ca192649f
2024-04-01 15:03:27 +00:00
David Rodriguez
b6ac37c91a
[rubygems/rubygems] No need for any version prioritization when building errors
...
We just need to filter versions belonging to the range, but don't need
anything else.
8355a225d7
2024-04-01 15:03:26 +00:00
David Rodriguez
caaafbc35e
[rubygems/rubygems] Make it look more like BasicPackageSource
...
bb5727934c
2024-04-01 15:03:26 +00:00
David Rodriguez
d69ef1cc52
[rubygems/rubygems] Let GemVersionPromoter sort in preferred order directly
...
So that we don't need to reverse the Array.
aeea5e2e00
2024-04-01 15:03:25 +00:00
David Rodriguez
acbd91e47f
[rubygems/rubygems] No need to sort twice when filling versions
...
13294528c4
2024-04-01 15:03:24 +00:00
David Rodriguez
d342937e01
[rubygems/rubygems] Rename method for clarity
...
And also so that it matches the method used by main PubGrub sample
resolver class.
0e612361b8
2024-04-01 15:03:24 +00:00
David Rodríguez
2755cb1b2f
[rubygems/rubygems] Use modern hashes consistently
...
bb66253f2c
2023-12-07 22:29:33 +00:00
David Rodríguez
77ffa1a7c3
[rubygems/rubygems] Raise an error when top level dependency does not resolve under all locked platforms
...
25304f3e8d
2023-10-16 13:52:57 +09:00
David Rodríguez
b7ad9eda3c
[rubygems/rubygems] Tweak platform mismatch resolution errors
...
20460bc1ee
2023-10-16 13:52:56 +09:00
David Rodriguez
ed0661e618
[rubygems/rubygems] Don't re-resolve with prereleases if unlocked gem has no prereleases
...
d76dc70d90
2023-10-03 09:42:31 +00:00
David Rodríguez
80f35d96ae
[rubygems/rubygems] Don't check for circular deps on full index sources
...
d275cdccb1
2023-08-28 11:15:34 +09:00
Martin Emde
7bf5f78028
[rubygems/rubygems] Refactor Fetcher#api_fetcher? and fetcher loading logic
...
f664d60114
2023-08-28 11:15:32 +09:00
Hiroshi SHIBATA
1edbaa850f
Merge rubygems/rubygems HEAD
...
Pick from 880dd95996
2023-06-20 13:35:13 +09:00
David Rodríguez
0b9e51c429
Don´t consider platform specific candidates when force_ruby_platform
set
...
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-17 18:50:55 +09:00
David Rodríguez
12f0be14e2
Don't ignore pre-releases when there's only one candidate
...
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-03-17 18:50:55 +09:00
Hiroshi SHIBATA
38fa8eb4cb
Merge rubygems/bundler master
...
Pick from e9304aed7e
2023-02-21 19:28:12 +09:00
Hiroshi SHIBATA
d3822c9a8a
Merge RubyGems/Bundler master.
...
Pick from 5ace20dbec
2023-01-31 10:49:08 +09:00
Hiroshi SHIBATA
a43f1d90c2
Merge RubyGems and Bundler master
...
from 0635c1423d
2023-01-10 15:53:07 +09:00
David Rodríguez
2e0159c5f2
[rubygems/rubygems] Fix resolver edge case
...
Let it deal with legacy gems with equivalent version and different
dependencies.
b430babe97
2023-01-10 12:58:28 +09:00
David Rodríguez
8f05e4f54b
Update Bundler to 2.4.1 & and RubyGems to 3.4.1
2022-12-25 05:55:36 +09:00
Hiroshi SHIBATA
f6620037ba
Merge RubyGems-3.4.0 and Bundler-2.4.0
2022-12-24 16:57:07 +09:00
David Rodríguez
1db9bcfeaf
[rubygems/rubygems] Fix crash when building resolution errors with OR requirements
...
8f287479bc
2022-12-20 13:15:02 +09:00
David Rodríguez
8293489564
[rubygems/rubygems] Slight tweak to error message building
...
Let Pub Grub decide how the constraint should be displayed.
4f651b6429
2022-12-20 13:15:02 +09:00
David Rodríguez
d1533f20f1
[rubygems/rubygems] Detect circular dependency errors
...
a8348d271d
2022-12-20 13:15:02 +09:00
David Rodríguez
96aa1a1a98
[rubygems/rubygems] Remove dead logic
...
950615405e
2022-12-20 13:15:02 +09:00
David Rodríguez
d1c210355b
[rubygems/rubygems] Extract a variable for consistency
...
3f4b1c7a01
2022-12-20 13:15:02 +09:00
Hiroshi SHIBATA
a4e14b9d9d
Merge RubyGems/Bundler master
...
Pick from 823c776d95
2022-12-09 16:36:22 +09:00
Hiroshi SHIBATA
0a9d51ee9d
Migrate our resolver engine to PubGrub
...
https://github.com/rubygems/rubygems/pull/5960
Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
2022-11-12 07:40:31 +09:00
Hiroshi SHIBATA
f5df47d1f3
Merge RubyGems/Bundler master
...
6214d00b23
2022-10-18 16:33:15 +09:00
David Rodríguez
804ae4ea12
[rubygems/rubygems] Simplify SpecGroup creation
...
788e46e152
2022-10-18 16:33:15 +09:00
David Rodríguez
4205190cb2
[rubygems/rubygems] Remove dead code
...
999b644708
2022-10-18 16:33:15 +09:00