summaryrefslogtreecommitdiff
path: root/src/rebar_utils.erl
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2015-02-19 09:21:15 -0500
committerFred Hebert <mononcqc@ferd.ca>2015-02-19 09:21:15 -0500
commitc3cdecf1252fe51caa7b9aeb0e1f77bd735c0131 (patch)
treeadfcdacac38b87d7612a5757d0efd8d443d285cd /src/rebar_utils.erl
parentf203bc3c4fa1727315b96ff0ec4501e35a64e30b (diff)
parent8874e414a80f7f29e3a8c8f00b3887399a7a6cbc (diff)
Merge pull request #160 from tsloughter/sub_deps
use project sub-apps with deps in their rebar.config
Diffstat (limited to 'src/rebar_utils.erl')
-rw-r--r--src/rebar_utils.erl12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index 85f59d6..943c0d7 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -26,7 +26,8 @@
%% -------------------------------------------------------------------
-module(rebar_utils).
--export([droplast/1,
+-export([sort_deps/1,
+ droplast/1,
filtermap/2,
is_arch/1,
sh/2,
@@ -56,11 +57,20 @@
-include("rebar.hrl").
-define(ONE_LEVEL_INDENT, " ").
+-define(APP_NAME_INDEX, 2).
%% ====================================================================
%% Public API
%% ====================================================================
+sort_deps(Deps) ->
+ %% We need a sort stable, based on the name. So that for multiple deps on
+ %% the same level with the same name, we keep the order the parents had.
+ %% `lists:keysort/2' is documented as stable in the stdlib.
+ %% The list of deps is revered when we get it. For the proper stable
+ %% result, re-reverse it.
+ lists:keysort(?APP_NAME_INDEX, lists:reverse(Deps)).
+
droplast(L) ->
lists:reverse(tl(lists:reverse(L))).