-
Notifications
You must be signed in to change notification settings - Fork 225
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
rebar3 integration? #85
Comments
I know @goertzenator has been working on some stuff related to that, namely cargo-erlangapp. I am fairly sure this could be used relatively easily with rustler, and it would be worth having a look. |
Did you try this one? |
@goertzenator nope i didn't find it at first time. Thanks for the link :) |
Just for rerefence for people looking at this issue, |
I just use hooks for now https://github.com/tsloughter/rebar3_run/tree/rust |
@tsloughter Neat. Unfortunately this looks like it's working only on linux. It should be slightly more complicated to get it to work on linux, macos and windows. See https://github.com/goertzenator/cargo-erlangapp/blob/master/src/lib.rs#L166 and https://github.com/goertzenator/cargo-erlangapp/blob/master/src/lib.rs#L19. |
Ah yea, it takes architecture patterns to match on in the hooks it can use for that. Not sure if that'd be enough to do whatever is needed though. So yea, nm, hopefully one of the plugins fills in the gaps :). |
And it needs to parse JSON provided by cargo to discover all the binary artifacts. An Erlang port of cargo-erlangapp would put us a stone's throw from having a portable Rust plugin for rebar3. |
@goertzenator I'm just starting erlang but I would work toward shipping a rust NIF in production eventually. Could you elaborate on your though on the best process we should build? You wish someone would rewrite cargo-erlangapp in erlang, or just write an erlang wrapper around it? |
Thinking about this a little more, a good way forward is to fork https://github.com/sdwolf/rebar3_rust and then port in the capabilities of The main problem with |
It would be nice if rustler_mix and the rebar3 plugin could share the same logic for compilation. If something gets implemented in erlang, I would be very interested in making rustler_mix use that. |
I've got a good start on a rebar3 plugin. It does compile crates on linux, but definitely needs a little more work. @hansihe : Is rustler_mix a generic crate builder or is it coupled to the rest of Rustler in some way? |
@goertzenator There is a boilerplate generator for Rustler in there, but the crate builder itself should be fully generic. |
Ok, good. I'll make a point of getting this plugin tidy and well documented so that it's logic can be ported more easily to rustler_mix. I'll give you heads up when I think it is ready for that. |
@goertzenator Great work. I had started something but what you have seems better I think. I'll check it out more and try to help. |
any updates ? |
I've started work on updating goertzenator's project here: https://github.com/filmor/rebar3_rust/tree/update. It works slightly differently now than before, but I'm so far very content with the new behaviour. It's used in https://github.com/filmor/faster_xml and https://github.com/filmor/arrow-erlang. The plugin is still agnostic to whether you use rustler or rustler_sys (or erlang_nif-sys) and does away with the need of something like |
awesome. thanks! |
Just thinking about naming...does it make more sense to call it |
It could make more sense, yes. I think that the current name is a bit more googleable and it's more obvious for non-Rust BEAM users what it's about. |
Seems that non-Rust BEAM users wouldn't be using it directly right? It would be NIF devs that would configure their lib to use the rebar3 plugin? |
I just upgraded my simple app to use rustler 0.22 rc.0 and loving it. code is now just: mod atoms {
rustler::atoms! { ok }
}
#[rustler::nif]
fn console(path: String) -> NifResult<Atom> {
// Run release with console
let _ = Command::new(path).arg("console").exec();
Ok(atoms::ok())
}
rustler::init!("rebar3_run", [console]); But I'm still using the rebar3 hooks and want to get a good plugin done before using this for any real projects. @filmor are you still maintaining? And is @goertzenator still around so updates can be upstreamed? And then what about having the plugin as part of the @rusterlium org? :) After all that I can worry about poking @lpil about it generating typed functions for NIFs used from @gleam-lang :) |
I'm still working on it, I forked goertzenator's work as |
That would be so cool! |
I don't see myself doing any more work on https://github.com/goertzenator/rebar3_rust . I will happily hand the repo over to someone else if they want it. |
Yes, that would be excellent 👍 |
I've transferred erlang-cargo and rebar3_cargo into the rusterlium org. |
|
Sweet! |
Do you know about any rebar3 plugin to compile nifs built with rustler?
The text was updated successfully, but these errors were encountered: