From 4374999d9567acf93fbd3515aa19319c4e502390 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sat, 18 Apr 2015 11:56:51 -0500 Subject: real bootstrapping --- src/rebar3.erl | 1 + src/rebar_api.erl | 2 +- src/rebar_config.erl | 1 - src/rebar_erlc_compiler.erl | 3 ++- src/rebar_otp_app.erl | 1 - src/rebar_prv_common_test.erl | 2 +- src/rebar_prv_compile.erl | 3 +-- src/rebar_prv_dialyzer.erl | 2 +- src/rebar_prv_eunit.erl | 2 +- src/rebar_prv_shell.erl | 2 +- src/rebar_prv_xref.erl | 2 +- 11 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/rebar3.erl b/src/rebar3.erl index e5e3173..fbbda51 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, 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..a848401 100644 --- a/src/rebar_prv_common_test.erl +++ b/src/rebar_prv_common_test.erl @@ -39,7 +39,7 @@ init(State) -> 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_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 -- cgit v1.1 From 16e9b3ffa2ddd81e26238530fd1e25a54a42b7dc Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Wed, 22 Apr 2015 21:43:59 -0500 Subject: fix tracking of all profiles dep paths --- src/rebar_prv_common_test.erl | 1 - src/rebar_prv_install_deps.erl | 4 ++-- src/rebar_state.erl | 15 +++++++++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl index a848401..9038759 100644 --- a/src/rebar_prv_common_test.erl +++ b/src/rebar_prv_common_test.erl @@ -38,7 +38,6 @@ init(State) -> -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. do(State) -> ?INFO("Running Common Test suites...", []), - code:add_pathsa(rebar_state:code_paths(State, all_deps)), %% Run ct provider prehooks 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_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. -- cgit v1.1 From e5988f69e0fc577f9c759f0907bd8b6840851035 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Wed, 22 Apr 2015 21:51:11 -0500 Subject: R15 support, replace unsetenv with putenv empty string --- src/rebar3.erl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/rebar3.erl b/src/rebar3.erl index fbbda51..b0cc949 100644 --- a/src/rebar3.erl +++ b/src/rebar3.erl @@ -115,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, -- cgit v1.1