diff options
author | Vlad Ionescu <vlad@lshift.net> | 2009-09-22 16:41:50 +0100 |
---|---|---|
committer | Vlad Ionescu <vlad@lshift.net> | 2009-09-22 16:41:50 +0100 |
commit | c759aea4c0f1116714bf6aa14320d613acbb4a09 (patch) | |
tree | 4c5a5fb1c6ffc89e24e72acef3695b46ba6658ce | |
parent | f3118f859589ddbe741e04d9ad994cd7b36fa623 (diff) | |
download | rabbitmq-server-c759aea4c0f1116714bf6aa14320d613acbb4a09.tar.gz |
getting rid of the .last_valid_dialysis approach; better erlang termination on failed dialysis
-rw-r--r-- | .hgignore | 1 | ||||
-rw-r--r-- | Makefile | 28 | ||||
-rw-r--r-- | src/rabbit_dialyzer.erl | 16 |
3 files changed, 21 insertions, 24 deletions
@@ -12,7 +12,6 @@ syntax: regexp ^src/rabbit_framing.erl$ ^rabbit.plt$ ^basic.plt$ -^\.last_valid_dialysis$ ^ebin/rabbit.app$ ^ebin/rabbit.rel$ ^ebin/rabbit.boot$ @@ -19,7 +19,7 @@ MANPAGES=$(patsubst %.pod, %.gz, $(wildcard docs/*.[0-9].pod)) PYTHON=python BASIC_PLT=basic.plt -PLT=rabbit.plt +RABBIT_PLT=rabbit.plt ifndef USE_SPECS # our type specs rely on features / bug fixes in dialyzer that are @@ -65,31 +65,23 @@ $(SOURCE_DIR)/rabbit_framing.erl: codegen.py $(AMQP_CODEGEN_DIR)/amqp_codegen.py $(EBIN_DIR)/rabbit.boot $(EBIN_DIR)/rabbit.script: $(EBIN_DIR)/rabbit.app $(EBIN_DIR)/rabbit.rel $(TARGETS) erl -noshell -eval 'systools:make_script("ebin/rabbit", [{path, ["ebin"]}]), halt().' -dialyze: .last_valid_dialysis - -create-plt: $(PLT) - -$(PLT): $(BEAM_TARGETS) $(BASIC_PLT) - test -f $@ || cp $(BASIC_PLT) $@ +dialyze: $(BEAM_TARGETS) $(BASIC_PLT) $(ERL_EBIN) -eval \ - "rabbit_dialyzer:update_plt(\"$@\", \"$(BEAM_TARGETS)\"), halt()." + "rabbit_dialyzer:halt_with_code(rabbit_dialyzer:dialyze_files(\"$(BASIC_PLT)\", \"$(BEAM_TARGETS)\"))." -.last_valid_dialysis: $(BEAM_TARGETS) $(PLT) - if [ $(PLT) -ot $@ ]; then \ - DIALYZER_INPUT_FILES="$(filter %.beam, $?)"; \ - else \ - DIALYZER_INPUT_FILES="$(BEAM_TARGETS)"; \ - fi; \ +create-plt: $(RABBIT_PLT) + +$(RABBIT_PLT): $(BEAM_TARGETS) $(BASIC_PLT) + cp $(BASIC_PLT) $@ $(ERL_EBIN) -eval \ - "rabbit_dialyzer:dialyze_files(\"$(PLT)\", \"$$DIALYZER_INPUT_FILES\"), halt()." && \ - touch $@ + "rabbit_dialyzer:halt_with_code(rabbit_dialyzer:add_to_plt(\"$@\", \"$(BEAM_TARGETS)\"))." $(BASIC_PLT): $(BEAM_TARGETS) if [ -f $@ ]; then \ touch $@; \ else \ $(ERL_EBIN) -eval \ - "rabbit_dialyzer:create_basic_plt(\"$@\"), halt()."; \ + "rabbit_dialyzer:halt_with_code(rabbit_dialyzer:create_basic_plt(\"$@\"))."; \ fi clean: @@ -97,7 +89,7 @@ clean: rm -f $(EBIN_DIR)/rabbit.app $(EBIN_DIR)/rabbit.boot $(EBIN_DIR)/rabbit.script rm -f $(INCLUDE_DIR)/rabbit_framing.hrl $(SOURCE_DIR)/rabbit_framing.erl codegen.pyc rm -f docs/*.[0-9].gz - rm -f $(PLT) .last_valid_dialysis + rm -f $(RABBIT_PLT) cleandb: rm -rf $(RABBITMQ_MNESIA_DIR)/* diff --git a/src/rabbit_dialyzer.erl b/src/rabbit_dialyzer.erl index 4d78adbe..c75a001b 100644 --- a/src/rabbit_dialyzer.erl +++ b/src/rabbit_dialyzer.erl @@ -32,15 +32,16 @@ -module(rabbit_dialyzer). -include("rabbit.hrl"). --export([create_basic_plt/1, update_plt/2, dialyze_files/2]). +-export([create_basic_plt/1, add_to_plt/2, dialyze_files/2, halt_with_code/1]). %%---------------------------------------------------------------------------- -ifdef(use_specs). -spec(create_basic_plt/1 :: (string()) -> 'ok'). --spec(update_plt/2 :: (string(), string()) -> 'ok'). +-spec(add_to_plt/2 :: (string(), string()) -> 'ok'). -spec(dialyze_files/2 :: (string(), string()) -> 'ok'). +-spec(halt_with_code/1 :: (atom()) -> no_return()). -endif. @@ -54,8 +55,8 @@ create_basic_plt(BasicPltPath) -> dialyzer_cl:start(OptsRecord), ok. -update_plt(PltPath, ModifiedFiles) -> - {ok, Files} = regexp:split(ModifiedFiles, " "), +add_to_plt(PltPath, FilesString) -> + {ok, Files} = regexp:split(FilesString, " "), DialyzerWarnings = dialyzer:run([ {analysis_type, plt_add}, {init_plt, PltPath}, @@ -76,7 +77,7 @@ dialyze_files(PltPath, ModifiedFiles) -> _ -> io:format("~nFAILED! dialyzer returned the following warnings:~n", []), print_warnings(DialyzerWarnings), - erlang:error({dialyzer_warnings, DialyzerWarnings}) + fail end. print_warnings(DialyzerWarnings) -> @@ -91,3 +92,8 @@ print_warnings(DialyzerWarnings) -> otp_apps_dependencies_paths() -> [code:lib_dir(App, ebin) || App <- [stdlib, kernel, mnesia, os_mon, ssl, eunit, tools, sasl]]. + +halt_with_code(ok) -> + halt(); +halt_with_code(fail) -> + halt(1). |