From d623b396428ae4cbbb003eb7a4a589e7a0597fee Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Fri, 6 Mar 2015 17:20:38 -0600 Subject: fix code path update for deps --- src/rebar3.erl | 1 - src/rebar_core.erl | 38 +------------------------------------- src/rebar_prv_install_deps.erl | 2 ++ 3 files changed, 3 insertions(+), 38 deletions(-) diff --git a/src/rebar3.erl b/src/rebar3.erl index 5b7db24..1b840cb 100644 --- a/src/rebar3.erl +++ b/src/rebar3.erl @@ -125,7 +125,6 @@ run_aux(State, GlobalPluginProviders, RawArgs) -> {ok, Providers} = application:get_env(rebar, providers), {ok, PluginProviders, State4} = rebar_plugins:install(State3), - rebar_core:update_code_path(State4), %% Providers can modify profiles stored in opts, so set default after initializing providers AllProviders = Providers++PluginProviders++GlobalPluginProviders, diff --git a/src/rebar_core.erl b/src/rebar_core.erl index f0d9b3d..36c428d 100644 --- a/src/rebar_core.erl +++ b/src/rebar_core.erl @@ -26,8 +26,7 @@ %% ------------------------------------------------------------------- -module(rebar_core). --export([process_command/2 - ,update_code_path/1]). +-export([process_command/2]). -include("rebar.hrl"). @@ -103,38 +102,3 @@ do([ProviderName | Rest], State) -> {error, Error} -> {error, Error} end. - -update_code_path(State) -> - true = rebar_utils:expand_code_path(), - LibDirs = rebar_dir:lib_dirs(State), - DepsDir = rebar_dir:deps_dir(State), - PluginsDir = rebar_dir:plugins_dir(State), - _UpdatedCodePaths = update_code_path_(lists:usort([DepsDir, PluginsDir | LibDirs])). - -%% =================================================================== -%% Internal functions -%% =================================================================== - -update_code_path_(Paths) -> - LibPaths = expand_lib_dirs(Paths, rebar_dir:get_cwd(), []), - ok = code:add_pathsa(LibPaths), - %% track just the paths we added, so we can remove them without - %% removing other paths added by this dep - {added, LibPaths}. - -expand_lib_dirs([], _Root, Acc) -> - Acc; -expand_lib_dirs([Dir | Rest], Root, Acc) -> - %% The current dir should only have an ebin dir. - %% Other lib dirs contain app directories, so need the wildcard - Apps = case Dir of - "." -> - [filename:join(Dir, "ebin")]; - _ -> - filelib:wildcard(filename:join([Dir, "*", "ebin"])) - end, - FqApps = case filename:pathtype(Dir) of - absolute -> Apps; - _ -> [filename:join([Root, A]) || A <- Apps] - end, - expand_lib_dirs(Rest, Root, Acc ++ FqApps). diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl index f702936..1c269fb 100644 --- a/src/rebar_prv_install_deps.erl +++ b/src/rebar_prv_install_deps.erl @@ -146,6 +146,8 @@ handle_deps(Profile, State, Deps, Upgrade, Locks) -> ,lists:ukeysort(2, Solved)), %% Sort all apps to build order State3 = rebar_state:all_deps(State2, AllDeps), + CodePaths = [rebar_app_info:ebin_dir(A) || A <- AllDeps], + ok = code:add_pathsa(CodePaths), {ok, AllDeps, State3}. -- cgit v1.1