Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow pre-compiled binaries for ruby 3.1.0 #9566

Merged
merged 15 commits into from Mar 17, 2022
Merged
14 changes: 11 additions & 3 deletions ruby/Rakefile
Expand Up @@ -122,18 +122,26 @@ else
task 'gem:windows' do
sh "rm Gemfile.lock"
require 'rake_compiler_dock'
['x86-mingw32', 'x64-mingw32', 'x86_64-linux', 'x86-linux'].each do |plat|
['x86-mingw32', 'x64-mingw32', 'x86_64-linux', 'x86-linux', 'x64-mingw-ucrt'].each do |plat|
# x64-mingw-ucrt only supports 3.1+ whereas 'x64-mingw32' only supports up to 3.0
versions = if plat == 'x64-mingw-ucrt'
'3.1.1'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice that the other versions are minor versions with a .0 as the patch, e.g. 3.0.0, 2.7.0... Your Ruby 3.1 version string is written as 3.1.1 instead of 3.1.0.

Is that intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went for the latest version of ruby. I'm not sure if it would make any difference, I could use 3.1.0 if it also would support 3.1.1 (not sure about this)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's worth a shot, if only for consistency.

elsif plat == 'x64-mingw32'
'3.0.0:2.7.0:2.6.0:2.5.0'
else
'3.1.1:3.0.0:2.7.0:2.6.0:2.5.0'
end
RakeCompilerDock.sh <<-"EOT", platform: plat
bundle && \
IN_DOCKER=true rake native:#{plat} pkg/#{spec.full_name}-#{plat}.gem RUBY_CC_VERSION=3.0.0:2.7.0:2.6.0:2.5.0
IN_DOCKER=true rake native:#{plat} pkg/#{spec.full_name}-#{plat}.gem RUBY_CC_VERSION=#{versions}
EOT
end
end

if RUBY_PLATFORM =~ /darwin/
task 'gem:native' do
system "rake genproto"
system "rake cross native gem RUBY_CC_VERSION=3.0.0:2.7.0:2.6.0:2.5.1"
system "rake cross native gem RUBY_CC_VERSION=3.1.1:3.0.0:2.7.0:2.6.0:2.5.1"
end
else
task 'gem:native' => [:genproto, 'gem:windows', 'gem:java']
Expand Down
4 changes: 2 additions & 2 deletions ruby/google-protobuf.gemspec
Expand Up @@ -17,12 +17,12 @@ Gem::Specification.new do |s|
else
s.files += Dir.glob('ext/**/*')
s.extensions= ["ext/google/protobuf_c/extconf.rb"]
s.add_development_dependency "rake-compiler-dock", "= 1.1.0"
s.add_development_dependency "rake-compiler-dock", "= 1.2.0"
end
s.test_files = ["tests/basic.rb",
"tests/stress.rb",
"tests/generated_code_test.rb"]
s.required_ruby_version = '>= 2.3'
s.add_development_dependency "rake-compiler", "~> 1.1.0"
s.add_development_dependency "rake-compiler", "~> 1.2.0"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rake-compiler does not have a 1.2.0 release yet: https://rubygems.org/gems/rake-compiler. Did you mean to move up to the latest release, 1.1.9?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I may have just mistakenly changed this. Fixed it back to what it was, as it also should support the latest (not that it's needed I think)

s.add_development_dependency "test-unit", '~> 3.0', '>= 3.0.9'
end