Compile rust crates for erlang projects.
Add the plugin and hooks to your rebar.config
{
plugins,
[
{
rebar3_rust,
{
git,
"https://github.com/sdwolf/rebar3_rust.git",
{branch, "master"}
}
}
]
}.
{
provider_hooks,
[
{
post,
[
{compile, {rust, compile}},
]
}
]
}.
Add the following to your .gitignore
crates/*/target
priv/*
!priv/.keep
You can find an example usage here.
rebar3 plugins upgrade rebar3_rust
Go inside the downloaded dependency folder:
cd _build/default/plugins/rebar3_rust
Start your erlang docker container:
docker-here erlang bash
# Or use the full command if you do not have the docker-here alias:
docker run --rm -it -u `id -u`:`id -g` -v "$PWD":/work -w /work erlang bash
Compile from a dependent project:
rebar3 compile && rm -rf ebin/ && mv _build/default/lib/rebar3_rust/ebin/ .