diff options
author | Ian Ker-Seymer <hello@ianks.com> | 2023-02-06 14:19:18 -0500 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-03-10 11:50:06 +0000 |
commit | dd47ce10dbfca9292e88bbbd3d7f37e3ea503034 (patch) | |
tree | 446748f3f2b3dfc1e67e94a7159cdb41419d545c /lib | |
parent | 4dce12bead3bfd91fd80b5e7195f7f540ffffacb (diff) | |
download | ruby-dd47ce10dbfca9292e88bbbd3d7f37e3ea503034.tar.gz |
[rubygems/rubygems] Use `RbSys::ExtensionTask` when creating new rust gems
https://github.com/rubygems/rubygems/commit/125f9fece9
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/templates/newgem/Gemfile.tt | 2 | ||||
-rw-r--r-- | lib/bundler/templates/newgem/Rakefile.tt | 10 | ||||
-rw-r--r-- | lib/bundler/templates/newgem/github/workflows/main.yml.tt | 2 |
3 files changed, 12 insertions, 2 deletions
diff --git a/lib/bundler/templates/newgem/Gemfile.tt b/lib/bundler/templates/newgem/Gemfile.tt index 41c95677a3..a0d2ac2826 100644 --- a/lib/bundler/templates/newgem/Gemfile.tt +++ b/lib/bundler/templates/newgem/Gemfile.tt @@ -10,7 +10,7 @@ gem "rake", "~> 13.0" gem "rake-compiler" <%- if config[:ext] == 'rust' -%> -gem "rb_sys" +gem "rb_sys", "~> 0.9.63" <%- end -%> <%- end -%> <%- if config[:test] -%> diff --git a/lib/bundler/templates/newgem/Rakefile.tt b/lib/bundler/templates/newgem/Rakefile.tt index ac14545126..b5a5c4e392 100644 --- a/lib/bundler/templates/newgem/Rakefile.tt +++ b/lib/bundler/templates/newgem/Rakefile.tt @@ -41,6 +41,15 @@ require "standard/rake" <% if config[:ext] -%> <% default_task_names.unshift(:compile) -%> <% 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" task build: :compile @@ -48,6 +57,7 @@ task build: :compile Rake::ExtensionTask.new("<%= config[:underscored_name] %>") do |ext| ext.lib_dir = "lib/<%= config[:namespaced_path] %>" end +<% end -%> <% end -%> <% if default_task_names.size == 1 -%> diff --git a/lib/bundler/templates/newgem/github/workflows/main.yml.tt b/lib/bundler/templates/newgem/github/workflows/main.yml.tt index d4021980b4..be58dd8156 100644 --- a/lib/bundler/templates/newgem/github/workflows/main.yml.tt +++ b/lib/bundler/templates/newgem/github/workflows/main.yml.tt @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v3 <%- if config[:ext] == '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: ruby-version: ${{ matrix.ruby }} bundler-cache: true |