-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Migrate to magnus/rb_sys #194
Conversation
36a19d1
to
f863f97
Compare
f863f97
to
bfaa8da
Compare
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.
Awesome stuff, super excited to see this happening. Let me know if you have any questions along the way. Happy to help!
@@ -0,0 +1,134 @@ | |||
# frozen_string_literal: true | |||
|
|||
CrossRuby = Struct.new(:version, :platform) do |
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.
FWIW, I’ve tried to package some of this data in rb-sys, and would love to add support for anything else that’s useful if it’s missing anything!
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.
Hell yeah, thanks!
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.
That link goes to the wrong project, I think--is the rb-sys logic in RbSys::ToolchainInfo
? I'm not seeing an easy way to just do like if windows?
using pure 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.
Good point, seems useful to have. I'd be happy to add that.
# Ruby doesn't know that it's on a musl-based platform. `ldd` is the | ||
# a more reliable way to detect musl. | ||
# See https://github.com/skylightio/skylight-ruby/issues/92 | ||
if ENV["SKYLIGHT_MUSL"] || %x(ldd --version 2>&1).include?("musl") |
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.
We just merged in support for musl builds in rb-sys and could help out trying to iron it all out if you join the Slack
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.
Heck yeah, will join for sure. I’ve been hacking together Rust in Ruby for so long, I’m excited to see tooling and a community behind it!
Thanks! The rewrite to use Rust “glue” has happened and was tremendously easy. My biggest fight right now is figuring out how to automate the compilation and packaging for all the operating systems I want to support. This has raised a number of problems, most of which are GitHub Actions runner related:
I just want x86_64 and arm64 builds for Linux, Windows, and macOS. I got it working locally but I’m really struggling with the runners. 😞 |
bfaa8da
to
0035206
Compare
The |
3d4eacd
to
17c66f7
Compare
e3de5b9
to
97fa6ca
Compare
- uses: oxidize-rb/cross-gem-action@main | ||
with: | ||
platform: ${{ matrix.platform }} | ||
env: | |
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.
Should be good to support 2.7+
env: | | |
ruby-versions: '3.1, 3.0, 2.7' |
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.
Yeah, but I don't wanna 😝
The real reason is that I don't want to maintain two Windows architectures for the next few years. Ruby 3.1 changed the toolchain string and I don't want to carry the cognitive load of "if < 3.1, do X." People will just have to deal. 🤷🏻♂️
run: | | ||
./script/test-gem-build gems ${{matrix.platform}} | ||
|
||
- uses: actions/upload-artifact@v3 |
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.
cross-gem-action does perform an upload of the artifact, so this may not be necessary?
|
||
fn iterate_extension_options(comrak_options: &mut ComrakOptions, options_hash: RHash) { | ||
options_hash.foreach(|key: Symbol, value: Value| { | ||
if key.name().unwrap() == "strikethrough" { |
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.
nit: this may read better as a match, and avoid some allocations:
match key.name() {
Ok("strikethrough") => ...,
Ok("tagfilter") => ...,
}
42d70f0
to
04d5436
Compare
04d5436
to
cbc8a3d
Compare
The previous attempt to create a gem based on a Rust lib worked, but I could not for the life of me figure out MingW build errors in the FFI.
After searching the Net for some help I came across rb-sys and magnus; the former makes packaging Rust libs much easier than the mini_portile2 method I was using before, and the latter enabled writing the glue binding code to be written in Rust, not C. Beautiful, incredible.