[rubygems/rubygems] Use RbSys::ExtensionTask when creating new rust gems

https://github.com/rubygems/rubygems/commit/125f9fece9
This commit is contained in:
Ian Ker-Seymer 2023-02-06 14:19:18 -05:00 committed by git
parent 4dce12bead
commit dd47ce10db
8 changed files with 18 additions and 8 deletions

View File

@ -10,7 +10,7 @@ gem "rake", "~> 13.0"
gem "rake-compiler" gem "rake-compiler"
<%- if config[:ext] == 'rust' -%> <%- if config[:ext] == 'rust' -%>
gem "rb_sys" gem "rb_sys", "~> 0.9.63"
<%- end -%> <%- end -%>
<%- end -%> <%- end -%>
<%- if config[:test] -%> <%- if config[:test] -%>

View File

@ -41,6 +41,15 @@ require "standard/rake"
<% if config[:ext] -%> <% if config[:ext] -%>
<% default_task_names.unshift(:compile) -%> <% default_task_names.unshift(:compile) -%>
<% default_task_names.unshift(:clobber) unless config[:ext] == 'rust' -%> <% default_task_names.unshift(:clobber) unless config[:ext] == 'rust' -%>
<% if config[:ext] == 'rust' -%>
require "rb_sys/extensiontask"
task build: :compile
RbSys::ExtensionTask.new(<%= config[:name].inspect %>) do |ext|
ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
end
<% else -%>
require "rake/extensiontask" require "rake/extensiontask"
task build: :compile task build: :compile
@ -48,6 +57,7 @@ task build: :compile
Rake::ExtensionTask.new("<%= config[:underscored_name] %>") do |ext| Rake::ExtensionTask.new("<%= config[:underscored_name] %>") do |ext|
ext.lib_dir = "lib/<%= config[:namespaced_path] %>" ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
end end
<% end -%>
<% end -%> <% end -%>
<% if default_task_names.size == 1 -%> <% if default_task_names.size == 1 -%>

View File

@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
<%- if config[:ext] == 'rust' -%> <%- if config[:ext] == 'rust' -%>
- name: Set up Ruby & Rust - name: Set up Ruby & Rust
uses: oxidize-rb/actions/setup-ruby-and-rust@main uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with: with:
ruby-version: ${{ matrix.ruby }} ruby-version: ${{ matrix.ruby }}
bundler-cache: true bundler-cache: true

View File

@ -1473,11 +1473,11 @@ RSpec.describe "bundle gem" do
# frozen_string_literal: true # frozen_string_literal: true
require "bundler/gem_tasks" require "bundler/gem_tasks"
require "rake/extensiontask" require "rb_sys/extensiontask"
task build: :compile task build: :compile
Rake::ExtensionTask.new("#{gem_name}") do |ext| RbSys::ExtensionTask.new("#{gem_name}") do |ext|
ext.lib_dir = "lib/#{gem_name}" ext.lib_dir = "lib/#{gem_name}"
end end

View File

@ -10,7 +10,7 @@ GEM
parallel parallel
power_assert (2.0.2) power_assert (2.0.2)
rake (13.0.6) rake (13.0.6)
rb_sys (0.9.52) rb_sys (0.9.63)
rdiscount (2.2.7) rdiscount (2.2.7)
ronn (0.7.3) ronn (0.7.3)
hpricot (>= 0.8.2) hpricot (>= 0.8.2)

View File

@ -14,7 +14,7 @@ GEM
rake (13.0.6) rake (13.0.6)
rake-compiler (1.2.0) rake-compiler (1.2.0)
rake rake
rb_sys (0.9.52) rb_sys (0.9.63)
regexp_parser (2.6.1) regexp_parser (2.6.1)
rexml (3.2.5) rexml (3.2.5)
rspec (3.12.0) rspec (3.12.0)

View File

@ -15,7 +15,7 @@ GEM
rake (13.0.6) rake (13.0.6)
rake-compiler (1.2.0) rake-compiler (1.2.0)
rake rake
rb_sys (0.9.52) rb_sys (0.9.63)
regexp_parser (2.6.1) regexp_parser (2.6.1)
rexml (3.2.5) rexml (3.2.5)
rspec (3.12.0) rspec (3.12.0)

View File

@ -11,7 +11,7 @@ GEM
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rake (13.0.1) rake (13.0.1)
rb_sys (0.9.52) rb_sys (0.9.63)
ruby2_keywords (0.0.5) ruby2_keywords (0.0.5)
sinatra (2.0.8.1) sinatra (2.0.8.1)
mustermann (~> 1.0) mustermann (~> 1.0)