From 5451df8416d89c42c30fd4d72eb0654cccbeff7f Mon Sep 17 00:00:00 2001 From: Euen Date: Tue, 17 Mar 2015 18:45:32 -0300 Subject: add as a plugin --- build.config | 1 + erlang.mk | 39 +++++++++++++++++++++++++++++++++++++++ plugins/xref.mk | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 plugins/xref.mk diff --git a/build.config b/build.config index 7e60d80..7b75a8f 100644 --- a/build.config +++ b/build.config @@ -22,3 +22,4 @@ plugins/eunit plugins/relx plugins/shell plugins/triq +plugins/xref \ No newline at end of file diff --git a/erlang.mk b/erlang.mk index e6833bc..22d925b 100644 --- a/erlang.mk +++ b/erlang.mk @@ -1273,3 +1273,42 @@ triq: test-build $(gen_verbose) $(call triq_run,[true] =:= lists:usort([triq:check(M) || M <- [$(MODULES)]])) endif endif + +# Copyright (c) 2015, Euen Lopez +# This file is part of erlang.mk and subject to the terms of the ISC License. + +.PHONY: xref distclean-xref + +# Configuration. + +ifeq ($(XREF_CONFIG),) + XREF_ARGS := +else + XREF_ARGS := -c $(XREF_CONFIG) +endif + +XREFR ?= $(CURDIR)/xrefr +export XREFR + +XREFR_URL ?= https://github.com/inaka/xref_runner/releases/download/0.2.0/xrefr + +# Core targets. + +help:: + @printf "%s\n" "" \ + "Xref targets:" \ + " xref Run Xrefr using $XREF_CONFIG as config file if defined" + +distclean:: distclean-xref + +# Plugin-specific targets. + +$(XREFR): + @$(call core_http_get,$(XREFR),$(XREFR_URL)) + @chmod +x $(XREFR) + +xref: deps app $(XREFR) + $(gen_verbose) $(XREFR) $(XREFR_ARGS) + +distclean-xref: + $(gen_verbose) rm -rf $(XREFR) diff --git a/plugins/xref.mk b/plugins/xref.mk new file mode 100644 index 0000000..14ef16e --- /dev/null +++ b/plugins/xref.mk @@ -0,0 +1,38 @@ +# Copyright (c) 2015, Euen Lopez +# This file is part of erlang.mk and subject to the terms of the ISC License. + +.PHONY: xref distclean-xref + +# Configuration. + +ifeq ($(XREF_CONFIG),) + XREF_ARGS := +else + XREF_ARGS := -c $(XREF_CONFIG) +endif + +XREFR ?= $(CURDIR)/xrefr +export XREFR + +XREFR_URL ?= https://github.com/inaka/xref_runner/releases/download/0.2.0/xrefr + +# Core targets. + +help:: + @printf "%s\n" "" \ + "Xref targets:" \ + " xref Run Xrefr using $XREF_CONFIG as config file if defined" + +distclean:: distclean-xref + +# Plugin-specific targets. + +$(XREFR): + @$(call core_http_get,$(XREFR),$(XREFR_URL)) + @chmod +x $(XREFR) + +xref: deps app $(XREFR) + $(gen_verbose) $(XREFR) $(XREFR_ARGS) + +distclean-xref: + $(gen_verbose) rm -rf $(XREFR) \ No newline at end of file -- cgit v1.2.3 From 1a1915f8caab06860a8d14d17c184128dfea9acc Mon Sep 17 00:00:00 2001 From: Euen Date: Wed, 18 Mar 2015 12:30:09 -0300 Subject: update README.md --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 1d7fbeb..cb412ac 100644 --- a/README.md +++ b/README.md @@ -538,6 +538,19 @@ Or: $ make triq t=cow_http_hd:prop_parse_accept ``` +Xref plugin +------------ + +This plugin is available by default. It adds the following +target: + +`xref` Erlang Xref Runner (inspired in rebar's rebar_xref) + +The `XREF_CONFIG` variable specifies the location of the +configuration file which holds the checks to be applied. +If there is no `xref.config` all `xref` checks will be +applied to the binaries located in the `/ebin` directory. + Contributing ------------ -- cgit v1.2.3