summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2017-11-22 14:28:39 -0500
committerGitHub <noreply@github.com>2017-11-22 14:28:39 -0500
commita00f04273d57731797152ef420d4be6462761231 (patch)
treea1cc32a9dff081a281b0e867c3fb7b3cf96fa07a /src
parent07e19ba60dfd04b1d81e1d5764a814f06c9dbcb2 (diff)
parentc550cf0c4c9df09ff1fe7eca0fbe8e26fa800502 (diff)
Merge pull request #1668 from ferd/fix-make_vsn-custom-resources
Fix compilation for custom resources dynamic vsn
Diffstat (limited to 'src')
-rw-r--r--src/rebar_prv_compile.erl13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl
index c9a77a5..72320fb 100644
--- a/src/rebar_prv_compile.erl
+++ b/src/rebar_prv_compile.erl
@@ -136,7 +136,18 @@ compile(State, Providers, AppInfo) ->
AppInfo3 = rebar_hooks:run_all_hooks(AppDir, post, ?ERLC_HOOK, Providers, AppInfo2, State),
AppInfo4 = rebar_hooks:run_all_hooks(AppDir, pre, ?APP_HOOK, Providers, AppInfo3, State),
- case rebar_otp_app:compile(State, AppInfo4) of
+
+ %% 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),
+
+ case AppFileCompileResult of
{ok, AppInfo5} ->
AppInfo6 = rebar_hooks:run_all_hooks(AppDir, post, ?APP_HOOK, Providers, AppInfo5, State),
AppInfo7 = rebar_hooks:run_all_hooks(AppDir, post, ?PROVIDER, Providers, AppInfo6, State),