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

Set correct required_ruby_version when some RUBY_CC_VERSIONs are missing #199

Merged
merged 1 commit into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions lib/rake/extensiontask.rb
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,6 @@ def define_cross_platform_tasks(for_platform)
@lib_dir = "#{@lib_dir}/#{$1}"
end

# Update cross compiled platform/version combinations
@ruby_versions_per_platform[for_platform] << version
Copy link
Member

Choose a reason for hiding this comment

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

This line was added in #166 by you.
Could you confirm that this doesn't break #166 case?

Copy link
Member Author

Choose a reason for hiding this comment

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

Originally it was added in #137, but modified later on and it was actually obsoleted by #166, but I didn't notice that.
I can confirm that both use cases (#137 and #166) work properly.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks.


define_cross_platform_tasks_with_version(for_platform, version)

# restore lib_dir
Expand Down
9 changes: 6 additions & 3 deletions spec/lib/rake/extensiontask_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -456,14 +456,17 @@

it "should set required_ruby_version from RUBY_CC_VERSION, set platform, clear extensions but keep metadata" do
platforms = ["x86-mingw32", "x64-mingw32"]
ruby_cc_versions = ["1.8.6", "2.1.10", "2.2.6", "2.3.3", "2.10.1"]
ruby_cc_versions = ["1.8.6", "2.1.10", "2.2.6", "2.3.3", "2.10.1", "2.11.0"]
ENV["RUBY_CC_VERSION"] = ruby_cc_versions.join(":")
config = Hash.new
ruby_cc_versions.each do |ruby_cc_version|
platforms.each do |platform|
unless platform == "x64-mingw32" && ruby_cc_version == "2.11.0"
rbconf = "/rubies/#{ruby_cc_version}/rbconfig.rb"
end
allow(config).to receive(:[]).
with("rbconfig-#{platform}-#{ruby_cc_version}").
and_return("/rubies/#{ruby_cc_version}/rbconfig.rb")
and_return(rbconf)
end
end
allow(YAML).to receive(:load_file).and_return(config)
Expand All @@ -490,7 +493,7 @@
end

expected_required_ruby_versions = [
Gem::Requirement.new([">= 1.8", "< 2.11.dev"]),
Gem::Requirement.new([">= 1.8", "< 2.12.dev"]),
Gem::Requirement.new([">= 1.8", "< 2.11.dev"]),
]
cross_specs.collect(&:required_ruby_version).should == expected_required_ruby_versions
Expand Down