-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use RbSys::ExtensionTask
when creating new rust gems
#6352
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I confirmed to usage for rb_sys/extensiontask
via https://github.com/oxidize-rb/rb-sys/tree/main/gem#rbsysextensiontask
|
||
task build: :compile | ||
|
||
RbSys::ExtensionTask.new(<%= config[:name].inspect %>) do |ext| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ianks
Don't need to pass gemspec
here? According to the document, it requires here.
https://github.com/oxidize-rb/rb-sys/tree/main/gem#rbsysextensiontask
If my understanding is correct, it is needed to check some data in the gemspec
.
https://github.com/oxidize-rb/rb-sys/blob/dfc51c60bef89925bfded1713e9ec02c5dfb639d/gem/lib/rb_sys/extensiontask.rb#L139-L149
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's needed for cross-compilation, but it's optional. Probably a good idea to add it though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I understood the intent. I was curious because using RbSys::ExtensionTask
without gemspec
raises an error now. It seems it's not intended so I will create a patch to rb-sys
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use `RbSys::ExtensionTask` when creating new rust gems (cherry picked from commit 6a62e46)
This PR makes it so
bundle gem --ext=rust
will useRbSys::ExtensionTask
. This is a thin wrapper overRake::ExtensionTask
, which is tailored for Rust and addresses a number of shortcomings of using the default configuration. Namely:target
directories (reducing compilation times and cache bloat)cargo metadata
to find extension dir (similar to @matsadler PR).Links