summaryrefslogtreecommitdiff
path: root/src/rebar_hooks.erl
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2018-10-05 07:57:20 -0400
committerFred Hebert <mononcqc@ferd.ca>2018-10-11 08:43:52 -0400
commit9d788d893620f868b9c0ee00ddec8ae4d5d8fea7 (patch)
treef423d819a75848925e2152c29023e072611be27d /src/rebar_hooks.erl
parent1df574a6f55506d606020d64f42c33f8bbf16a7b (diff)
Abstracted path management
Move path management out of rebar_utils manual code path function handling (which we leave there for backwards compat), and centralize them to allow easier coordination of paths between plugins and deps. On top of path handling, do a check of loaded modules to only purge and reload those that actually need it done in order to prevent all kinds of weird interaction and accidental purge kills. It also allows the possible cohabitation of both at once, with a "in case of conflict pick X" as a policy Changing path handling in providers also highlighted a bunch of bugs in some tests and appears to fix some in other providers, specifically around plugins.
Diffstat (limited to 'src/rebar_hooks.erl')
-rw-r--r--src/rebar_hooks.erl8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/rebar_hooks.erl b/src/rebar_hooks.erl
index ec6fe31..f2ef8a3 100644
--- a/src/rebar_hooks.erl
+++ b/src/rebar_hooks.erl
@@ -42,8 +42,9 @@ run_provider_hooks_(Dir, Type, Command, Providers, TypeHooks, State) ->
[] ->
State;
HookProviders ->
- PluginDepsPaths = lists:usort(rebar_state:code_paths(State, all_plugin_deps)),
- code:add_pathsa(PluginDepsPaths),
+ %PluginDepsPaths = lists:usort(rebar_state:code_paths(State, all_plugin_deps)),
+ %code:add_pathsa(PluginDepsPaths),
+ rebar_paths:set_paths([plugins, deps], State),
Providers1 = rebar_state:providers(State),
State1 = rebar_state:providers(rebar_state:dir(State, Dir), Providers++Providers1),
case rebar_core:do(HookProviders, State1) of
@@ -51,7 +52,8 @@ run_provider_hooks_(Dir, Type, Command, Providers, TypeHooks, State) ->
?DEBUG(format_error({bad_provider, Type, Command, ProviderName}), []),
throw(?PRV_ERROR({bad_provider, Type, Command, ProviderName}));
{ok, State2} ->
- rebar_utils:remove_from_code_path(PluginDepsPaths),
+ %rebar_utils:remove_from_code_path(PluginDepsPaths),
+ rebar_paths:set_paths([deps, plugins], State2),
State2
end
end.