aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAleksandar Markovski <[email protected]>2016-12-17 17:49:08 +0100
committerAleksandar Markovski <[email protected]>2016-12-17 17:49:08 +0100
commita231a354c6e9db32832f6346a3fdea10f7996432 (patch)
treeb12444d684dd04af871db22f76efdfcae31d69cd /src
parent083a3aecbd10cea625e0706007f8f831a33ebeaf (diff)
downloadrelx-a231a354c6e9db32832f6346a3fdea10f7996432.tar.gz
relx-a231a354c6e9db32832f6346a3fdea10f7996432.tar.bz2
relx-a231a354c6e9db32832f6346a3fdea10f7996432.zip
Replace rebar_log calls to enable relx to build extended script with builders other then rebar(Erlang.mk)
Diffstat (limited to 'src')
-rw-r--r--src/rlx_prv_assembler.erl36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/rlx_prv_assembler.erl b/src/rlx_prv_assembler.erl
index a17d0f4..450eec9 100644
--- a/src/rlx_prv_assembler.erl
+++ b/src/rlx_prv_assembler.erl
@@ -392,7 +392,8 @@ write_bin_file(State, Release, OutputDir, RelDir) ->
include_nodetool(BinDir),
Hooks = expand_hooks(BinDir,
rlx_state:get(State,
- extended_start_script_hooks, [])),
+ extended_start_script_hooks, []),
+ State),
extended_bin_file_contents(OsFamily, RelName, RelVsn,
rlx_release:erts(Release), ErlOpts,
Hooks)
@@ -426,12 +427,12 @@ write_bin_file(State, Release, OutputDir, RelDir) ->
E
end.
-expand_hooks(_Bindir, []) -> [];
-expand_hooks(BinDir, Hooks) ->
- expand_hooks(BinDir, Hooks, []).
+expand_hooks(_Bindir, [], _State) -> [];
+expand_hooks(BinDir, Hooks, _State) ->
+ expand_hooks(BinDir, Hooks, [], _State).
-expand_hooks(_BinDir, [], Acc) -> Acc;
-expand_hooks(BinDir, [{Phase, Hooks0} | Rest], Acc) ->
+expand_hooks(_BinDir, [], Acc, _State) -> Acc;
+expand_hooks(BinDir, [{Phase, Hooks0} | Rest], Acc, State) ->
%% filter and expand hooks to their respective shell scripts
Hooks =
lists:foldl(
@@ -442,17 +443,20 @@ expand_hooks(BinDir, [{Phase, Hooks0} | Rest], Acc) ->
HookScriptFilename = filename:join([BinDir,
hook_filename(Hook)]),
%% write the hook script file to it's proper location
- ok = render_hook(hook_template(Hook), HookScriptFilename),
+ ok = render_hook(hook_template(Hook), HookScriptFilename, State),
%% and return the invocation that's to be templated in the
%% extended script
Acc0 ++ [hook_invocation(Hook)];
false ->
- rebar_api:info("~p hook is not allowed in the ~p phase, ignoring it",
- [Hook, Phase]),
+ ec_cmd_log:error(
+ rlx_state:log(State),
+ io_lib:format("~p hook is not allowed in the ~p phase, ignoring it", [Hook, Phase])
+ ),
+
Acc0
end
end, [], Hooks0),
- expand_hooks(BinDir, Rest, Acc ++ [{Phase, Hooks}]).
+ expand_hooks(BinDir, Rest, Acc ++ [{Phase, Hooks}], State).
%% the pid script hook is only allowed in the
%% post_start phase
@@ -496,10 +500,14 @@ hook_template({wait_for_process, _}) -> builtin_hook_wait_for_process.
%% custom hooks are not rendered, they should
%% be copied by the release overlays
-render_hook(custom, _) -> ok;
-render_hook(TemplateName, Script) ->
- rebar_api:debug("rendering ~p hook to ~p",
- [TemplateName, Script]),
+render_hook(custom, _, _) -> ok;
+render_hook(TemplateName, Script, State) ->
+ ec_cmd_log:info(
+ rlx_state:log(State),
+ "rendering ~p hook to ~p~n",
+ [TemplateName, Script]
+ ),
+
Template = render(TemplateName),
ok = filelib:ensure_dir(Script),
_ = ec_file:remove(Script),