summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2015-08-16 20:48:59 -0500
committerTristan Sloughter <t@crashfast.com>2015-08-16 21:13:47 -0500
commitad463398dcc4b0d652218d20f79cc010d2767b37 (patch)
tree72317f77b053ea26dc86286a2871ea0ba90a3487 /src
parent073dbb71ec98cec6c0aeced82cc3797ffa38e68e (diff)
use correct rebar_state for a dep, not the top level state
Diffstat (limited to 'src')
-rw-r--r--src/rebar_app_discover.erl7
-rw-r--r--src/rebar_prv_common_test.erl8
-rw-r--r--src/rebar_prv_install_deps.erl11
3 files changed, 9 insertions, 17 deletions
diff --git a/src/rebar_app_discover.erl b/src/rebar_app_discover.erl
index ae0fd73..6eeadf0 100644
--- a/src/rebar_app_discover.erl
+++ b/src/rebar_app_discover.erl
@@ -37,6 +37,7 @@ do(State, LibDirs) ->
ParsedDeps = parse_profile_deps(Profile
,TopLevelApp
,ProfileDeps2
+ ,StateAcc
,StateAcc),
rebar_state:set(StateAcc, {parsed_deps, Profile}, ParsedDeps)
end, State, lists:reverse(CurrentProfiles)),
@@ -103,16 +104,16 @@ handle_profile(Profile, Name, AppState, State) ->
%% Only deps not also specified in the top level config need
%% to be included in the parsed deps
NewDeps = ProfileDeps2 -- TopLevelProfileDeps,
- {ParsedSrc, ParsedPkg} = parse_profile_deps(Profile, Name, NewDeps, State1),
+ {ParsedSrc, ParsedPkg} = parse_profile_deps(Profile, Name, NewDeps, AppState, State1),
rebar_state:set(State1, {parsed_deps, Profile}, {TopSrc++ParsedSrc, TopPkg++ParsedPkg}).
-parse_profile_deps(Profile, Name, Deps, State) ->
+parse_profile_deps(Profile, Name, Deps, AppState, State) ->
DepsDir = rebar_prv_install_deps:profile_dep_dir(State, Profile),
Locks = rebar_state:get(State, {locks, Profile}, []),
rebar_prv_install_deps:parse_deps(Name
,DepsDir
,Deps
- ,State
+ ,AppState
,Locks
,1).
diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl
index 2b024cf..1165631 100644
--- a/src/rebar_prv_common_test.erl
+++ b/src/rebar_prv_common_test.erl
@@ -361,10 +361,10 @@ remove_links(Path) ->
end.
delete_dir_link(Path) ->
- case os:type() of
- {unix, _} -> file:delete(Path);
- {win32, _} -> file:del_dir(Path)
- end.
+ case os:type() of
+ {unix, _} -> file:delete(Path);
+ {win32, _} -> file:del_dir(Path)
+ end.
dir_entries(Path) ->
{ok, SubDirs} = file:list_dir(Path),
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl
index ad469c3..e790dc9 100644
--- a/src/rebar_prv_install_deps.erl
+++ b/src/rebar_prv_install_deps.erl
@@ -379,20 +379,11 @@ handle_dep(AppInfo, Profile, SrcDeps, PkgDeps, SrcApps, Level, State, Locks) ->
-spec handle_dep(rebar_state:t(), atom(), file:filename_all(), rebar_app_info:t(), list(), integer()) ->
{rebar_app_info:t(), [rebar_app_info:t()], [pkg_dep()], [integer()], rebar_state:t()}.
handle_dep(State, Profile, DepsDir, AppInfo, Locks, Level) ->
- Parent = rebar_app_info:parent(AppInfo),
Profiles = rebar_state:current_profiles(State),
Name = rebar_app_info:name(AppInfo),
%% Deps may be under a sub project app, find it and use its state if so
- S = case ec_lists:find(fun(X) ->
- Parent =:= rebar_app_info:name(X)
- end, rebar_state:project_apps(State)) of
- {ok, ParentApp} ->
- rebar_app_info:state(ParentApp);
- error ->
- rebar_app_info:state(AppInfo)
- end,
-
+ S = rebar_app_info:state(AppInfo),
C = rebar_config:consult(rebar_app_info:dir(AppInfo)),
S1 = rebar_state:new(S, C, rebar_app_info:dir(AppInfo)),
S2 = rebar_state:apply_overrides(S1, Name),