Skip to content

Commit

Permalink
Dialyzerized.
Browse files Browse the repository at this point in the history
  • Loading branch information
Licenser committed Dec 2, 2012
1 parent 26faa0b commit 5e83ea6
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 43 deletions.
92 changes: 55 additions & 37 deletions Makefile
@@ -1,48 +1,66 @@
APP_NAME=libhowl
APP_DIR=.
OBJ=$(shell ls $(APP_DIR)/src/*.erl | sed -e 's/\.erl$$/.beam/' | sed -e 's;^$(APP_DIR)/src;$(APP_DIR)/ebin;g') $(shell ls $(APP_DIR)/src/*.app.src | sed -e 's/\.src$$//g' | sed -e 's;^$(APP_DIR)/src;$(APP_DIR)/ebin;g')
DEPS=$(shell cat rebar.config |sed -e 's/%.*//'| sed -e '/{\(\w\+\), [^,]\+, {\w\+, [^,]\+, {[^,]\+, [^}]\+}}},\?/!d' | sed -e 's;{\(\w\+\), [^,]\+, {\w\+, [^,]\+, {[^,]\+, [^}]\+}}},\?;deps/\1/rebar.config;')
ERL=erl
PA=$(shell pwd)/$(APP_DIR)/ebin
ERL_LIBS=`pwd`/deps/
REBAR=./rebar
REBAR = $(shell pwd)/rebar

all: $(DEPS) $(OBJ)
.PHONY: deps rel package

test:
echo $(DEPS)
echo $(OBJ)
all: deps compile

doc: FORCE
$(REBAR) doc
clean: FORCE
$(REBAR) clean
-rm *.beam erl_crash.dump
-rm -r rel/$(APP_NAME)
-rm rel/$(APP_NAME).tar.bz2
compile:
$(REBAR) compile

$(DEPS):
deps:
$(REBAR) get-deps
$(REBAR) compile

$(APP_DIR)/ebin/%.app: $(APP_DIR)/src/%.app.src
$(REBAR) compile
clean:
$(REBAR) clean

$(APP_DIR)/ebin/%.beam: $(APP_DIR)/src/%.erl
$(REBAR) compile
distclean: clean
$(REBAR) delete-deps

test:
$(REBAR) skip_deps=true eunit

###
### Docs
###
docs:
$(REBAR) skip_deps=true doc

##
## Developer targets
##

xref:
$(REBAR) xref skip_deps=true


##
## Dialyzer
##
APPS = kernel stdlib sasl erts ssl tools os_mon runtime_tools crypto inets \
xmerl webtool snmp public_key mnesia eunit syntax_tools compiler
COMBO_PLT = $(HOME)/.libhowl_combo_dialyzer_plt

check_plt: deps compile
dialyzer --check_plt --plt $(COMBO_PLT) --apps $(APPS) \
deps/*/ebin ebin

shell: all
ERL_LIBS="$(ERL_LIBS)" $(ERL) -pa $(PA) deps/*/ebin -s libhowl
[ -f *.beam ] && rm *.beam || true
[ -f erl_crash.dump ] && rm erl_crash.dump || true
build_plt: deps compile
dialyzer --build_plt --output_plt $(COMBO_PLT) --apps $(APPS) \
deps/*/ebin ebin

remove_trash:
-find . -name "*~" -exec rm {} \;.
-rm *.beam erl_crash.dump
FORCE:
dialyzer: deps 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 -Wno_return --plt $(COMBO_PLT) deps/*/ebin ebin | grep -v -f dialyzer.mittigate

clean-docs:
-rm doc/*.html doc/*.png doc/*.css doc/edoc-info

docs: clean-docs
@$(REBAR) doc skip_deps=true
cleanplt:
@echo
@echo "Are you sure? It takes about 1/2 hour to re-build."
@echo Deleting $(COMBO_PLT) in 5 seconds.
@echo
sleep 5
rm $(COMBO_PLT)
4 changes: 4 additions & 0 deletions dialyzer.mittigate
@@ -0,0 +1,4 @@
^lager_stdlib.erl:453:
^lager_stdlib.erl:502:
^lager_trunc_io.erl:74:
^lager_trunc_io.erl:98:
1 change: 1 addition & 0 deletions rebar.config
Expand Up @@ -3,5 +3,6 @@
{deps,
[
{mdns_client_lib, ".*", {git, "https://github.com/Licenser/mdns_client_lib.git", {branch, master}}},
{fifo_spec, ".*", {git, "https://github.com/project-fifo/fifo_spec.git", {branch, master}}},
{lager, ".*", {git, "git://github.com/basho/lager.git", {tag, "1.0.0"}}}
]}.
9 changes: 3 additions & 6 deletions src/libhowl.erl
@@ -1,7 +1,7 @@
-module(libhowl).

-export([
start/0,
start/0,
servers/0
]).

Expand Down Expand Up @@ -43,10 +43,7 @@ servers() ->
%% @end
%%--------------------------------------------------------------------

-spec send(Channel::term(), Message::term()) ->
{ok, Token::{token, binary()}} |
{error, not_found}.

-spec send(Channel::term(), Message::term()) -> ok.
send(Channel, Message) ->
send({msg, Channel, Message}).

Expand All @@ -61,6 +58,6 @@ send(Channel, Message) ->
%% @end
%%--------------------------------------------------------------------

-spec send(Msg::term()) -> {ok, Reply::term()} | {error, no_server}.
-spec send(Msg::term()) -> ok.
send(Msg) ->
libhowl_server:cast(Msg).

0 comments on commit 5e83ea6

Please sign in to comment.