diff options
author | Tristan Sloughter <t@crashfast.com> | 2015-03-06 17:20:38 -0600 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2015-03-06 17:30:16 -0600 |
commit | d623b396428ae4cbbb003eb7a4a589e7a0597fee (patch) | |
tree | abee0cb49076c66feb79c61e13029aaaec15ddd1 /src | |
parent | bc5d1cb155ad99d6e605cc80952bd34d8a3de17e (diff) |
fix code path update for deps
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar3.erl | 1 | ||||
-rw-r--r-- | src/rebar_core.erl | 38 | ||||
-rw-r--r-- | 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}. |