summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rebar3.erl3
-rw-r--r--src/rebar_api.erl2
-rw-r--r--src/rebar_config.erl1
-rw-r--r--src/rebar_erlc_compiler.erl3
-rw-r--r--src/rebar_otp_app.erl1
-rw-r--r--src/rebar_prv_common_test.erl3
-rw-r--r--src/rebar_prv_compile.erl3
-rw-r--r--src/rebar_prv_dialyzer.erl2
-rw-r--r--src/rebar_prv_eunit.erl2
-rw-r--r--src/rebar_prv_install_deps.erl4
-rw-r--r--src/rebar_prv_shell.erl2
-rw-r--r--src/rebar_prv_xref.erl2
-rw-r--r--src/rebar_state.erl15
13 files changed, 27 insertions, 16 deletions
diff --git a/src/rebar3.erl b/src/rebar3.erl
index e5e3173..b0cc949 100644
--- a/src/rebar3.erl
+++ b/src/rebar3.erl
@@ -27,6 +27,7 @@
-module(rebar3).
-export([main/1,
+ run/1,
run/2,
global_option_spec_list/0,
init_config/0,
@@ -114,6 +115,8 @@ run_aux(State, RawArgs) ->
State2 = case os:getenv("REBAR_PROFILE") of
false ->
State;
+ "" ->
+ State;
Profile ->
rebar_state:apply_profiles(State, [list_to_atom(Profile)])
end,
diff --git a/src/rebar_api.erl b/src/rebar_api.erl
index a398b53..88c7538 100644
--- a/src/rebar_api.erl
+++ b/src/rebar_api.erl
@@ -54,7 +54,7 @@ wordsize() ->
%% Add deps to the code path
add_deps_to_path(State) ->
- code:add_paths(rebar_state:code_paths(State, all_deps)).
+ code:add_pathsa(rebar_state:code_paths(State, all_deps)).
%% Revert to only having the beams necessary for running rebar3 and plugins in the path
restore_code_path(State) ->
diff --git a/src/rebar_config.erl b/src/rebar_config.erl
index 76e03ea..58b2c4d 100644
--- a/src/rebar_config.erl
+++ b/src/rebar_config.erl
@@ -57,7 +57,6 @@ consult_file(File) ->
{ok, Terms} = consult_and_eval(File, Script),
Terms;
false ->
- ?DEBUG("Consult config file ~p", [File]),
try_consult(File)
end
end.
diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl
index ced8ca8..f906463 100644
--- a/src/rebar_erlc_compiler.erl
+++ b/src/rebar_erlc_compiler.erl
@@ -148,7 +148,8 @@ doterl_compile(Config, Dir, OutDir, MoreSources, ErlOpts) ->
%% Make sure that ebin/ exists and is on the path
ok = filelib:ensure_dir(filename:join(OutDir, "dummy.beam")),
- true = code:add_path(filename:absname(OutDir)),
+ true = code:add_patha(filename:absname(OutDir)),
+
OutDir1 = proplists:get_value(outdir, ErlOpts, OutDir),
G = init_erlcinfo(proplists:get_all_values(i, ErlOpts), AllErlFiles, Dir),
diff --git a/src/rebar_otp_app.erl b/src/rebar_otp_app.erl
index 41cd5f3..260343d 100644
--- a/src/rebar_otp_app.erl
+++ b/src/rebar_otp_app.erl
@@ -128,7 +128,6 @@ preprocess(State, AppInfo, AppSrcFile) ->
load_app_vars(State) ->
case rebar_state:get(State, app_vars_file, undefined) of
undefined ->
- ?DEBUG("No app_vars_file defined.", []),
[];
Filename ->
?INFO("Loading app vars from ~p", [Filename]),
diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl
index a398144..9038759 100644
--- a/src/rebar_prv_common_test.erl
+++ b/src/rebar_prv_common_test.erl
@@ -38,8 +38,7 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
?INFO("Running Common Test suites...", []),
-
- code:add_paths(rebar_state:code_paths(State, all_deps)),
+ code:add_pathsa(rebar_state:code_paths(State, all_deps)),
%% Run ct provider prehooks
Providers = rebar_state:providers(State),
diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl
index 25bda8c..1fb29bd 100644
--- a/src/rebar_prv_compile.erl
+++ b/src/rebar_prv_compile.erl
@@ -32,7 +32,7 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
DepsPaths = rebar_state:code_paths(State, all_deps),
- code:add_paths(DepsPaths),
+ code:add_pathsa(DepsPaths),
ProjectApps = rebar_state:project_apps(State),
Providers = rebar_state:providers(State),
@@ -83,7 +83,6 @@ build_app(State, Providers, AppInfo) ->
end,
%% Legacy hook support
-
rebar_hooks:run_all_hooks(AppDir, pre, ?PROVIDER, Providers, S),
AppInfo1 = compile(S, AppInfo),
rebar_hooks:run_all_hooks(AppDir, post, ?PROVIDER, Providers, S),
diff --git a/src/rebar_prv_dialyzer.erl b/src/rebar_prv_dialyzer.erl
index f7cdf3b..67cf4b9 100644
--- a/src/rebar_prv_dialyzer.erl
+++ b/src/rebar_prv_dialyzer.erl
@@ -64,7 +64,7 @@ short_desc() ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
?INFO("Dialyzer starting, this may take a while...", []),
- code:add_paths(rebar_state:code_paths(State, all_deps)),
+ code:add_pathsa(rebar_state:code_paths(State, all_deps)),
Plt = get_plt_location(State),
Apps = rebar_state:project_apps(State),
diff --git a/src/rebar_prv_eunit.erl b/src/rebar_prv_eunit.erl
index 3ee912d..12dd5f9 100644
--- a/src/rebar_prv_eunit.erl
+++ b/src/rebar_prv_eunit.erl
@@ -37,7 +37,7 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
?INFO("Performing EUnit tests...", []),
- code:add_paths(rebar_state:code_paths(State, all_deps)),
+ code:add_pathsa(rebar_state:code_paths(State, all_deps)),
%% Run eunit provider prehooks
Providers = rebar_state:providers(State),
Cwd = rebar_dir:get_cwd(),
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl
index 3b2c9ab..0fa843f 100644
--- a/src/rebar_prv_install_deps.erl
+++ b/src/rebar_prv_install_deps.erl
@@ -151,9 +151,9 @@ handle_deps(Profile, State0, Deps, Upgrade, Locks) ->
,lists:ukeysort(2, SrcApps)
,lists:ukeysort(2, Solved)),
- State3 = rebar_state:all_deps(State2, AllDeps),
+ State3 = rebar_state:update_all_deps(State2, AllDeps),
CodePaths = [rebar_app_info:ebin_dir(A) || A <- AllDeps],
- State4 = rebar_state:code_paths(State3, all_deps, CodePaths),
+ State4 = rebar_state:update_code_paths(State3, all_deps, CodePaths),
{ok, AllDeps, State4}.
diff --git a/src/rebar_prv_shell.erl b/src/rebar_prv_shell.erl
index b6a85ab..6153952 100644
--- a/src/rebar_prv_shell.erl
+++ b/src/rebar_prv_shell.erl
@@ -93,7 +93,7 @@ shell(State) ->
%% error_logger added by the tty handler
ok = remove_error_handler(3),
%% Add deps to path
- code:add_paths(rebar_state:code_paths(State, all_deps)),
+ code:add_pathsa(rebar_state:code_paths(State, all_deps)),
%% add project app test paths
ok = add_test_paths(State),
%% this call never returns (until user quits shell)
diff --git a/src/rebar_prv_xref.erl b/src/rebar_prv_xref.erl
index baec57f..1d1afa0 100644
--- a/src/rebar_prv_xref.erl
+++ b/src/rebar_prv_xref.erl
@@ -36,7 +36,7 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
- code:add_paths(rebar_state:code_paths(State, all_deps)),
+ code:add_pathsa(rebar_state:code_paths(State, all_deps)),
XrefChecks = prepare(State),
%% Run xref checks
diff --git a/src/rebar_state.erl b/src/rebar_state.erl
index 705f723..3909a39 100644
--- a/src/rebar_state.erl
+++ b/src/rebar_state.erl
@@ -3,7 +3,7 @@
-export([new/0, new/1, new/2, new/3,
get/2, get/3, set/3,
- code_paths/2, code_paths/3,
+ code_paths/2, code_paths/3, update_code_paths/3,
opts/1, opts/2,
default/1, default/2,
@@ -24,7 +24,7 @@
project_apps/1, project_apps/2,
deps_to_build/1, deps_to_build/2,
- all_deps/1, all_deps/2,
+ all_deps/1, all_deps/2, update_all_deps/2,
namespace/1, namespace/2,
deps_names/1,
@@ -146,6 +146,14 @@ code_paths(#state_t{code_paths=CodePaths}, Key) ->
code_paths(State=#state_t{code_paths=CodePaths}, Key, CodePath) ->
State#state_t{code_paths=dict:store(Key, CodePath, CodePaths)}.
+update_code_paths(State=#state_t{code_paths=CodePaths}, Key, CodePath) ->
+ case dict:is_key(Key, CodePaths) of
+ true ->
+ State#state_t{code_paths=dict:append_list(Key, CodePath, CodePaths)};
+ false ->
+ State#state_t{code_paths=dict:store(Key, CodePath, CodePaths)}
+ end.
+
opts(#state_t{opts=Opts}) ->
Opts.
@@ -312,6 +320,9 @@ all_deps(#state_t{all_deps=Apps}) ->
all_deps(State=#state_t{}, NewApps) ->
State#state_t{all_deps=NewApps}.
+update_all_deps(State=#state_t{all_deps=Apps}, NewApps) ->
+ State#state_t{all_deps=Apps++NewApps}.
+
namespace(#state_t{namespace=Namespace}) ->
Namespace.