summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Sedov <asedov@platbox.com>2016-10-11 16:34:21 +0300
committerAlexander Sedov <asedov@platbox.com>2016-10-11 16:34:21 +0300
commite71b80752f905d9f4bb5dbf78c16693dbc6133f4 (patch)
tree3c3c322be6e42d8c7fda30142565f8f8b7b235f8
parent4ce21e4c800108030d5c646b226032f460e68065 (diff)
Some post-review changes:
- restore path after loading applications, - helpful comments.
-rw-r--r--src/rebar_prv_common_test.erl4
-rw-r--r--src/rebar_utils.erl2
2 files changed, 6 insertions, 0 deletions
diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl
index 8bfa192..46bd1a7 100644
--- a/src/rebar_prv_common_test.erl
+++ b/src/rebar_prv_common_test.erl
@@ -221,9 +221,13 @@ select_tests(State, ProjectApps, CmdOpts, CfgOpts) ->
Configs = lists:flatmap(fun(Filename) ->
rebar_file_utils:consult_config(State, Filename)
end, SysConfigs),
+ %% NB: load the applications (from user directories too) to support OTP < 17
+ %% to our best ability.
+ OldPath = code:get_path(),
code:add_pathsa(rebar_state:code_paths(State, all_deps)),
[application:load(Application) || Config <- Configs, {Application, _} <- Config],
rebar_utils:reread_config(Configs),
+ code:set_path(OldPath),
Merged = lists:ukeymerge(1,
lists:ukeysort(1, CmdOpts),
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index dc0bb42..f55f40f 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -414,6 +414,8 @@ user_agent() ->
?FMT("Rebar/~s (OTP/~s)", [Vsn, otp_release()]).
reread_config(ConfigList) ->
+ %% NB: we attempt to mimic -config here, which survives app reload,
+ %% hence {persistent, true}.
SetEnv = case version_tuple(?MODULE:otp_release()) of
{X, _, _} when X =< 17 ->
fun application:set_env/3;