aboutsummaryrefslogtreecommitdiffstats
path: root/src/rlx_app_discovery.erl
diff options
context:
space:
mode:
authorTristan Sloughter <[email protected]>2013-09-28 11:56:32 -0500
committerTristan Sloughter <[email protected]>2013-09-28 16:26:00 -0500
commit3fc8e0408cd27e15fdfbd3711c6ab18140745c86 (patch)
treef18af1a207aa2964e49085081a6dcc4f06c2ac10 /src/rlx_app_discovery.erl
parent8a60327694646893729cde1708be4f507beceae0 (diff)
downloadrelx-3fc8e0408cd27e15fdfbd3711c6ab18140745c86.tar.gz
relx-3fc8e0408cd27e15fdfbd3711c6ab18140745c86.tar.bz2
relx-3fc8e0408cd27e15fdfbd3711c6ab18140745c86.zip
warn, not error, on bad app during discovery provider
Diffstat (limited to 'src/rlx_app_discovery.erl')
-rw-r--r--src/rlx_app_discovery.erl19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/rlx_app_discovery.erl b/src/rlx_app_discovery.erl
index 39f3921..cf0d1c6 100644
--- a/src/rlx_app_discovery.erl
+++ b/src/rlx_app_discovery.erl
@@ -39,8 +39,8 @@
do(State, LibDirs) ->
rlx_log:info(rlx_state:log(State),
fun() ->
- ["Resolving OTP Applications from directories:\n",
- [[rlx_util:indent(2), LibDir, "\n"] || LibDir <- LibDirs]]
+ ["Resolving OTP Applications from directories:\n",
+ string:join([[rlx_util:indent(2), LibDir] || LibDir <- LibDirs], "\n")]
end),
resolve_app_metadata(State, LibDirs).
@@ -62,6 +62,9 @@ resolve_app_metadata(State, LibDirs) ->
case Err of
{error, _} ->
true;
+ {warning, W} ->
+ rlx_log:warn(rlx_state:log(State), format_detail(W)),
+ false;
_ ->
false
end] of
@@ -79,6 +82,8 @@ resolve_app_metadata(State, LibDirs) ->
?RLX_ERROR(Errors)
end.
+app_name({warning, _}) ->
+ undefined;
app_name({error, _}) ->
undefined;
app_name({ok, AppMeta}) ->
@@ -103,7 +108,7 @@ resolve_override(AppName, FileName0) ->
end.
-spec format_detail(ErrorDetail::term()) -> iolist().
-format_detail({error, {missing_beam_file, Module, BeamFile}}) ->
+format_detail({missing_beam_file, Module, BeamFile}) ->
io_lib:format("Missing beam file ~p ~p", [Module, BeamFile]);
format_detail({error, {invalid_override, AppName, FileName}}) ->
io_lib:format("Override {~p, ~p} is not a valid OTP App. Perhaps you forgot to build it?",
@@ -161,9 +166,9 @@ gather_application_info(EbinDir, File) ->
{ok, [{application, AppName, AppDetail}]} ->
validate_application_info(EbinDir, File, AppName, AppDetail);
{error, Reason} ->
- {error, {unable_to_load_app, AppDir, Reason}};
+ {warning, {unable_to_load_app, AppDir, Reason}};
_ ->
- {error, {invalid_app_file, File}}
+ {warning, {invalid_app_file, File}}
end.
-spec validate_application_info(file:name(),
@@ -189,7 +194,7 @@ validate_application_info(EbinDir, AppFile, AppName, AppDetail) ->
get_modules_list(AppFile, AppDetail) ->
case proplists:get_value(modules, AppDetail) of
undefined ->
- {error, {invalid_app_file, AppFile}};
+ {warning, {invalid_app_file, AppFile}};
ModulesList ->
{ok, ModulesList}
end.
@@ -203,7 +208,7 @@ has_all_beams(EbinDir, [Module | ModuleList]) ->
true ->
has_all_beams(EbinDir, ModuleList);
false ->
- {error, {missing_beam_file, Module, BeamFile}}
+ {warning, {missing_beam_file, Module, BeamFile}}
end;
has_all_beams(_, []) ->
ok.