GithubHelp home page GithubHelp logo

nwolverson / rebar3_cargo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rusterlium/rebar3_cargo

0.0 2.0 0.0 52 KB

Rebar3 plugin to build Rust crates

License: Apache License 2.0

Erlang 81.71% Rust 18.29%

rebar3_cargo's Introduction

rebar3_cargo

Build Status

This plugin for rebar3 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/<cratename>/<binary>. 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:

{plugins, [
    { rebar3_cargo, ".*", {git, "https://github.com/goertzenator/rebar3_cargo", {branch, "master"}}}
]}.

{provider_hooks, [
    {post, [
        {compile, {rust, build}},
        {clean, {rust, clean}},
        {eunit, {rust, 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:

rebar3 as prod compile

Application structure with Rust crates

To add crates to an Erlang application, place them in a crates/ folder. All crates found within will be built and resulting artifacts will be placed in the priv/crates/ folder.

The library application find_crate may be used to reliably find artifacts in priv/crates in a cross-platform manner.

Project structure:

myapp/
    rebar.config
    ebin/
        ...
    src/
         ...
    crates/
        foo_nif/
            Cargo.toml
            ...
        bar_port/
            Cargo.toml
             ...
    priv/
        crates/
            foo_nif/
                libfoo_nif.so
            bar_port/
                bar_port

rebar3_cargo's People

Contributors

filmor avatar goertzenator avatar azdlowry avatar fbernier avatar yjh0502 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.