Closed marcotc closed 1 year ago
Protobuf 3.24.x is dropping support for CRuby <2.7: https://protobuf.dev/news/2023-07-06/#dropping-python-37-support
Unfortunately we were not able to update our gemspec to s.required_ruby_version >= 2.7
, because that broke compatibility with JRuby 9.2, which we still support. So currently we still list s.required_ruby_version >= 2.5
.
Is there a way we can advertise compatibility with CRuby >= 2.7 and JRuby >= 9.2.0?
I see that there's a specific platform: java
published for this gem.
Would allowing Ruby >= 2.5
only for platform: java
work for JRuby 9.2.0?
Hey!
I work with Marco and noticed that since you already have a if RUBY_PLATFORM == "java"
, you should be able to move the required_ruby_version inside it, e.g. something like:
Gem::Specification.new do |s|
s.name = "google-protobuf"
s.version = "3.23.0"
git_tag = "v#{s.version.to_s.sub('.rc.', '-rc')}" # Converts X.Y.Z.rc.N to vX.Y.Z-rcN, used for the git tag
s.licenses = ["BSD-3-Clause"]
s.summary = "Protocol Buffers"
s.description = "Protocol Buffers are Google's data interchange format."
s.homepage = "https://developers.google.com/protocol-buffers"
s.authors = ["Protobuf Authors"]
s.email = "protobuf@googlegroups.com"
s.metadata = { "source_code_uri" => "https://github.com/protocolbuffers/protobuf/tree/#{git_tag}/ruby" }
s.require_paths = ["lib"]
s.files = Dir.glob('lib/**/*.rb')
if RUBY_PLATFORM == "java"
s.platform = "java"
s.files += ["lib/google/protobuf_java.jar"]
s.required_ruby_version = '>= 2.5'
else
s.files += Dir.glob('ext/**/*')
s.extensions= ["ext/google/protobuf_c/extconf.rb"]
s.add_development_dependency "rake-compiler-dock", "= 1.2.1"
s.required_ruby_version = '>= 2.7'
end
s.add_development_dependency "rake-compiler", "~> 1.1.0"
s.add_development_dependency "test-unit", '~> 3.0', '>= 3.0.9'
end
Code in the gemfile gets evaluated at packaging time, and its output is distributed inside the .gem
file.
We ended up opting to drop support for JRuby 9.2 and 9.3 in 24.x release, after adding tests for JRuby 9.4 support. This means we can now consistently enforce >=2.7 as our required ruby version, which should resolve this issue.
This will be released in 24.0-rc2 which we are planning to release this week.
This decision was made based on the support window for the corresponding Ruby version per https://cloud.google.com/ruby/getting-started/supported-ruby-versions.
That works great for us as well!
As a follow up, would you mind yanking the 3.24.0.rc.1
version with the incorrect metadata (this one) once rc2 is out?
That would be very very helpful because it would make the legacy Rubies pick up the last supported version (3.24.4), instead of the forever-broken-for-them rc1.
We've yanked all 3.24.0.rc.1
artifacts for Ruby, and 3.24.rc.2
has been released with the updated required ruby version number. Please let us know if you still have any trouble, and thanks for catching this in our -RC!
It does seem surprising to us that our -RC version would get picked up automatically given these are release candidates that are expected to be somewhat unstable. How is this being picked up on your side?
We've yanked all 3.24.0.rc.1 artifacts for Ruby, and 3.24.rc.2 has been released with the updated required ruby version number. Please let us know if you still have any trouble, and thanks for catching this in our -RC!
Thanks a lot! :bow:
It does seem surprising to us that our -RC version would get picked up automatically given these are release candidates that are expected to be somewhat unstable. How is this being picked up on your side?
That's a very very good question. My understanding matches yours -- rubygems/bundler should not automatically pick up rc releases unless you ask it to.
And yet, that's what we saw in our CI (and I could reproduce it locally as well): https://app.circleci.com/pipelines/github/DataDog/dd-trace-rb/10871/workflows/90c509f6-a12a-441a-8e1d-ad0b1567efed/jobs/405709 .
Our Ruby 2.6 image used for testing doesn't appear to be particularly fancy (link 1) and the Gemfile excludes a few other versions of google-protobuf
(for compatibility with even older Rubies), but nothing seems to jump out at me either (link 2).
Closing this issue, since the original ruby required ruby version issue has been addressed.
Nothing jumps out at me in your setup and I believe we are releasing as pre-release correctly -- https://rubygems.org/gems/google-protobuf/versions/3.24.0.rc.2-x64-mingw32 shows gem install google-protobuf -v 3.24.0.rc.2 --pre
. Feel free to reopen a new issue if something seems to be misconfigured on our side though.
In any case, it is helpful for us to get feedback like this for our earlier -RCs to address issues like this in subsequent -RCs, so thank you for the report.
What version of protobuf and what language are you using? Version: v3.24.0-rc1 Language: Ruby
What operating system (Linux, Windows, ...) and version?
Docker x86_64, Debian base image.
What runtime / compiler are you using (e.g., python version or gcc version)
ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-linux]. Ruby 2.6.
gcc version 8.3.0 (Debian 8.3.0-6).
What did you do? Steps to reproduce the behavior:
docker run --rm -it ruby:2.5 gem install google-protobuf -v 3.24.0.rc.1 --platform ruby
protobuf.h:45:2: error: #error Protobuf requires Ruby >= 2.7
What did you expect to see
Gem should not advertise support for a Ruby version it doesn't support. This is working correctly for all platforms
3.24.0.rc.1
is published for, except theruby
platform, which advertisesRuby >= 2.5
. All other platforms advertiseRuby >= 2.7
.For example, for
x86_64-linux
, the command fails with a clear message:docker run --rm -it ruby:2.5 gem install google-protobuf -v 3.24.0.rc.1 --platform x86_64-linux
What did you see instead?
Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
Anything else we should know about your project / environment
The issue this causes us is that
gem "google-protobuf"
is failing in our builds of Ruby 2.5 & 2.6 becausebundler
thinks3.24.0.rc.1
is compatible with those versions of Ruby.