diff options
-rw-r--r-- | src/rlx_rel_discovery.erl | 18 | ||||
-rw-r--r-- | test/rlx_discover_SUITE.erl | 6 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/rlx_rel_discovery.erl b/src/rlx_rel_discovery.erl index 837ebe6..23c0ab9 100644 --- a/src/rlx_rel_discovery.erl +++ b/src/rlx_rel_discovery.erl @@ -38,12 +38,18 @@ -spec do(rlx_state:t(), [file:name()], [rlx_app_info:t()]) -> {ok, [rlx_release:t()]} | relx:error(). do(State, LibDirs, AppMeta) -> - ec_cmd_log:info(rlx_state:log(State), - fun() -> - ["Resolving available OTP Releases from directories:\n", - string:join([[rlx_util:indent(2), LibDir] || LibDir <- LibDirs], "\n")] - end), - resolve_rel_metadata(State, LibDirs, AppMeta). + case rlx_state:get(State, disable_rel_discovery, false) of + true -> + ec_cmd_log:debug(rlx_state:log(State), "Disbaled resolving of OTP releases"), + {ok, []}; + false -> + ec_cmd_log:info(rlx_state:log(State), + fun() -> + ["Resolving available OTP Releases from directories:\n", + string:join([[rlx_util:indent(2), LibDir] || LibDir <- LibDirs], "\n")] + end), + resolve_rel_metadata(State, LibDirs, AppMeta) + end. -spec format_error([ErrorDetail::term()]) -> iolist(). format_error(ErrorDetails) diff --git a/test/rlx_discover_SUITE.erl b/test/rlx_discover_SUITE.erl index e75ea36..0fb1ad7 100644 --- a/test/rlx_discover_SUITE.erl +++ b/test/rlx_discover_SUITE.erl @@ -110,10 +110,12 @@ no_beam_case(Config) -> AppDir = filename:join([LibDir2, BadName]), write_app_file(AppDir, BadName, BadVsn), State0 = proplists:get_value(state, Config), - {DiscoverProvider, {ok, State1}} = rlx_provider:new(rlx_prv_discover, State0), + %% Deliberately disable release discovery when running `rlx_prv_discover` + State1 = rlx_state:put(State0, disable_rel_discovery, true), + {DiscoverProvider, {ok, State2}} = rlx_provider:new(rlx_prv_discover, State1), ?assertMatch({ok, _}, - rlx_provider:do(DiscoverProvider, State1)). + rlx_provider:do(DiscoverProvider, State2)). bad_ebin_case(Config) -> LibDir1 = proplists:get_value(lib1, Config), |