Skip to content

Commit

Permalink
#1858: Add code paths of plugins at the beginning of plugin compile
Browse files Browse the repository at this point in the history
  • Loading branch information
Laszlo Toth authored and Laszlo Toth committed Aug 17, 2018
1 parent c96222e commit e617e87
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/rebar_prv_compile.erl
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ compile(State, AppInfo) ->
compile(State, rebar_state:providers(State), AppInfo).

compile(State, Providers, AppInfo) ->
%% Load plugins back for make_vsn calls in custom resources.
%% The rebar_otp_app compilation step is safe regarding the
%% overall path management, so we can just load all plugins back
%% in memory.
PluginDepsPaths = rebar_state:code_paths(State, all_plugin_deps),
code:add_pathsa(PluginDepsPaths),
?INFO("Compiling ~ts", [rebar_app_info:name(AppInfo)]),
AppDir = rebar_app_info:dir(AppInfo),
AppInfo1 = rebar_hooks:run_all_hooks(AppDir, pre, ?PROVIDER, Providers, AppInfo, State),
Expand All @@ -137,12 +143,6 @@ compile(State, Providers, AppInfo) ->

AppInfo4 = rebar_hooks:run_all_hooks(AppDir, pre, ?APP_HOOK, Providers, AppInfo3, State),

%% Load plugins back for make_vsn calls in custom resources.
%% The rebar_otp_app compilation step is safe regarding the
%% overall path management, so we can just load all plugins back
%% in memory.
PluginDepsPaths = rebar_state:code_paths(State, all_plugin_deps),
code:add_pathsa(PluginDepsPaths),
AppFileCompileResult = rebar_otp_app:compile(State, AppInfo4),
%% Clean up after ourselves, leave things as they were.
rebar_utils:remove_from_code_path(PluginDepsPaths),
Expand Down

0 comments on commit e617e87

Please sign in to comment.