From f270564ef90321f19b856e7d9cbd719a41e104b1 Mon Sep 17 00:00:00 2001 From: Andrei Zavada Date: Tue, 29 Mar 2022 01:24:15 +0300 Subject: [PATCH 1/5] try different relx:opt_spec_list/0 (changed in rebar3.18) --- src/rebar3_cuttlefish_release.erl | 9 ++++++++- src/rebar3_cuttlefish_tar.erl | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/rebar3_cuttlefish_release.erl b/src/rebar3_cuttlefish_release.erl index 69a2c7d..c16672d 100644 --- a/src/rebar3_cuttlefish_release.erl +++ b/src/rebar3_cuttlefish_release.erl @@ -22,7 +22,7 @@ init(State) -> {bare, true}, % The task can be run by the user, always true {deps, ?DEPS}, % The list of dependencies {example, "rebar3 cuttlefish release"}, % How to use the plugin - {opts, relx:opt_spec_list()}, % list of options understood by the plugin + {opts, supported_options()}, % list of options understood by the plugin {short_desc, "Rebar3 cuttlefish release plugin"}, {desc, ""} ]), @@ -215,3 +215,10 @@ rebar_release_dir(State) -> OutputDir -> OutputDir end. + +supported_options() -> + try + relx:opt_spec_list() + catch _:undef -> + rebar_relx:opt_spec_list() + end. diff --git a/src/rebar3_cuttlefish_tar.erl b/src/rebar3_cuttlefish_tar.erl index b10e54e..c6b35f6 100644 --- a/src/rebar3_cuttlefish_tar.erl +++ b/src/rebar3_cuttlefish_tar.erl @@ -21,7 +21,7 @@ init(State) -> {bare, true}, % The task can be run by the user, always true {deps, ?DEPS}, % The list of dependencies {example, "rebar3 cuttlefish tar"}, % How to use the plugin - {opts, relx:opt_spec_list()}, % list of options understood by the plugin + {opts, supported_options()}, % list of options understood by the plugin {short_desc, "Rebar3 cuttlefish release tarball plugin"}, {desc, ""} ]), @@ -35,3 +35,10 @@ do(State) -> -spec format_error(any()) -> iolist(). format_error(Error) -> io_lib:format("~p", [Error]). + +supported_options() -> + try + relx:opt_spec_list() + catch _:undef -> + rebar_relx:opt_spec_list() + end. From 3cfbf5acb6e9b89cd567a95fa95aa969de16951a Mon Sep 17 00:00:00 2001 From: Andrei Zavada Date: Tue, 29 Mar 2022 01:24:41 +0300 Subject: [PATCH 2/5] bump cuttlefish dep; use https:// instead of git:// --- rebar.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rebar.config b/rebar.config index 78f559f..c8390c1 100644 --- a/rebar.config +++ b/rebar.config @@ -3,7 +3,7 @@ warnings_as_errors]}. {deps, [ - {cuttlefish, {git,"git://github.com/basho/cuttlefish.git", {tag, "2.1.0"}}} + {cuttlefish, {git,"https://github.com/TI-Tokyo/cuttlefish.git", {tag, "2.2.0"}}} ]}. {xref_checks, [ From 48abd440a1f307ad1877ced0c8a9b961d993f9d8 Mon Sep 17 00:00:00 2001 From: Andrei Zavada Date: Tue, 29 Mar 2022 02:11:51 +0300 Subject: [PATCH 3/5] more rebar3.18 API fixes --- src/rebar3_cuttlefish_release.erl | 20 +++++++++++++++----- src/rebar3_cuttlefish_tar.erl | 14 ++++++++++---- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/rebar3_cuttlefish_release.erl b/src/rebar3_cuttlefish_release.erl index c16672d..a78a048 100644 --- a/src/rebar3_cuttlefish_release.erl +++ b/src/rebar3_cuttlefish_release.erl @@ -1,9 +1,10 @@ -module(rebar3_cuttlefish_release). -behaviour(provider). --export([init/1 - ,do/1 - ,format_error/1]). +-export([ init/1 + , do/1 + , format_error/1 + ]). -define(PROVIDER, release). -define(NAMESPACE, default). @@ -99,7 +100,7 @@ do(State) -> State1 = rebar_state:set(State, relx, lists:keydelete(overlay, 1, Relx) ++ [{generate_start_script, DisableCFRelScripts}, {overlay, Overlays3} | StartHookState]), - Res = rebar_relx:do(rlx_prv_release, "release", ?PROVIDER, State1), + Res = rebar_relx_do(State1), SchemaGlob = filename:join([TargetDir, "share", "schema", "*.schema"]), ReleaseSchemas = filelib:wildcard(SchemaGlob), @@ -117,6 +118,15 @@ do(State) -> Res end. +rebar_relx_do(State) -> + try + rebar_relx:do(?PROVIDER, State) + catch _:undef -> + rebar_relx:do(rlx_prv_release, atom_to_list(?PROVIDER), ?PROVIDER, State) + end. + + + -spec format_error(any()) -> iolist(). format_error({no_cuttlefish_escript, ProfileDir}) -> io_lib:format("No cuttlefish escript found under ~s or ~s", [filename:join(ProfileDir, "bin"), @@ -162,7 +172,7 @@ maybe_set_startup_hook(false, _State) -> [{sys_config, false}, {vm_args, false}]; maybe_set_startup_hook(true, State) -> RelxState = rebar_state:get(State, relx), - StartHooks0 = + StartHooks0 = case lists:keyfind(extended_start_script_hooks, 1, RelxState) of {extended_start_script_hooks, StartHooks1} -> do_set_start_hook(StartHooks1); diff --git a/src/rebar3_cuttlefish_tar.erl b/src/rebar3_cuttlefish_tar.erl index c6b35f6..da1e5a7 100644 --- a/src/rebar3_cuttlefish_tar.erl +++ b/src/rebar3_cuttlefish_tar.erl @@ -1,9 +1,10 @@ -module(rebar3_cuttlefish_tar). -behaviour(provider). --export([init/1 - ,do/1 - ,format_error/1]). +-export([ init/1 + , do/1 + , format_error/1 + ]). -define(PROVIDER, tar). -define(NAMESPACE, default). @@ -30,7 +31,12 @@ init(State) -> -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. do(State) -> - rebar_relx:do(rlx_prv_release, "tar", ?PROVIDER, State). + try + rebar_relx:do(?PROVIDER, State) + catch _:undef -> + rebar_relx:do(rlx_prv_release, atom_to_list(?PROVIDER), ?PROVIDER, State) + end. + -spec format_error(any()) -> iolist(). format_error(Error) -> From be3b76ccf93df37f012b771ea23d3729b1c916f9 Mon Sep 17 00:00:00 2001 From: Andrei Zavada Date: Sat, 2 Apr 2022 22:03:22 +0300 Subject: [PATCH 4/5] only use rebar 3.18 api --- src/rebar3_cuttlefish_release.erl | 18 ++---------------- src/rebar3_cuttlefish_tar.erl | 15 ++------------- 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/src/rebar3_cuttlefish_release.erl b/src/rebar3_cuttlefish_release.erl index a78a048..bc5da13 100644 --- a/src/rebar3_cuttlefish_release.erl +++ b/src/rebar3_cuttlefish_release.erl @@ -23,7 +23,7 @@ init(State) -> {bare, true}, % The task can be run by the user, always true {deps, ?DEPS}, % The list of dependencies {example, "rebar3 cuttlefish release"}, % How to use the plugin - {opts, supported_options()}, % list of options understood by the plugin + {opts, rebar_relx:opt_spec_list()}, % list of options understood by the plugin {short_desc, "Rebar3 cuttlefish release plugin"}, {desc, ""} ]), @@ -100,7 +100,7 @@ do(State) -> State1 = rebar_state:set(State, relx, lists:keydelete(overlay, 1, Relx) ++ [{generate_start_script, DisableCFRelScripts}, {overlay, Overlays3} | StartHookState]), - Res = rebar_relx_do(State1), + Res = rebar_relx:do(?PROVIDER, State1), SchemaGlob = filename:join([TargetDir, "share", "schema", "*.schema"]), ReleaseSchemas = filelib:wildcard(SchemaGlob), @@ -118,13 +118,6 @@ do(State) -> Res end. -rebar_relx_do(State) -> - try - rebar_relx:do(?PROVIDER, State) - catch _:undef -> - rebar_relx:do(rlx_prv_release, atom_to_list(?PROVIDER), ?PROVIDER, State) - end. - -spec format_error(any()) -> iolist(). @@ -225,10 +218,3 @@ rebar_release_dir(State) -> OutputDir -> OutputDir end. - -supported_options() -> - try - relx:opt_spec_list() - catch _:undef -> - rebar_relx:opt_spec_list() - end. diff --git a/src/rebar3_cuttlefish_tar.erl b/src/rebar3_cuttlefish_tar.erl index da1e5a7..61324cb 100644 --- a/src/rebar3_cuttlefish_tar.erl +++ b/src/rebar3_cuttlefish_tar.erl @@ -22,7 +22,7 @@ init(State) -> {bare, true}, % The task can be run by the user, always true {deps, ?DEPS}, % The list of dependencies {example, "rebar3 cuttlefish tar"}, % How to use the plugin - {opts, supported_options()}, % list of options understood by the plugin + {opts, rebar_relx:opt_spec_list()}, % list of options understood by the plugin {short_desc, "Rebar3 cuttlefish release tarball plugin"}, {desc, ""} ]), @@ -31,20 +31,9 @@ init(State) -> -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. do(State) -> - try - rebar_relx:do(?PROVIDER, State) - catch _:undef -> - rebar_relx:do(rlx_prv_release, atom_to_list(?PROVIDER), ?PROVIDER, State) - end. + rebar_relx:do(?PROVIDER, State). -spec format_error(any()) -> iolist(). format_error(Error) -> io_lib:format("~p", [Error]). - -supported_options() -> - try - relx:opt_spec_list() - catch _:undef -> - rebar_relx:opt_spec_list() - end. From eb6ebe0a52bb0de565a7dc6b1c20588c8a25b96d Mon Sep 17 00:00:00 2001 From: Andrei Zavada Date: Thu, 2 Jun 2022 15:22:10 +0300 Subject: [PATCH 5/5] switch to delagerified cuttlefish (2.2.1rc1) --- rebar.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rebar.config b/rebar.config index 10b2f90..730ac50 100644 --- a/rebar.config +++ b/rebar.config @@ -3,7 +3,7 @@ warnings_as_errors]}. {deps, [ - {cuttlefish, {git,"https://github.com/basho/cuttlefish.git", {branch, "develop-3.0"}}} + {cuttlefish, {git,"https://github.com/TI-Tokyo/cuttlefish.git", {tag, "2.2.1rc1"}}} ]}. {xref_checks, [