From f3aea74c3d63a9b1e0f597b060bf84c14d1c70fc Mon Sep 17 00:00:00 2001 From: Graham Marlow Date: Fri, 29 Sep 2023 09:37:39 -0700 Subject: [rubygems/rubygems] Include gemspec in ExtensionTask for native gem tasks https://github.com/rubygems/rubygems/commit/042cfb7007 --- lib/bundler/templates/newgem/Rakefile.tt | 8 ++++++-- spec/bundler/commands/newgem_spec.rb | 8 ++++++-- 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 -- cgit v1.2.3