summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2015-08-29 17:07:18 -0500
committerTristan Sloughter <t@crashfast.com>2015-08-31 21:40:51 -0500
commitf209ccc2b8ea79279532f1fe1debe24aa0e6a488 (patch)
tree7779674a7e082a16d1721bd0e3e7c401cc664a73
parent98752aab9390137d7cba0b70e0c1c08b9ca308d4 (diff)
remove state record from app_info record
-rw-r--r--src/rebar_app_discover.erl3
-rw-r--r--src/rebar_app_info.erl31
-rw-r--r--src/rebar_app_utils.erl1
-rw-r--r--src/rebar_plugins.erl3
-rw-r--r--src/rebar_prv_clean.erl6
-rw-r--r--src/rebar_prv_compile.erl4
-rw-r--r--src/rebar_prv_install_deps.erl6
-rw-r--r--test/rebar_profiles_SUITE.erl3
8 files changed, 12 insertions, 45 deletions
diff --git a/src/rebar_app_discover.erl b/src/rebar_app_discover.erl
index bc66c1f..e32a9f5 100644
--- a/src/rebar_app_discover.erl
+++ b/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)
diff --git a/src/rebar_app_info.erl b/src/rebar_app_info.erl
index ef8f69d..21fbbea 100644
--- a/src/rebar_app_info.erl
+++ b/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}.
diff --git a/src/rebar_app_utils.erl b/src/rebar_app_utils.erl
index 07c262a..3c27420 100644
--- a/src/rebar_app_utils.erl
+++ b/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).
diff --git a/src/rebar_plugins.erl b/src/rebar_plugins.erl
index 752514c..80f62f5 100644
--- a/src/rebar_plugins.erl
+++ b/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).
diff --git a/src/rebar_prv_clean.erl b/src/rebar_prv_clean.erl
index 1d1d4c7..fa8bcf3 100644
--- a/src/rebar_prv_clean.erl
+++ b/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) ->
diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl
index 072255d..1675a41 100644
--- a/src/rebar_prv_compile.erl
+++ b/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) ->
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl
index 06033f6..58557bf 100644
--- a/src/rebar_prv_install_deps.erl
+++ b/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};
diff --git a/test/rebar_profiles_SUITE.erl b/test/rebar_profiles_SUITE.erl
index 41bb535..d4c10c5 100644
--- a/test/rebar_profiles_SUITE.erl
+++ b/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).