Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rusterlium/rebar3_cargo
Rebar3 plugin to build Rust crates
https://github.com/rusterlium/rebar3_cargo
cargo erlang rebar3 rust
Last synced: 4 months ago
JSON representation
Rebar3 plugin to build Rust crates
- Host: GitHub
- URL: https://github.com/rusterlium/rebar3_cargo
- Owner: rusterlium
- License: apache-2.0
- Created: 2019-06-08T01:36:21.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-08T12:02:08.000Z (about 2 years ago)
- Last Synced: 2024-10-01T15:07:59.836Z (4 months ago)
- Topics: cargo, erlang, rebar3, rust
- Language: Erlang
- Homepage:
- Size: 5.04 MB
- Stars: 20
- Watchers: 6
- Forks: 14
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# `rebar3_cargo`
![CI](https://github.com/rusterlium/rebar3_cargo/workflows/CI/badge.svg)This plugin for [`rebar3`](https://www.rebar3.org/) enables the automatic
building of Rust crates in an Erlang application. The plugin will build all
crates in the `crates` directory and copy all binary outputs to
`priv/crates//`. See the test application in this repository
for an example of a port program and NIF module implemented in Rust.## Todo list
As of this writing `rebar3_cargo` will build crates on
linux and passes tests, however it is still under construction.Todo:
- allow cargo/rust compile flags
- `--target` flag handling
- Appveyor CI
- maybe external crate support using cargo clone# Using the plugin
Use the plugin by adding the following to `rebar.config`:``` erlang
{plugins, [rebar3_cargo]}.{provider_hooks, [
{pre, [
{compile, {cargo, build}}
]},
{post, [
{clean, {cargo, clean}},
{eunit, {cargo, test}}
]}
]}.
```This will automatically download and use `rebar3_cargo`. Crates will be
compiled whenever the containing app is compiled. The cargo `--release` switch
will be used when the `prod` profile is active. For example:``` sh
rebar3 as prod compile
```# Application structure with Rust crates
To add crates to an Erlang application, place them in a `crates/` folder, and
reference them in a Cargo Workspace. All crates found within will be built and
resulting artifacts will be placed in the `priv/crates/` folder.# Acknowledgment
This plugin is based on earlier work by
[goertzenator](https://github.com/goertzenator):
[rebar3_rust](https://github.com/goertzenator/rebar3_rust)