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() -> dump() ->
case RootDir = project_root_dir(),
{ TryRelDir = RootDir ++ "/_build/check/lib",
filelib:wildcard(project_root_dir() ++ "/*_plt"), case {filelib:wildcard(RootDir ++ "/*_plt"), filelib:wildcard(TryRelDir)} of
filelib:wildcard(project_root_dir() ++ "/_build/check/lib")
}
of
{[PLT | _], [RelDir | _]} -> {[PLT | _], [RelDir | _]} ->
dump(#{ dump(#{
plt => PLT, plt => PLT,
reldir => RelDir 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. end.
%% Collect the local BPAPI modules to a dump file %% Collect the local BPAPI modules to a dump file