浏览代码

remove state record from app_info record

pull/760/head
Tristan Sloughter 9 年前
父节点
当前提交
f209ccc2b8
共有 8 个文件被更改,包括 12 次插入45 次删除
  1. +1
    -2
      src/rebar_app_discover.erl
  2. +0
    -31
      src/rebar_app_info.erl
  3. +0
    -1
      src/rebar_app_utils.erl
  4. +2
    -1
      src/rebar_plugins.erl
  5. +3
    -3
      src/rebar_prv_clean.erl
  6. +2
    -2
      src/rebar_prv_compile.erl
  7. +3
    -3
      src/rebar_prv_install_deps.erl
  8. +1
    -2
      test/rebar_profiles_SUITE.erl

+ 1
- 2
src/rebar_app_discover.erl 查看文件

@ -88,8 +88,7 @@ merge_deps(AppInfo, State) ->
rebar_utils:check_blacklisted_otp_versions(rebar_state:get(AppState1, blacklisted_otp_vsns, [])),
AppState2 = rebar_state:set(AppState1, artifacts, []),
AppInfo1 = rebar_app_info:state(AppInfo, AppState2),
AppInfo2 = rebar_app_info:opts(AppInfo1, rebar_state:opts(AppState2)),
AppInfo2 = rebar_app_info:opts(AppInfo, rebar_state:opts(AppState2)),
State1 = lists:foldl(fun(Profile, StateAcc) ->
handle_profile(Profile, Name, AppState1, StateAcc)

+ 0
- 31
src/rebar_app_info.erl 查看文件

@ -9,8 +9,6 @@
discover/1,
name/1,
name/2,
config/1,
config/2,
app_file_src/1,
app_file_src/2,
app_file_src_script/1,
@ -47,9 +45,6 @@
resource_type/2,
source/1,
source/2,
state/1,
state/2,
state_or_new/2,
is_lock/1,
is_lock/2,
is_checkout/1,
@ -76,7 +71,6 @@
app_file_src :: file:filename_all() | undefined,
app_file_src_script:: file:filename_all() | undefined,
app_file :: file:filename_all() | undefined,
config :: rebar_state:t() | undefined,
original_vsn :: binary() | string() | undefined,
parent=root :: binary() | root,
app_details=[] :: list(),
@ -90,7 +84,6 @@
out_dir :: file:name(),
resource_type :: pkg | src,
source :: string() | tuple() | undefined,
state :: rebar_state:t() | undefined,
is_lock=false :: boolean(),
is_checkout=false :: boolean(),
valid :: boolean()}).
@ -194,14 +187,6 @@ name(#app_info_t{name=Name}) ->
name(AppInfo=#app_info_t{}, AppName) ->
AppInfo#app_info_t{name=ec_cnv:to_binary(AppName)}.
-spec config(t()) -> rebar_state:t().
config(#app_info_t{config=Config}) ->
Config.
-spec config(t(), rebar_state:t()) -> t().
config(AppInfo=#app_info_t{}, Config) ->
AppInfo#app_info_t{config=Config}.
opts(#app_info_t{opts=Opts}) ->
Opts.
@ -384,22 +369,6 @@ source(AppInfo=#app_info_t{}, Source) ->
source(#app_info_t{source=Source}) ->
Source.
-spec state(t(), rebar_state:t() | undefined) -> t().
state(AppInfo=#app_info_t{}, State) ->
AppInfo#app_info_t{state=State}.
-spec state(t()) -> rebar_state:t() | undefined.
state(#app_info_t{state=State}) ->
State.
-spec state_or_new(rebar_state:t(), t()) -> rebar_state:t().
state_or_new(State, AppInfo=#app_info_t{state=undefined}) ->
AppDir = dir(AppInfo),
C = rebar_config:consult(AppDir),
rebar_state:new(State, C, AppInfo);
state_or_new(_State, #app_info_t{state=State}) ->
State.
-spec is_lock(t(), boolean()) -> t().
is_lock(AppInfo=#app_info_t{}, IsLock) ->
AppInfo#app_info_t{is_lock=IsLock}.

+ 0
- 1
src/rebar_app_utils.erl 查看文件

@ -176,7 +176,6 @@ dep_to_app(Parent, DepsDir, Name, Vsn, Source, IsLock, State) ->
Overrides = rebar_state:get(State, overrides, []),
ParentOverrides = rebar_state:overrides(State),
S1 = rebar_state:set(rebar_state:overrides(State, ParentOverrides++Overrides), base_dir, BaseDir),
%AppInfo2 = rebar_app_info:state(AppInfo1, S1),
AppInfo3 = rebar_app_info:opts(AppInfo1, rebar_state:opts(S1)),
rebar_app_info:is_lock(rebar_app_info:source(AppInfo3, Source), IsLock).

+ 2
- 1
src/rebar_plugins.erl 查看文件

@ -92,7 +92,8 @@ handle_plugin(Profile, Plugin, State, Upgrade) ->
build_plugin(AppInfo, Apps, State) ->
Providers = rebar_state:providers(State),
%Providers1 = rebar_state:providers(rebar_app_info:state(AppInfo)),
S = rebar_state:all_deps(rebar_app_info:state_or_new(State, AppInfo), Apps),
%rebar_app_info:state_or_new(State, AppInfo)
S = rebar_state:all_deps(State, Apps),
S1 = rebar_state:set(S, deps_dir, ?DEFAULT_PLUGINS_DIR),
rebar_prv_compile:compile(S1, Providers, AppInfo).

+ 3
- 3
src/rebar_prv_clean.erl 查看文件

@ -67,12 +67,12 @@ format_error(Reason) ->
clean_apps(State, Providers, Apps) ->
lists:foreach(fun(AppInfo) ->
AppDir = rebar_app_info:dir(AppInfo),
S = rebar_app_info:state_or_new(State, AppInfo),
%S = rebar_app_info:state_or_new(State, AppInfo),
?INFO("Cleaning out ~s...", [rebar_app_info:name(AppInfo)]),
rebar_hooks:run_all_hooks(AppDir, pre, ?PROVIDER, Providers, AppInfo, S),
rebar_hooks:run_all_hooks(AppDir, pre, ?PROVIDER, Providers, AppInfo, State),
rebar_erlc_compiler:clean(State, rebar_app_info:out_dir(AppInfo)),
rebar_hooks:run_all_hooks(AppDir, post, ?PROVIDER, Providers, AppInfo, S)
rebar_hooks:run_all_hooks(AppDir, post, ?PROVIDER, Providers, AppInfo, State)
end, Apps).
handle_args(State) ->

+ 2
- 2
src/rebar_prv_compile.erl 查看文件

@ -82,8 +82,8 @@ build_app(State, Providers, AppInfo) ->
OutDir = rebar_app_info:out_dir(AppInfo),
copy_app_dirs(AppInfo, AppDir, OutDir),
S = rebar_app_info:state_or_new(State, AppInfo),
S1 = rebar_state:all_deps(S, rebar_state:all_deps(State)),
%S = rebar_app_info:state_or_new(State, AppInfo),
S1 = rebar_state:all_deps(State, rebar_state:all_deps(State)),
compile(S1, Providers, AppInfo).
compile(State, Providers, AppInfo) ->

+ 3
- 3
src/rebar_prv_install_deps.erl 查看文件

@ -294,9 +294,9 @@ maybe_fetch(AppInfo, Profile, Upgrade, Seen, State) ->
{true, rebar_app_info:valid(update_app_info(AppDir, AppInfo), false)};
{true, AppInfo1} ->
%% Preserve the state we created with overrides
AppInfo2 = copy_app_info(AppInfo, AppInfo1),
AppState = rebar_app_info:state(AppInfo),
AppInfo3 = rebar_app_info:state(AppInfo2, AppState),
AppInfo3 = copy_app_info(AppInfo, AppInfo1),
%% AppState = rebar_app_info:state(AppInfo),
%% AppInfo3 = rebar_app_info:state(AppInfo2, AppState),
case sets:is_element(rebar_app_info:name(AppInfo3), Seen) of
true ->
{false, AppInfo3};

+ 1
- 2
test/rebar_profiles_SUITE.erl 查看文件

@ -428,8 +428,7 @@ test_profile_applied_to_apps(Config) ->
Apps = rebar_state:project_apps(State),
lists:foreach(fun(App) ->
AppState = rebar_app_info:state(App),
Opts = rebar_state:opts(AppState),
Opts = rebar_app_info:opts(App),
ErlOpts = dict:fetch(erl_opts, Opts),
true = lists:member({d, 'TEST'}, ErlOpts)
end, Apps).

正在加载...
取消
保存