diff --git a/releases_test/apps/app1/src/app1.app.src b/releases_test/apps/app1/src/app1.app.src new file mode 100644 index 0000000..aba37dd --- /dev/null +++ b/releases_test/apps/app1/src/app1.app.src @@ -0,0 +1,10 @@ +{application, app1, + [{description, "An OTP application"}, + {vsn, "0.1.0"}, + {registered, []}, + {mod, {app1_app, []}}, + {applications, + [kernel, + stdlib + ]} + ]}. diff --git a/releases_test/apps/app1/src/app1_app.erl b/releases_test/apps/app1/src/app1_app.erl new file mode 100644 index 0000000..b4abef7 --- /dev/null +++ b/releases_test/apps/app1/src/app1_app.erl @@ -0,0 +1,18 @@ +%%%------------------------------------------------------------------- +%% @doc app1 public API +%% @end +%%%------------------------------------------------------------------- + +-module(app1_app). + +-behaviour(application). + +-export([start/2, stop/1]). + +start(_StartType, _StartArgs) -> + app1_sup:start_link(). + +stop(_State) -> + ok. + +%% internal functions diff --git a/releases_test/apps/app1/src/app1_sup.erl b/releases_test/apps/app1/src/app1_sup.erl new file mode 100644 index 0000000..13122c7 --- /dev/null +++ b/releases_test/apps/app1/src/app1_sup.erl @@ -0,0 +1,35 @@ +%%%------------------------------------------------------------------- +%% @doc app1 top level supervisor. +%% @end +%%%------------------------------------------------------------------- + +-module(app1_sup). + +-behaviour(supervisor). + +-export([start_link/0]). + +-export([init/1]). + +-define(SERVER, ?MODULE). + +start_link() -> + supervisor:start_link({local, ?SERVER}, ?MODULE, []). + +%% sup_flags() = #{strategy => strategy(), % optional +%% intensity => non_neg_integer(), % optional +%% period => pos_integer()} % optional +%% child_spec() = #{id => child_id(), % mandatory +%% start => mfargs(), % mandatory +%% restart => restart(), % optional +%% shutdown => shutdown(), % optional +%% type => worker(), % optional +%% modules => modules()} % optional +init([]) -> + SupFlags = #{strategy => one_for_all, + intensity => 0, + period => 1}, + ChildSpecs = [], + {ok, {SupFlags, ChildSpecs}}. + +%% internal functions diff --git a/releases_test/apps/app2/src/app2.app.src b/releases_test/apps/app2/src/app2.app.src new file mode 100644 index 0000000..ecd5823 --- /dev/null +++ b/releases_test/apps/app2/src/app2.app.src @@ -0,0 +1,10 @@ +{application, app2, + [{description, "An OTP application"}, + {vsn, "0.1.0"}, + {registered, []}, + {mod, {app2_app, []}}, + {applications, + [kernel, + stdlib + ]} + ]}. diff --git a/releases_test/apps/app2/src/app2_app.erl b/releases_test/apps/app2/src/app2_app.erl new file mode 100644 index 0000000..342bb2b --- /dev/null +++ b/releases_test/apps/app2/src/app2_app.erl @@ -0,0 +1,18 @@ +%%%------------------------------------------------------------------- +%% @doc app2 public API +%% @end +%%%------------------------------------------------------------------- + +-module(app2_app). + +-behaviour(application). + +-export([start/2, stop/1]). + +start(_StartType, _StartArgs) -> + app2_sup:start_link(). + +stop(_State) -> + ok. + +%% internal functions diff --git a/releases_test/apps/app2/src/app2_sup.erl b/releases_test/apps/app2/src/app2_sup.erl new file mode 100644 index 0000000..4fbf25b --- /dev/null +++ b/releases_test/apps/app2/src/app2_sup.erl @@ -0,0 +1,35 @@ +%%%------------------------------------------------------------------- +%% @doc app2 top level supervisor. +%% @end +%%%------------------------------------------------------------------- + +-module(app2_sup). + +-behaviour(supervisor). + +-export([start_link/0]). + +-export([init/1]). + +-define(SERVER, ?MODULE). + +start_link() -> + supervisor:start_link({local, ?SERVER}, ?MODULE, []). + +%% sup_flags() = #{strategy => strategy(), % optional +%% intensity => non_neg_integer(), % optional +%% period => pos_integer()} % optional +%% child_spec() = #{id => child_id(), % mandatory +%% start => mfargs(), % mandatory +%% restart => restart(), % optional +%% shutdown => shutdown(), % optional +%% type => worker(), % optional +%% modules => modules()} % optional +init([]) -> + SupFlags = #{strategy => one_for_all, + intensity => 0, + period => 1}, + ChildSpecs = [], + {ok, {SupFlags, ChildSpecs}}. + +%% internal functions diff --git a/releases_test/config/sys.config b/releases_test/config/sys.config new file mode 100644 index 0000000..1b17989 --- /dev/null +++ b/releases_test/config/sys.config @@ -0,0 +1,3 @@ +[ + {releases_test, []} +]. diff --git a/releases_test/config/vm.args b/releases_test/config/vm.args new file mode 100644 index 0000000..756329c --- /dev/null +++ b/releases_test/config/vm.args @@ -0,0 +1,6 @@ +-sname releases_test + +-setcookie releases_test_cookie + ++K true ++A30 diff --git a/releases_test/rebar.config b/releases_test/rebar.config new file mode 100644 index 0000000..c7f8866 --- /dev/null +++ b/releases_test/rebar.config @@ -0,0 +1,17 @@ +{erl_opts, [debug_info]}. +{deps, []}. + +{relx, [{release, {app1, "0.1.0"}, + [app1, sasl]}, + {release, {app1, "0.2.0"}, + [app1, sasl]}, + {release, {app2, "0.1.0"}, + [app2, sasl]}, + {release, {both, "0.1.0"}, + [app1, app2, sasl]}, + + {mode, dev}, + + {sys_config, "./config/sys.config"}, + {vm_args, "./config/vm.args"} +]}. diff --git a/releases_test/rebar.lock b/releases_test/rebar.lock new file mode 100644 index 0000000..57afcca --- /dev/null +++ b/releases_test/rebar.lock @@ -0,0 +1 @@ +[]. diff --git a/releases_test/releases.test b/releases_test/releases.test new file mode 100644 index 0000000..a35d88d --- /dev/null +++ b/releases_test/releases.test @@ -0,0 +1,14 @@ +rebar3 release +>>>= 1 +rebar3 release --relname app1 +>>>= 0 +ls _build/default/rel/app1/releases +>>>= 0 +rebar3 release --relnames app1,both +>>>= 0 +ls _build/default/rel/both/releases +>>>= 0 +rebar3 release --all +>>>= 0 +ls _build/default/rel/app2/releases +>>>= 0