summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2015-09-08 19:27:36 -0500
committerTristan Sloughter <t@crashfast.com>2015-09-14 20:00:11 -0500
commit4c29a771c1a5c8d81bf727b98d40ecd9f486f66f (patch)
treeae1824c25acb655c48d31df87b726036d1d4ba8e /src
parent49670721e1b91ae5d0a54002ea19af99c5b939b7 (diff)
add bare compile provider, for starters for use by mix
Diffstat (limited to 'src')
-rw-r--r--src/rebar.app.src1
-rw-r--r--src/rebar_prv_bare_compile.erl42
-rw-r--r--src/rebar_prv_compile.erl6
3 files changed, 48 insertions, 1 deletions
diff --git a/src/rebar.app.src b/src/rebar.app.src
index 4d1dfd7..69df1b2 100644
--- a/src/rebar.app.src
+++ b/src/rebar.app.src
@@ -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,
diff --git a/src/rebar_prv_bare_compile.erl b/src/rebar_prv_bare_compile.erl
new file mode 100644
index 0000000..911c5c5
--- /dev/null
+++ b/src/rebar_prv_bare_compile.erl
@@ -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]).
diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl
index 89ea430..9811de9 100644
--- a/src/rebar_prv_compile.erl
+++ b/src/rebar_prv_compile.erl
@@ -6,7 +6,8 @@
do/1,
format_error/1]).
--export([compile/3]).
+-export([compile/2,
+ compile/3]).
-include_lib("providers/include/providers.hrl").
-include("rebar.hrl").
@@ -81,6 +82,9 @@ build_app(State, Providers, AppInfo) ->
copy_app_dirs(AppInfo, AppDir, OutDir),
compile(State, Providers, AppInfo).
+compile(State, AppInfo) ->
+ compile(State, rebar_state:providers(State), AppInfo).
+
compile(State, Providers, AppInfo) ->
?INFO("Compiling ~s", [rebar_app_info:name(AppInfo)]),
AppDir = rebar_app_info:dir(AppInfo),