summaryrefslogtreecommitdiff
path: root/lib/rubygems/specification_policy.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2022-12-22 08:20:23 +0900
committerHiroshi SHIBATA <[email protected]>2022-12-24 16:57:07 +0900
commitf6620037ba1477d2c337d7b511f094d6d0fbb69c (patch)
tree4d8d38eaf97e6ca88162dd574e7871e1739f22ae /lib/rubygems/specification_policy.rb
parentd5635dfe36588b04d3dd6065ab4e422f51629b11 (diff)
Merge RubyGems-3.4.0 and Bundler-2.4.0
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6987
Diffstat (limited to 'lib/rubygems/specification_policy.rb')
-rw-r--r--lib/rubygems/specification_policy.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/rubygems/specification_policy.rb b/lib/rubygems/specification_policy.rb
index 44b31211e5..f01a6cd743 100644
--- a/lib/rubygems/specification_policy.rb
+++ b/lib/rubygems/specification_policy.rb
@@ -460,6 +460,20 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
require_relative "ext"
builder = Gem::Ext::Builder.new(@specification)
+ validate_rake_extensions(builder)
+ validate_rust_extensions(builder)
+ end
+
+ def validate_rust_extensions(builder) # :nodoc:
+ rust_extension = @specification.extensions.any? {|s| builder.builder_for(s).is_a? Gem::Ext::CargoBuilder }
+ missing_cargo_lock = [email protected]?("Cargo.lock")
+
+ error <<-ERROR if rust_extension && missing_cargo_lock
+You have specified rust based extension, but Cargo.lock is not part of the gem files. Please run `cargo generate-lockfile` or any other command to generate Cargo.lock and ensure it is added to your gem files section in gemspec.
+ ERROR
+ end
+
+ def validate_rake_extensions(builder) # :nodoc:
rake_extension = @specification.extensions.any? {|s| builder.builder_for(s) == Gem::Ext::RakeBuilder }
rake_dependency = @specification.dependencies.any? {|d| d.name == "rake" }