summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2015-02-17 10:04:12 -0600
committerTristan Sloughter <t@crashfast.com>2015-02-17 18:26:28 -0600
commitbe49c5cd44d536c440b3188f3e0a5279218ea4fc (patch)
treea36373728eeef8daf0fe0a0c98d16df80e6fdcc3 /src
parentc5a655da140ed66818e5d22f1924dd60ab381d48 (diff)
use project sub-apps with deps in their rebar.config
Diffstat (limited to 'src')
-rw-r--r--src/rebar_app_discover.erl21
-rw-r--r--src/rebar_prv_install_deps.erl2
2 files changed, 20 insertions, 3 deletions
diff --git a/src/rebar_app_discover.erl b/src/rebar_app_discover.erl
index 21dbe1b..0dc062f 100644
--- a/src/rebar_app_discover.erl
+++ b/src/rebar_app_discover.erl
@@ -16,16 +16,33 @@ do(State, LibDirs) ->
Dirs = [filename:join(BaseDir, LibDir) || LibDir <- LibDirs],
Apps = find_apps(Dirs, all),
ProjectDeps = rebar_state:deps_names(State),
+
lists:foldl(fun(AppInfo, StateAcc) ->
+ StateAcc1 = merge_deps(AppInfo, StateAcc),
ProjectDeps1 = lists:delete(rebar_app_info:name(AppInfo), ProjectDeps),
- rebar_state:project_apps(StateAcc, rebar_app_info:deps(AppInfo, ProjectDeps1))
- end, State, Apps).
+ rebar_state:project_apps(StateAcc1
+ ,rebar_app_info:deps(AppInfo, ProjectDeps1))
+ end, State, Apps).
format_error({module_list, File}) ->
io_lib:format("Error reading module list from ~p~n", [File]);
format_error({missing_module, Module}) ->
io_lib:format("Module defined in app file missing: ~p~n", [Module]).
+merge_deps(AppInfo, State) ->
+ Profiles = rebar_state:current_profiles(State),
+ Name = rebar_app_info:name(AppInfo),
+ C = rebar_config:consult(rebar_app_info:dir(AppInfo)),
+ AppState = rebar_state:apply_overrides(
+ rebar_state:apply_profiles(
+ rebar_state:new(State, C, rebar_app_info:dir(AppInfo)), Profiles), Name),
+ lists:foldl(fun(Profile, StateAcc) ->
+ AppProfDeps = rebar_state:get(AppState, {deps, Profile}, []),
+ TopLevelProfDeps = rebar_state:get(StateAcc, {deps, Profile}, []),
+ ProfDeps2 = lists:keymerge(1, TopLevelProfDeps, AppProfDeps),
+ rebar_state:set(StateAcc, {deps, Profile}, ProfDeps2)
+ end, State, lists:reverse(Profiles)).
+
-spec all_app_dirs(list(file:name())) -> list(file:name()).
all_app_dirs(LibDirs) ->
lists:flatmap(fun(LibDir) ->
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl
index 61fbd70..d922522 100644
--- a/src/rebar_prv_install_deps.erl
+++ b/src/rebar_prv_install_deps.erl
@@ -267,7 +267,7 @@ update_src_deps(Profile, Level, SrcDeps, PkgDeps, SrcApps, State, Upgrade, Seen,
,StateAcc
,LocksAcc),
- {SrcDepsAcc1, PkgDepsAcc1, SrcAppsAcc1, StateAcc2, SeenAcc, LocksAcc1}
+ {SrcDepsAcc1, PkgDepsAcc1, SrcAppsAcc1, StateAcc2, SeenAcc, LocksAcc1}
end;
false ->
{SeenAcc1, StateAcc1} = maybe_lock(Profile, AppInfo, SeenAcc, StateAcc, Level),