Comments (29)
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 find_crate
. Documentation will follow as soon as it's ready for public consumption, and I'll probably upload it to Hex then.
from rustler.
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.
from rustler.
rebar3_cargo
is nearly done, the only functionality missing is handling of executables. As soon as that is done, I'll publish things to Hex.
from rustler.
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 :)
from rustler.
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.
from rustler.
Did you try this one?
from rustler.
@goertzenator nope i didn't find it at first time. Thanks for the link :)
from rustler.
Just for rerefence for people looking at this issue, rebar3-rust
works on linux, but is missing some logic to pass specific compile options on macos. cargo-erlangapp
works on both linux and osx.
from rustler.
I just use hooks for now https://github.com/tsloughter/rebar3_run/tree/rust
from rustler.
@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.
from rustler.
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 :).
from rustler.
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.
from rustler.
@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?
from rustler.
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 cargo-erlangapp
. I'll eventually get to this myself, but I'll happily help if somebody starts this before me.
The main problem with cargo-erlangapp
is that it takes a while (30-60 sec?) to compile on account of having to bring in JSON crates. Managing the installation would also be a hassle. There's nothing in cargo-erlangapp
that can't be easily done in Erlang.
from rustler.
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?
from rustler.
@goertzenator There is a boilerplate generator for Rustler in there, but the crate builder itself should be fully generic.
from rustler.
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.
from rustler.
@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.
from rustler.
any updates ?
from rustler.
awesome. thanks!
from rustler.
Just thinking about naming...does it make more sense to call it rebar3_cargo
?
from rustler.
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.
from rustler.
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?
from rustler.
I'm still working on it, I forked goertzenator's work as rebar3_cargo
depending on a new cargo
package for Erlang. I'm currently working on getting Rustler's Elixir tooling use that as well s.t. we have a common base. Moving it to rusterlium
when releasing to Hex is a good idea.
from rustler.
After all that I can worry about poking @lpil about it generating typed functions for NIFs used from @gleam-lang :)
That would be so cool!
from rustler.
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.
from rustler.
what about having the plugin as part of the @rusterlium org?
Yes, that would be excellent 👍
from rustler.
I've transferred erlang-cargo and rebar3_cargo into the rusterlium org.
from rustler.
Sweet!
from rustler.
Related Issues (20)
- NIF code trying to using MongoDB sync client hangs while trying to connect to DB HOT 2
- Check if Term is float HOT 5
- NifMap expansion error with rustler v0.27.0 HOT 2
- Update changelog for 0.27 HOT 1
- Store rustler template outside of priv/? HOT 2
- how to custom build target arch?
- can you support cargo-zigbuild? HOT 2
- `nif` macro fails with macro arguments HOT 2
- New Binary from Vec or Slice
- Support for enif_monitor_process HOT 1
- resource with lifetime
- Expose `enif_is_process_alive` HOT 4
- rustler errors on OTP26 HOT 1
- How to conveniently work with binaries as vectors of bytes?
- Why does Term::map_from_pairs return a NifResult?
- Support for fully custom `:load_from` for escripts HOT 8
- This OTP release uses the unsupported Erlang NIF version "2.17" HOT 1
- Test NifStruct derived traits
- Running `dialiyzer` with `rustler` 0.30.0 results in "The pattern can never match the type"" HOT 4
- Import structs from a library
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rustler.