From f82874de5802dbf9e2029a9aa07c7cbae12a1324 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Wed, 15 Apr 2015 19:12:51 -0500 Subject: include applications list in compile sort --- src/rebar_app_discover.erl | 7 ++++++- src/rebar_app_utils.erl | 1 - src/rebar_digraph.erl | 6 +++++- src/rebar_prv_compile.erl | 5 +++-- 4 files changed, 14 insertions(+), 5 deletions(-) (limited to 'src') 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) -> -- cgit v1.1