Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Rework how dialyzer PLTs are built and used #187

Merged
merged 3 commits into from

2 participants

@Vagabond
Collaborator

This commit splits the PLTs into 2, one for all the required OTP
applications that are in the stdlib, and the other for the rebar
dependancies. Each one is created if it does not exist, then checked for
validity and then --add_to_plt is used to add any missing files (this is
very fast if nothing needs to be added). Then the application is
dialyzed using both PLTs.

The 'combo' PLT which resides in ~ is intended to be used by all of
Riak's deps, so it can grow to cover the set of OTP applications that
Riak depends on. Each project can only specify the ones it cares about.

Makefile
@@ -23,23 +23,29 @@ test:
docs:
./rebar doc
-APPS = kernel stdlib sasl erts ssl tools os_mon runtime_tools crypto inets \
- xmerl webtool snmp public_key mnesia eunit
+APPS = kernel stdlib erts sasl eunit syntax_tools compiler crypto
COMBO_PLT = $(HOME)/.riak_combo_dialyzer_plt

Even with this change, I think it'd be useful to be able to override the COMBO_PLT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Makefile
((7 lines not shown))
COMBO_PLT = $(HOME)/.riak_combo_dialyzer_plt
-
-check_plt: compile
- dialyzer --check_plt --plt $(COMBO_PLT) --apps $(APPS)
-
-build_plt: compile
- dialyzer --build_plt --output_plt $(COMBO_PLT) --apps $(APPS)
-
-dialyzer: compile
- @echo
- @echo Use "'make check_plt'" to check PLT prior to using this target.
- @echo Use "'make build_plt'" to build PLT prior to using this target.
- @echo
- @sleep 1
- dialyzer -Wunmatched_returns --plt $(COMBO_PLT) ebin | \
+LOCAL_PLT = .lager_combo_dialyzer_plt

Can't see any reason this one would need to be overridden though, unless someone is making a new checkout of lager for every branch, or something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Vagabond added some commits
@Vagabond Vagabond Rework how dialyzer PLTs are built and used
This commit splits the PLTs into 2, one for all the required OTP
applications that are in the stdlib, and the other for the rebar
dependancies. Each one is created if it does not exist, then checked for
validity and then --add_to_plt is used to add any missing files (this is
very fast if nothing needs to be added). Then the application is
dialyzed using both PLTs.

The 'combo' PLT which resides in ~ is intended to be used by all of
Riak's deps, so it can grow to cover the set of OTP applications that
Riak depends on. Each project can only specify the ones it cares about.
c41ec3e
@Vagabond Vagabond Add plt to gitignore 56a217c
@Vagabond Vagabond Refactor into tools.mk 58bf043
@reiddraper

Nice work, +1

@Vagabond Vagabond merged commit d65b91a into master
@seancribbs seancribbs deleted the adt-dialyzer-mad-science branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 14, 2014
  1. @Vagabond

    Rework how dialyzer PLTs are built and used

    Vagabond authored
    This commit splits the PLTs into 2, one for all the required OTP
    applications that are in the stdlib, and the other for the rebar
    dependancies. Each one is created if it does not exist, then checked for
    validity and then --add_to_plt is used to add any missing files (this is
    very fast if nothing needs to be added). Then the application is
    dialyzed using both PLTs.
    
    The 'combo' PLT which resides in ~ is intended to be used by all of
    Riak's deps, so it can grow to cover the set of OTP applications that
    Riak depends on. Each project can only specify the ones it cares about.
  2. @Vagabond

    Add plt to gitignore

    Vagabond authored
  3. @Vagabond

    Refactor into tools.mk

    Vagabond authored
This page is out of date. Refresh to see the latest.
Showing with 42 additions and 35 deletions.
  1. +1 −0  .gitignore
  2. +2 −35 Makefile
  3. +39 −0 tools.mk
View
1  .gitignore
@@ -7,3 +7,4 @@ erl_crash.dump
.project
log
deps
+.local_dialyzer_plt
View
37 Makefile
@@ -15,39 +15,6 @@ clean:
distclean: clean
./rebar delete-deps
-test:
- ./rebar compile eunit
-
-##
-## Doc targets
-##
-docs:
- ./rebar doc
-
-APPS = kernel stdlib sasl erts ssl tools os_mon runtime_tools crypto inets \
- xmerl webtool snmp public_key mnesia eunit
-PLT ?= $(HOME)/.riak_combo_dialyzer_plt
-
-check_plt: compile
- dialyzer --check_plt --plt $(PLT) --apps $(APPS)
-
-build_plt: compile
- dialyzer --build_plt --output_plt $(PLT) --apps $(APPS)
-
-dialyzer: compile
- @echo
- @echo Use "'make check_plt'" to check PLT prior to using this target.
- @echo Use "'make build_plt'" to build PLT prior to using this target.
- @echo
- @sleep 1
- dialyzer -Wunmatched_returns --plt $(PLT) ebin | \
- fgrep -v -f ./dialyzer.ignore-warnings
-
-cleanplt:
- @echo
- @echo "Are you sure? It takes about 1/2 hour to re-build."
- @echo Deleting $(PLT) in 5 seconds.
- @echo
- sleep 5
- rm $(PLT)
+DIALYZER_APPS = kernel stdlib erts sasl eunit syntax_tools compiler crypto
+include tools.mk
View
39 tools.mk
@@ -0,0 +1,39 @@
+test: compile
+ ./rebar eunit skip_deps=true
+
+docs:
+ ./rebar doc skip_deps=true
+
+PLT ?= $(HOME)/.riak_combo_dialyzer_plt
+LOCAL_PLT = .local_dialyzer_plt
+DIALYZER_FLAGS ?= -Wunmatched_returns
+
+${PLT}: compile
+ifneq (,$(wildcard $(PLT)))
+ dialyzer --check_plt --plt $(PLT) --apps $(DIALYZER_APPS) && \
+ dialyzer --add_to_plt --plt $(PLT) --output_plt $(PLT) --apps $(DIALYZER_APPS) ; test $$? -ne 1
+else
+ dialyzer --build_plt --output_plt $(PLT) --apps $(DIALYZER_APPS); test $$? -ne 1
+endif
+
+${LOCAL_PLT}: compile
+ifneq (,$(wildcard $(LOCAL_PLT)))
+ dialyzer --check_plt --plt $(LOCAL_PLT) deps/*/ebin && \
+ dialyzer --add_to_plt --plt $(LOCAL_PLT) --output_plt $(LOCAL_PLT) deps/*/ebin ; test $$? -ne 1
+else
+ dialyzer --build_plt --output_plt $(LOCAL_PLT) deps/*/ebin ; test $$? -ne 1
+endif
+
+dialyzer: ${PLT} ${LOCAL_PLT}
+ @echo "==> $(shell basename $(shell pwd)) (dialyzer)"
+ dialyzer $(DIALYZER_FLAGS) --plts $(PLT) $(LOCAL_PLT) -c ebin
+
+cleanplt:
+ @echo
+ @echo "Are you sure? It takes several minutes to re-build."
+ @echo Deleting $(PLT) and $(LOCAL_PLT) in 5 seconds.
+ @echo
+ sleep 5
+ rm $(PLT)
+ rm $(LOCAL_PLT)
+
Something went wrong with that request. Please try again.