Browse Source

Merge branch 'xref_plugin' of https://github.com/inaka/erlang.mk

Loïc Hoguin 10 years ago
parent
commit
6df73b9e51
4 changed files with 91 additions and 0 deletions
  1. 13 0
      README.md
  2. 1 0
      build.config
  3. 39 0
      erlang.mk
  4. 38 0
      plugins/xref.mk

+ 13 - 0
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
 ------------
 

+ 1 - 0
build.config

@@ -22,3 +22,4 @@ plugins/eunit
 plugins/relx
 plugins/shell
 plugins/triq
+plugins/xref

+ 39 - 0
erlang.mk

@@ -1275,3 +1275,42 @@ triq: test-build
 	$(gen_verbose) $(call triq_run,[true] =:= lists:usort([triq:check(M) || M <- [$(MODULES)]]))
 endif
 endif
+
+# Copyright (c) 2015, Euen Lopez <euen@inakanetworks.com>
+# 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)

+ 38 - 0
plugins/xref.mk

@@ -0,0 +1,38 @@
+# Copyright (c) 2015, Euen Lopez <euen@inakanetworks.com>
+# 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)