summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2015-04-15 19:12:51 -0500
committerTristan Sloughter <t@crashfast.com>2015-04-15 19:12:51 -0500
commitf82874de5802dbf9e2029a9aa07c7cbae12a1324 (patch)
tree25498a6e246fb018733d15a05ff7eb6815987e87
parent38191c369a29c4cd8f6c5a30233014b7d7547813 (diff)
include applications list in compile sort
-rw-r--r--rebar.config2
-rw-r--r--src/rebar_app_discover.erl7
-rw-r--r--src/rebar_app_utils.erl1
-rw-r--r--src/rebar_digraph.erl6
-rw-r--r--src/rebar_prv_compile.erl5
5 files changed, 15 insertions, 6 deletions
diff --git a/rebar.config b/rebar.config
index 8d64b5d..36ce9a4 100644
--- a/rebar.config
+++ b/rebar.config
@@ -9,7 +9,7 @@
[getopt, merl, erlydtl, erlware_commons, relx, providers, rebar]}.
{escript_top_level_app, rebar}.
{escript_name, rebar3}.
-{escript_emu_args, "%%! +sbtu +A0 -noinput\n"}.
+{escript_emu_args, "%%! +sbtu +A0\n"}.
{erl_opts,
[{platform_define, "R14", no_callback_support},
diff --git a/src/rebar_app_discover.erl b/src/rebar_app_discover.erl
index fe930bd..16dcf24 100644
--- a/src/rebar_app_discover.erl
+++ b/src/rebar_app_discover.erl
@@ -164,7 +164,12 @@ create_app_info(AppDir, AppFile) ->
AppInfo1 = rebar_app_info:applications(
rebar_app_info:app_details(AppInfo, AppDetails),
IncludedApplications++Applications),
- Valid = rebar_app_utils:validate_application_info(AppInfo1),
+ Valid = case rebar_app_utils:validate_application_info(AppInfo1) of
+ true ->
+ true;
+ _ ->
+ false
+ end,
rebar_app_info:dir(rebar_app_info:valid(AppInfo1, Valid), AppDir);
_ ->
error
diff --git a/src/rebar_app_utils.erl b/src/rebar_app_utils.erl
index 143d73d..3da00be 100644
--- a/src/rebar_app_utils.erl
+++ b/src/rebar_app_utils.erl
@@ -77,7 +77,6 @@ validate_application_info(AppInfo, AppDetail) ->
?PRV_ERROR({module_list, AppFile});
List ->
has_all_beams(EbinDir, List)
-
end
end.
diff --git a/src/rebar_digraph.erl b/src/rebar_digraph.erl
index 7c1fe90..9e10d49 100644
--- a/src/rebar_digraph.erl
+++ b/src/rebar_digraph.erl
@@ -13,7 +13,7 @@ compile_order(Apps) ->
Graph = digraph:new(),
lists:foreach(fun(App) ->
Name = rebar_app_info:name(App),
- Deps = rebar_app_info:deps(App),
+ Deps = all_apps_deps(App),
add(Graph, {Name, Deps})
end, Apps),
case digraph_utils:topsort(Graph) of
@@ -123,3 +123,7 @@ find_app_by_name(Name, Apps) ->
ec_lists:find(fun(App) ->
rebar_app_info:name(App) =:= Name
end, Apps).
+
+all_apps_deps(App) ->
+ Applications = [atom_to_binary(X, utf8) || X <- rebar_app_info:applications(App)],
+ lists:usort(rebar_app_info:deps(App) ++ Applications).
diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl
index a440927..11a01ed 100644
--- a/src/rebar_prv_compile.erl
+++ b/src/rebar_prv_compile.erl
@@ -46,11 +46,12 @@ do(State) ->
%% Use the project State for building project apps
%% Set hooks to empty so top-level hooks aren't run for each project app
State2 = rebar_state:set(rebar_state:set(State, post_hooks, []), pre_hooks, []),
- ProjectApps1 = build_apps(State2, Providers, ProjectApps),
+ {ok, ProjectApps1} = rebar_digraph:compile_order(ProjectApps),
+ ProjectApps2 = build_apps(State2, Providers, ProjectApps1),
rebar_hooks:run_all_hooks(Cwd, post, ?PROVIDER, Providers, State),
- {ok, rebar_state:project_apps(State, ProjectApps1)}.
+ {ok, rebar_state:project_apps(State, ProjectApps2)}.
-spec format_error(any()) -> iolist().
format_error(Reason) ->