Skip to content

Commit

Permalink
add bare compile provider, for starters for use by mix
Browse files Browse the repository at this point in the history
  • Loading branch information
tsloughter committed Sep 9, 2015
1 parent 6eb28a9 commit 338868a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/rebar.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

{providers, [rebar_prv_app_discovery,
rebar_prv_as,
rebar_prv_bare_compile,
rebar_prv_clean,
rebar_prv_common_test,
rebar_prv_compile,
Expand Down
42 changes: 42 additions & 0 deletions src/rebar_prv_bare_compile.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
-module(rebar_prv_bare_compile).

-behaviour(provider).

-export([init/1,
do/1,
format_error/1]).

-include_lib("providers/include/providers.hrl").
-include("rebar.hrl").

-define(PROVIDER, compile).
-define(NAMESPACE, bare).
-define(DEPS, [{default, app_discovery}]).

%% ===================================================================
%% Public API
%% ===================================================================

-spec init(rebar_state:t()) -> {ok, rebar_state:t()}.
init(State) ->
State1 = rebar_state:add_provider(State, providers:create([{name, ?PROVIDER},
{module, ?MODULE},
{namespace, ?NAMESPACE},
{bare, false},
{deps, ?DEPS},
{example, ""},
{short_desc, ""},
{desc, ""},
{opts, []}])),
{ok, State1}.

-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
[AppInfo] = rebar_state:project_apps(State),
AppInfo1 = rebar_app_info:out_dir(AppInfo, rebar_dir:get_cwd()),
rebar_prv_compile:compile(State, AppInfo1),
{ok, State}.

-spec format_error(any()) -> iolist().
format_error(Reason) ->
io_lib:format("~p", [Reason]).

0 comments on commit 338868a

Please sign in to comment.