Created
March 10, 2017 16:40
-
-
Save goertzenator/5ac2ac0593ae1698e327afbb85a405d8 to your computer and use it in GitHub Desktop.
namespaced provider with options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(rebar3_rust_compile_prv). | |
-export([init/1, do/1, format_error/1]). | |
-include_lib("kernel/include/file.hrl"). | |
-define(PROVIDER, build). | |
-define(NAMESPACE, rust). | |
-define(DEPS, [{default,app_discovery}]). | |
%% =================================================================== | |
%% Public API | |
%% =================================================================== | |
-spec init(rebar_state:t()) -> {ok, rebar_state:t()}. | |
init(State) -> | |
Provider = providers:create([ | |
{name, ?PROVIDER}, % The 'user friendly' name of the task | |
{namespace, ?NAMESPACE}, | |
{module, ?MODULE}, % The module implementation of the task | |
{bare, true}, % The task can be run by the user, always true | |
{deps, ?DEPS}, % The list of dependencies | |
{example, "rebar3 rust build"}, % How to use the plugin | |
%% list of options understood by the plugin | |
{opts, [ | |
{extern_crates, undefined, "extern_crates", | |
string, "Crates from crates.io to build for this app"} | |
]}, | |
{short_desc, "Compile Rust crates"}, | |
{desc, "Compile Rust crates"} | |
]), | |
{ok, rebar_state:add_provider(State, Provider)}. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment