summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2016-08-14 08:02:05 -0400
committerGitHub <noreply@github.com>2016-08-14 08:02:05 -0400
commit3c5807fc033af8cc34200d44be7af8e22de8b9f2 (patch)
tree7c993d32a0db91b413ad3c5c98700ac60dd931cf
parent4b63d35b940fcf88892a220b6e6639511c7252da (diff)
parent5eb6b7dfdadd0d5b32597a722912f5faf82cad75 (diff)
Merge pull request #1299 from ferd/hookable-escript
Hookable escript
-rw-r--r--rebar.config4
-rw-r--r--src/rebar_prv_escriptize.erl9
2 files changed, 11 insertions, 2 deletions
diff --git a/rebar.config b/rebar.config
index f91d61b..5cbc2be 100644
--- a/rebar.config
+++ b/rebar.config
@@ -12,6 +12,10 @@
{cth_readable, "1.2.3"},
{eunit_formatters, "0.3.1"}]}.
+{post_hooks, [{"(linux|darwin|solaris|freebsd|netbsd|openbsd)",
+ escriptize,
+ "cp $REBAR_BUILD_DIR/bin/rebar3 ./rebar3 && chmod u+x rebar3"}]}.
+
{escript_name, rebar3}.
{escript_emu_args, "%%! +sbtu +A0\n"}.
%% escript_incl_extra is for internal rebar-private use only.
diff --git a/src/rebar_prv_escriptize.erl b/src/rebar_prv_escriptize.erl
index 06b54ed..7ee20c2 100644
--- a/src/rebar_prv_escriptize.erl
+++ b/src/rebar_prv_escriptize.erl
@@ -61,8 +61,11 @@ desc() ->
"the project's and its dependencies' BEAM files.".
do(State) ->
+ Providers = rebar_state:providers(State),
+ Cwd = rebar_state:dir(State),
+ rebar_hooks:run_project_and_app_hooks(Cwd, pre, ?PROVIDER, Providers, State),
?INFO("Building escript...", []),
- case rebar_state:get(State, escript_main_app, undefined) of
+ Res = case rebar_state:get(State, escript_main_app, undefined) of
undefined ->
case rebar_state:project_apps(State) of
[App] ->
@@ -78,7 +81,9 @@ do(State) ->
_ ->
?PRV_ERROR({bad_name, Name})
end
- end.
+ end,
+ rebar_hooks:run_project_and_app_hooks(Cwd, post, ?PROVIDER, Providers, State),
+ Res.
escriptize(State0, App) ->
AppName = rebar_app_info:name(App),