aboutsummaryrefslogtreecommitdiffstats
path: root/src/rlx_prv_discover.erl
diff options
context:
space:
mode:
authorJordan Wilberding <[email protected]>2014-10-11 11:52:43 -0500
committerJordan Wilberding <[email protected]>2014-10-11 11:52:43 -0500
commita9c3c235ac81d1a17cf2feb8fbfbd70d6a57edff (patch)
treea17913740b0ad66ceb0139ded8df30514380ece6 /src/rlx_prv_discover.erl
parentd4d197ca142913b81fc192357dff18d1ed266921 (diff)
parentfca419632793346d0f3732ed927f6862ed6bf85a (diff)
downloadrelx-a9c3c235ac81d1a17cf2feb8fbfbd70d6a57edff.tar.gz
relx-a9c3c235ac81d1a17cf2feb8fbfbd70d6a57edff.tar.bz2
relx-a9c3c235ac81d1a17cf2feb8fbfbd70d6a57edff.zip
Merge pull request #227 from tsloughter/master
Rebar3 support and code sharing
Diffstat (limited to 'src/rlx_prv_discover.erl')
-rw-r--r--src/rlx_prv_discover.erl21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/rlx_prv_discover.erl b/src/rlx_prv_discover.erl
index 21e5687..520cf15 100644
--- a/src/rlx_prv_discover.erl
+++ b/src/rlx_prv_discover.erl
@@ -21,9 +21,9 @@
%%% @doc This provider uses the lib_dir setting of the state. It searches the
%%% Lib Dirs looking for all OTP Applications that are available. When it finds
%%% those OTP Applications it loads the information about them and adds them to
-%%% the state of available apps. This implements the rlx_provider behaviour.
+%%% the state of available apps. This implements the provider behaviour.
-module(rlx_prv_discover).
--behaviour(rlx_provider).
+-behaviour(provider).
-export([init/1,
do/1,
@@ -31,12 +31,24 @@
-include("relx.hrl").
+-define(PROVIDER, discover).
+-define(DEPS, []).
+
%%============================================================================
%% API
%%============================================================================
+
-spec init(rlx_state:t()) -> {ok, rlx_state:t()}.
init(State) ->
- {ok, State}.
+ State1 = rlx_state:add_provider(State, providers:create([{name, ?PROVIDER},
+ {module, ?MODULE},
+ {bare, false},
+ {deps, ?DEPS},
+ {example, "build"},
+ {short_desc, ""},
+ {desc, ""},
+ {opts, []}])),
+ {ok, State1}.
%% @doc recursively dig down into the library directories specified in the state
%% looking for OTP Applications
@@ -97,6 +109,7 @@ add_common_project_dirs(State) ->
Apps = filename:join(Root, "apps"),
Lib = filename:join(Root, "lib"),
Deps = filename:join(Root, "deps"),
+ Rebar3Deps = filename:join(Root, "_deps"),
Ebin = filename:join(Root, "ebin"),
lists:foldl(fun(Dir, LibDirs) ->
case ec_file:exists(Dir) of
@@ -105,7 +118,7 @@ add_common_project_dirs(State) ->
false ->
LibDirs
end
- end, [], [Deps, Lib, Apps, Ebin])
+ end, [], [Rebar3Deps, Deps, Lib, Apps, Ebin])
end.
-spec add_system_lib_dir(rlx_state:t()) -> [file:name()].