summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rebar_digraph.erl10
-rw-r--r--test/rebar_deps_SUITE.erl4
2 files changed, 11 insertions, 3 deletions
diff --git a/src/rebar_digraph.erl b/src/rebar_digraph.erl
index bb031cb..dbcf649 100644
--- a/src/rebar_digraph.erl
+++ b/src/rebar_digraph.erl
@@ -18,7 +18,15 @@ compile_order(Apps) ->
end, Apps),
case digraph_utils:topsort(Graph) of
false ->
- {error, no_sort};
+ case digraph_utils:is_acyclic(Graph) of
+ true ->
+ {error, no_sort};
+ false ->
+ Cycles = lists:sort(
+ [lists:sort(Comp) || Comp <- digraph_utils:strong_components(Graph),
+ length(Comp)>1]),
+ {error, {cycles, Cycles}}
+ end;
V ->
{ok, names_to_apps(lists:reverse(V), Apps)}
end.
diff --git a/test/rebar_deps_SUITE.erl b/test/rebar_deps_SUITE.erl
index 6e5b874..a98f690 100644
--- a/test/rebar_deps_SUITE.erl
+++ b/test/rebar_deps_SUITE.erl
@@ -47,11 +47,11 @@ deps(pick_earliest) ->
deps(circular1) ->
{[{"B", [{"A", []}]}, % A is the top-level app
{"C", []}],
- {error, no_sort}}; % circular dep
+ {error, {cycles, [[<<"A">>,<<"B">>]]}}}; % circular dep
deps(circular2) ->
{[{"B", [{"C", [{"B", []}]}]},
{"C", []}],
- {error, no_sort}}. % circular dep
+ {error, {cycles, [[<<"B">>,<<"C">>]]}}}. % circular dep
end_per_testcase(_, Config) ->
mock_git_resource:unmock(),