Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Respect enclosing group and platforms for gemspec dependencies - #9990

Merged
hsbt merged 1 commit into
ruby:masterfrom
senid231:fix-gemspec-in-group-block
Oct 30, 2026
Merged

hsbt merged 1 commit into
ruby:masterfrom
senid231:fix-gemspec-in-group-block

Conversation

@senid231

Copy link
Copy Markdown
Contributor

What was the end-user or developer problem that led to this PR?

Fixes #9989. Since Bundler 2.6.4, a gemspec call inside a group block puts the gem in the :default group, and inside a platforms block it loses the platform. Apps that load path gems with Bundler.require(*groups) end up requiring every engine.

What is your fix for the problem, implemented in this PR?

#8480 replaced gem spec.name, ... with a direct add_dependency spec.name, which skips normalize_options, where gem reads the enclosing groups, platforms and install_if conditions. The fix runs normalize_options for the gemspec's gem before adding it.

Development dependencies still get only development_group, as they have since 2.6.4. I left them alone to keep this change small.

Make sure the following tasks are checked

Since Bundler 2.6.4, `gemspec` adds its gem without normalizing options,
so a surrounding `group`, `platforms` or `install_if` block is ignored.

Fixes ruby#9989.

Co-Authored-By: Clanker
@hsbt
hsbt merged commit c2380f6 into ruby:master Oct 30, 2026
114 checks passed
@senid231
senid231 deleted the fix-gemspec-in-group-block branch October 30, 2026 05:50
abbbi added a commit to vagrant-libvirt/vagrant-libvirt that referenced this pull request Nov 24, 2026
The ubuntu-22.04 images were deprecated on 2026-09-17 and are fully
unsupported from 2027-04-17.

Rather than pin the patch versions to a runner that will be deprecated in
turn, move the unit test matrix to ruby versions that are available there,
paired with a vagrant that accepts them:

  ruby 3.1 + vagrant v2.4.9   oldest ruby still shipped (Debian 12)
  ruby 3.3 + vagrant v2.4.9   latest release, accepts ruby < 3.5
  ruby 3.4 + vagrant v2.4.9
  ruby 3.4 + vagrant main     allowed to fail
  ruby 4.0 + vagrant main     allowed to fail

This drops ruby 2.3 to 2.7 with vagrant 2.1.5 to 2.2.14. Those combinations
no longer correspond to any supported distribution: the newest of them,
vagrant 2.2.14 on ruby 2.6, is Debian 11, whose LTS ended in August 2026.
The vagrant releases that current distributions do package cannot be tested
either, as 2.3.4 fails on google-protobuf having removed the
DescriptorPool#build API its generated code calls, and 2.3.7 only accepts
ruby up to 3.2, which cannot build vagrant's pinned ed25519 1.3.0 against
the ubuntu-26.04 compiler. Ruby 4.0 can only be tested against vagrant main
for now, as no release accepts it yet.

Setting up ruby also pins bundler, because bundler 2.6 up to 4.0.23 does
not apply the enclosing group block to `gemspec` (ruby/rubygems#9990).

The integration tests move the same way.
Two of the packages they install were transitional and no longer exist
on ubuntu-26.04, so qemu-kvm becomes qemu-system-x86 and libz-dev
becomes zlib1g-dev.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gemspec inside a group or platforms block ignores the group and platform since Bundler 2.6.4

2 participants