Improve default gem handling by treating default gems as any other gem #7673
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What was the end-user or developer problem that led to this PR?
Bundler behaves inconsistently in presence of default gems, and that can be confusing. See for example the situation in ruby/ruby#9163 (comment).
What is your fix for the problem, implemented in this PR?
My fix is that, once a default gem is specified directly in the Gemfile, or resolved as a transitive dependency, it becomes part of the bundle and gets treated as a "regular gem", so it's cached, explicitly installed in the configured location, etc.
NOTE: This is an improved version of #7242 (which had to be reverted) which fixes the issues in the initial approach and makes the change fully backwards compatible. If at
bundler/setup
time, default gems are found to be missing in the installed location, we will still fallback to considering them, but by defaultbundle install
will treat them as regular gems and install them normally.I think the new approach should also fix #4088.
Make sure the following tasks are checked