summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rebar_app_discover.erl22
-rw-r--r--src/rebar_digraph.erl9
2 files changed, 16 insertions, 15 deletions
diff --git a/src/rebar_app_discover.erl b/src/rebar_app_discover.erl
index 6eeadf0..e81a323 100644
--- a/src/rebar_app_discover.erl
+++ b/src/rebar_app_discover.erl
@@ -20,15 +20,7 @@ do(State, LibDirs) ->
%% There may be a top level src which is an app and there may not
%% Find it here if there is, otherwise define the deps parent as root
- TopLevelApp = case ec_lists:find(fun(X) ->
- ec_file:real_dir_path(rebar_app_info:dir(X)) =:=
- ec_file:real_dir_path(rebar_dir:root_dir(State))
- end, Apps) of
- {ok, App} ->
- rebar_app_info:name(App);
- error ->
- root
- end,
+ TopLevelApp = define_root_app(Apps, State),
%% Handle top level deps
State1 = lists:foldl(fun(Profile, StateAcc) ->
@@ -61,6 +53,18 @@ do(State, LibDirs) ->
end
end, State1, SortedApps).
+define_root_app(Apps, State) ->
+ RootDir = rebar_dir:root_dir(State),
+ case ec_lists:find(fun(X) ->
+ ec_file:real_dir_path(rebar_app_info:dir(X)) =:=
+ ec_file:real_dir_path(RootDir)
+ end, Apps) of
+ {ok, App} ->
+ rebar_app_info:name(App);
+ error ->
+ root
+ end.
+
format_error({module_list, File}) ->
io_lib:format("Error reading module list from ~p~n", [File]);
format_error({missing_module, Module}) ->
diff --git a/src/rebar_digraph.erl b/src/rebar_digraph.erl
index f2bb540..472a543 100644
--- a/src/rebar_digraph.erl
+++ b/src/rebar_digraph.erl
@@ -108,12 +108,9 @@ cull_deps(Graph, [{Profile, Level, Vs} | Vertices], Levels, Solution, Seen, Disc
%% Combine lists of deps that have the same profile and level
combine_profile_levels(Vertices, NewVertices) ->
V = lists:foldl(fun({Profile, Level, Vs}, Acc) ->
- case ec_lists:find(fun({P, L, _}) when P =:= Profile
- , L =:= Level ->
- true;
- (_) ->
- false
- end, Acc) of
+ case ec_lists:find(fun({P, L, _}) ->
+ P =:= Profile andalso L =:= Level
+ end, Acc) of
{ok, {_, _, OldVs}=Old} ->
lists:delete(Old, Acc)++[{Profile, Level, lists:keysort(1, OldVs++Vs)}];
error ->