chore(bpapicheck): make some failures more user-friendly

This commit is contained in:
Andrew Mayorov 2023-10-13 15:42:08 +07:00
parent 0b9ac24c1e
commit 083e2da347
No known key found for this signature in database
GPG Key ID: 2837C62ACFBFED5D
1 changed files with 17 additions and 8 deletions

View File

@ -244,19 +244,28 @@ get_param_types(Signatures, {M, F, A}) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dump() ->
case
{
filelib:wildcard(project_root_dir() ++ "/*_plt"),
filelib:wildcard(project_root_dir() ++ "/_build/check/lib")
}
of
RootDir = project_root_dir(),
TryRelDir = RootDir ++ "/_build/check/lib",
case {filelib:wildcard(RootDir ++ "/*_plt"), filelib:wildcard(TryRelDir)} of
{[PLT | _], [RelDir | _]} ->
dump(#{
plt => PLT,
reldir => RelDir
});
_ ->
error("failed to guess run options")
{[], _} ->
logger:error(
"No usable PLT files found in \"~s\", abort ~n"
"Try running `rebar3 as check dialyzer` at least once first",
[RootDir]
),
error(run_failed);
{_, []} ->
logger:error(
"No built applications found in \"~s\", abort ~n"
"Try running `rebar3 as check compile` at least once first",
[TryRelDir]
),
error(run_failed)
end.
%% Collect the local BPAPI modules to a dump file