浏览代码

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 ParsedDeps = parse_profile_deps(Profile
,TopLevelApp ,TopLevelApp
,ProfileDeps2 ,ProfileDeps2
,StateAcc
,StateAcc), ,StateAcc),
rebar_state:set(StateAcc, {parsed_deps, Profile}, ParsedDeps) rebar_state:set(StateAcc, {parsed_deps, Profile}, ParsedDeps)
end, State, lists:reverse(CurrentProfiles)), 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 %% Only deps not also specified in the top level config need
%% to be included in the parsed deps %% to be included in the parsed deps
NewDeps = ProfileDeps2 -- TopLevelProfileDeps, 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}). 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), DepsDir = rebar_prv_install_deps:profile_dep_dir(State, Profile),
Locks = rebar_state:get(State, {locks, Profile}, []), Locks = rebar_state:get(State, {locks, Profile}, []),
rebar_prv_install_deps:parse_deps(Name rebar_prv_install_deps:parse_deps(Name
,DepsDir ,DepsDir
,Deps ,Deps
,State
,AppState
,Locks ,Locks
,1). ,1).

+ 4
- 4
src/rebar_prv_common_test.erl 查看文件

@ -361,10 +361,10 @@ remove_links(Path) ->
end. end.
delete_dir_link(Path) -> 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) -> dir_entries(Path) ->
{ok, SubDirs} = file:list_dir(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()) -> -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()}. {rebar_app_info:t(), [rebar_app_info:t()], [pkg_dep()], [integer()], rebar_state:t()}.
handle_dep(State, Profile, DepsDir, AppInfo, Locks, Level) -> handle_dep(State, Profile, DepsDir, AppInfo, Locks, Level) ->
Parent = rebar_app_info:parent(AppInfo),
Profiles = rebar_state:current_profiles(State), Profiles = rebar_state:current_profiles(State),
Name = rebar_app_info:name(AppInfo), Name = rebar_app_info:name(AppInfo),
%% Deps may be under a sub project app, find it and use its state if so %% 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)), C = rebar_config:consult(rebar_app_info:dir(AppInfo)),
S1 = rebar_state:new(S, C, rebar_app_info:dir(AppInfo)), S1 = rebar_state:new(S, C, rebar_app_info:dir(AppInfo)),
S2 = rebar_state:apply_overrides(S1, Name), S2 = rebar_state:apply_overrides(S1, Name),

正在加载...
取消
保存