zx/zmake
2017-12-18 13:29:06 +09:00

49 lines
1017 B
Erlang
Executable File

#! /usr/bin/env escript
-mode(compile).
main(Args) ->
ok = make(),
ok = lists:foreach(fun dispatch/1, Args),
halt(0).
dispatch("edoc") ->
ok = edoc();
dispatch("dialyze") ->
ok = dialyze();
dispatch("test") ->
ok = test();
dispatch(Unknown) ->
ok = io:format("zmake: Unknown directive: ~tp~n", [Unknown]),
halt(1).
make() ->
true = code:add_patha("ebin"),
up_to_date = make:all(),
halt(0).
edoc() ->
ok = io:format("EDOC: Writing docs...~n"),
ok = edoc:application(zomp, ".", []),
halt(0).
dialyze() ->
ok =
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,
halt(0).
test() ->
ok = io:format("TEST: If I only had a brain.~n"),
halt(0).