summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Marlow <graham@onesignal.com>2023-09-29 09:37:39 -0700
committergit <svn-admin@ruby-lang.org>2023-10-02 01:34:01 +0000
commitf3aea74c3d63a9b1e0f597b060bf84c14d1c70fc (patch)
tree02653de5f88c6cd1c1c7766376059076714bd5fd
parent1ed6fd899769e6cd66a1a3f66b7818d48ba4231b (diff)
[rubygems/rubygems] Include gemspec in ExtensionTask for native gem tasks
https://github.com/rubygems/rubygems/commit/042cfb7007
-rw-r--r--lib/bundler/templates/newgem/Rakefile.tt8
-rw-r--r--spec/bundler/commands/newgem_spec.rb8
2 files changed, 12 insertions, 4 deletions
diff --git a/lib/bundler/templates/newgem/Rakefile.tt b/lib/bundler/templates/newgem/Rakefile.tt
index b5a5c4e392..77f8a02530 100644
--- a/lib/bundler/templates/newgem/Rakefile.tt
+++ b/lib/bundler/templates/newgem/Rakefile.tt
@@ -46,7 +46,9 @@ require "rb_sys/extensiontask"
task build: :compile
-RbSys::ExtensionTask.new(<%= config[:name].inspect %>) do |ext|
+GEMSPEC = Gem::Specification.load("<%= config[:underscored_name] %>.gemspec")
+
+RbSys::ExtensionTask.new(<%= config[:name].inspect %>, GEMSPEC) do |ext|
ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
end
<% else -%>
@@ -54,7 +56,9 @@ require "rake/extensiontask"
task build: :compile
-Rake::ExtensionTask.new("<%= config[:underscored_name] %>") do |ext|
+GEMSPEC = Gem::Specification.load("<%= config[:underscored_name] %>.gemspec")
+
+Rake::ExtensionTask.new("<%= config[:underscored_name] %>", GEMSPEC) do |ext|
ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
end
<% end -%>
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb
index e06c8c8dd3..b34ffbc35b 100644
--- a/spec/bundler/commands/newgem_spec.rb
+++ b/spec/bundler/commands/newgem_spec.rb
@@ -1427,7 +1427,9 @@ RSpec.describe "bundle gem" do
task build: :compile
- Rake::ExtensionTask.new("#{gem_name}") do |ext|
+ GEMSPEC = Gem::Specification.load("#{gem_name}.gemspec")
+
+ Rake::ExtensionTask.new("#{gem_name}", GEMSPEC) do |ext|
ext.lib_dir = "lib/#{gem_name}"
end
@@ -1485,7 +1487,9 @@ RSpec.describe "bundle gem" do
task build: :compile
- RbSys::ExtensionTask.new("#{gem_name}") do |ext|
+ GEMSPEC = Gem::Specification.load("#{gem_name}.gemspec")
+
+ RbSys::ExtensionTask.new("#{gem_name}", GEMSPEC) do |ext|
ext.lib_dir = "lib/#{gem_name}"
end