From 51d4c2c465e3ce708dddcd65d93e6e29225b454d Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 9 Feb 2026 13:46:05 +0100 Subject: [ruby/rubygems] Document gemspecs must be deterministic https://github.com/ruby/rubygems/commit/7cab5cd68f --- lib/rubygems/specification.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index aa495696ad..64f289a7b4 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -34,6 +34,15 @@ require "rbconfig" # Starting in RubyGems 2.0, a Specification can hold arbitrary # metadata. See #metadata for restrictions on the format and size of metadata # items you may add to a specification. +# +# Specifications must be deterministic, as in the example above. For instance, +# you cannot define attributes conditionally: +# +# # INVALID: do not do this. +# unless RUBY_ENGINE == "jruby" +# s.extensions << "ext/example/extconf.rb" +# end +# class Gem::Specification < Gem::BasicSpecification # REFACTOR: Consider breaking out this version stuff into a separate -- cgit v1.2.3