aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/dialyzer.mk
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-12-01 15:34:22 +0100
committerLoïc Hoguin <[email protected]>2015-12-01 15:34:22 +0100
commit5327c56922d43632ab55d77999d3930fd0f922a0 (patch)
tree7cbbcd86b7a62978769ed448f65a43cecc3e07d8 /plugins/dialyzer.mk
parent9703566b08e25e1cde3c1adeb7de3d3ba6241079 (diff)
downloaderlang.mk-5327c56922d43632ab55d77999d3930fd0f922a0.tar.gz
erlang.mk-5327c56922d43632ab55d77999d3930fd0f922a0.tar.bz2
erlang.mk-5327c56922d43632ab55d77999d3930fd0f922a0.zip
Test and document Dialyzer
One bug was fixed: now Erlang.mk will properly pass relevant ERLC_OPTS values to Dialyzer. One bug still exists when using multi-application repositories: dependencies are not detected automatically. We need list-deps before this can work.
Diffstat (limited to 'plugins/dialyzer.mk')
-rw-r--r--plugins/dialyzer.mk19
1 files changed, 15 insertions, 4 deletions
diff --git a/plugins/dialyzer.mk b/plugins/dialyzer.mk
index 709b43f..8c2710f 100644
--- a/plugins/dialyzer.mk
+++ b/plugins/dialyzer.mk
@@ -9,9 +9,8 @@ DIALYZER_PLT ?= $(CURDIR)/.$(PROJECT).plt
export DIALYZER_PLT
PLT_APPS ?=
-DIALYZER_DIRS ?= --src -r src
-DIALYZER_OPTS ?= -Werror_handling -Wrace_conditions \
- -Wunmatched_returns # -Wunderspecs
+DIALYZER_DIRS ?= --src -r $(wildcard src) $(ALL_APPS_DIRS)
+DIALYZER_OPTS ?= -Werror_handling -Wrace_conditions -Wunmatched_returns # -Wunderspecs
# Core targets.
@@ -27,6 +26,18 @@ help::
# Plugin-specific targets.
+define filter_opts.erl
+ Opts = binary:split(<<"$1">>, <<"-">>, [global]),
+ Filtered = lists:reverse(lists:foldl(fun
+ (O = <<"pa ", _/bits>>, Acc) -> [O|Acc];
+ (O = <<"D ", _/bits>>, Acc) -> [O|Acc];
+ (O = <<"I ", _/bits>>, Acc) -> [O|Acc];
+ (_, Acc) -> Acc
+ end, [], Opts)),
+ io:format("~s~n", [[["-", O] || O <- Filtered]]),
+ halt().
+endef
+
$(DIALYZER_PLT): deps app
$(verbose) dialyzer --build_plt --apps erts kernel stdlib $(PLT_APPS) $(OTP_DEPS) $(LOCAL_DEPS) $(DEPS)
@@ -40,4 +51,4 @@ dialyze:
else
dialyze: $(DIALYZER_PLT)
endif
- $(verbose) dialyzer --no_native $(DIALYZER_DIRS) $(DIALYZER_OPTS)
+ $(verbose) dialyzer --no_native `$(call erlang,$(call filter_opts.erl,$(ERLC_OPTS)))` $(DIALYZER_DIRS) $(DIALYZER_OPTS)