zx/zomp/lib/otpr/zx/0.13.5/make_zx
Craig Everett 5069ebe3b8 Catch IPv4-only failure case
A eafnosupport error is returned if IPv4 is not supported at all,
but eaddrnotavail can also be returned if the system is not configured
to allow listening at 0::1.
2024-03-21 10:54:24 +09:00

45 lines
1018 B
Erlang
Executable File

#! /usr/bin/env escript
-mode(compile).
main(Args) ->
true = code:add_patha("ebin"),
case make:all() of
up_to_date ->
lists:foreach(fun dispatch/1, Args),
halt(0);
error ->
ok = io:format("Build error. Halting.~n"),
halt(1)
end.
dispatch("edoc") ->
ok = edoc();
dispatch("dialyze") ->
ok = dialyze();
dispatch("test") ->
ok = test();
dispatch(Unknown) ->
ok = io:format("make_zx: Unknown directive: ~tp~n", [Unknown]),
halt(1).
edoc() ->
ok = io:format("EDOC: Writing docs...~n"),
edoc:application(zx, ".", []).
dialyze() ->
case dialyzer:run([{from, src_code}, {files_rec, ["./src"]}]) of
[] ->
io:format("Dialyzer found no errors and returned no warnings! Yay!~n");
Warnings ->
Messages = [dialyzer:format_warning(W) || W <- Warnings],
lists:foreach(fun io:format/1, Messages)
end.
test() ->
io:format("TEST: If I only had a brain.~n").