Add support for rebar3 to "make rel"

This commit is contained in:
Badlop 2021-06-25 12:32:40 +02:00
parent 9d4c01d425
commit d5adcaea61
7 changed files with 73 additions and 5 deletions

View File

@ -123,10 +123,7 @@ jobs:
make update
make
# Right now 'make rel' works only with rebar2, not rebar3
- run: make rel
if: matrix.rebar == 2
- run: make install -s
- run: make hooks
- run: make options

View File

@ -107,6 +107,7 @@ ifeq "$(IS_REBAR3)" "1"
DEPSBASE=_build
DEPSDIR=$(DEPSBASE)/default/lib
EBINDIR=$(DEPSDIR)/ejabberd/ebin
REBARREL=as prod tar
else
SKIPDEPS=skip_deps=true
LISTDEPS=-q list-deps
@ -115,6 +116,7 @@ else
DEPSBASE=deps
DEPSDIR=$(DEPSBASE)
EBINDIR=ebin
REBARREL=generate
endif
all: deps src
@ -357,8 +359,8 @@ distclean: clean clean-rel
rm -f ejabberdctl.example ejabberd.init ejabberd.service
[ ! -f ../ChangeLog ] || rm -f ../ChangeLog
rel: all
$(REBAR) generate
rel:
$(REBAR) $(REBARREL)
TAGS:
etags *.erl

View File

@ -172,6 +172,27 @@
{"fast_yaml", []},
{"stringprep", []}]}.
{relx, [{release, {ejabberd, {cmd, "grep {vsn, vars.config | sed 's|{vsn, \"||;s|\"}.||' | tr -d '\012'"}},
[ejabberd, odbc]},
{sys_config, "./rel/sys.config"},
{vm_args, "./rel/vm.args"},
{overlay_vars, "vars.config"},
{extended_start_script, true},
{overlay, [{mkdir, "var/log/ejabberd"},
{mkdir, "var/lock"},
{mkdir, "var/lib/ejabberd"},
{mkdir, "etc/ejabberd"},
{copy, "rel/files/erl", "\{\{erts_vsn\}\}/bin/erl"}, % in rebar2 this prepends erts-
{template, "ejabberdctl.template", "bin/ejabberdctl"},
{copy, "inetrc", "etc/ejabberd/inetrc"},
{copy, "rel/files/install_upgrade.escript", "bin/install_upgrade.escript"}]}
]}.
{profiles, [{prod, [{relx, [{mode, prod},
{overlay, [{copy, "sql/*", "lib/ejabberd-\{\{release_version\}\}/priv/sql/"},
{copy, "ejabberdctl.cfg.example", "etc/ejabberd/ejabberdctl.cfg"},
{copy, "ejabberd.yml.example", "etc/ejabberd/ejabberd.yml"}]}]}]},
{test, [{erl_opts, [nowarn_export_all]}]}]}.
%% Local Variables:
%% mode: erlang
%% End:

View File

@ -339,6 +339,14 @@ fun(Deps, FDeps) ->
end, Deps)
end,
ProcessRelx = fun(Relx, Deps) ->
{value, {release, NameVersion, DefaultApps}, RelxTail} = lists:keytake(release, 1, Relx),
DepApps = lists:map(fun({DepName, _, _}) -> DepName;
({DepName, _}) -> DepName
end, Deps),
[{release, NameVersion, DefaultApps ++ DepApps} | RelxTail]
end,
GithubConfig = case {os:getenv("GITHUB_ACTIONS"), os:getenv("GITHUB_TOKEN")} of
{"true", Token} when is_list(Token) ->
CONFIG1 = [{coveralls_repo_token, Token},
@ -374,6 +382,8 @@ Rules = [
ProcessErlOpt, []},
{[xref_queries], [xref_exclusions], true,
AppendList2(ProcssXrefExclusions), [], []},
{[relx], [deps], IsRebar3,
ProcessRelx, [], []},
{[deps], [floating_deps], true,
ProcessFloatingDeps, [], []},
{[deps], [gitonly_deps], IsRebar3,

2
rel/sys.config Normal file
View File

@ -0,0 +1,2 @@
[{ejabberd, [{config, "etc/ejabberd/ejabberd.yml"},
{log_path, "var/log/ejabberd/ejabberd.log"}]}].

32
rel/vm.args Normal file
View File

@ -0,0 +1,32 @@
## Name of the node
-sname ejabberd@localhost
## Cookie for distributed erlang
#-setcookie ejabberd
-mnesia dir \"var/lib/ejabberd\"
## Heartbeat management; auto-restarts VM if it dies or becomes unresponsive
## (Disabled by default..use with caution!)
##-heart
## Enable kernel poll and a few async threads
##+K true
##+A 5
## Increase number of concurrent ports/sockets
##-env ERL_MAX_PORTS 4096
## Tweak GC to run more often
##-env ERL_FULLSWEEP_AFTER 10
# +B [c | d | i]
# Option c makes Ctrl-C interrupt the current shell instead of invoking the emulator break
# handler. Option d (same as specifying +B without an extra option) disables the break handler. # Option i makes the emulator ignore any break signal.
# If option c is used with oldshell on Unix, Ctrl-C will restart the shell process rather than
# interrupt it.
# Disable the emulator break handler
# it easy to accidentally type ctrl-c when trying
# to reach for ctrl-d. ctrl-c on a live node can
# have very undesirable results
##+Bi

View File

@ -20,10 +20,14 @@ Vars = case file:consult(filename:join([filename:dirname(SCRIPT), "..", "vars.co
cache_tab,
eimp,
fast_tls,
fast_xml,
fast_yaml,
lager,
p1_acme,
p1_utils,
pkix,
stringprep,
yconf,
xmpp]},
{mod, {ejabberd_app, []}}]}.