瀏覽代碼

use correct rebar_state for a dep, not the top level state

pull/718/head
Tristan Sloughter 9 年之前
父節點
當前提交
ad463398dc
共有 3 個檔案被更改,包括 9 行新增17 行删除
  1. +4
    -3
      src/rebar_app_discover.erl
  2. +4
    -4
      src/rebar_prv_common_test.erl
  3. +1
    -10
      src/rebar_prv_install_deps.erl

+ 4
- 3
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).

+ 4
- 4
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),

+ 1
- 10
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),

Loading…
取消
儲存