diff options
author | Loïc Hoguin <[email protected]> | 2018-12-07 11:22:50 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-12-07 11:22:50 +0100 |
commit | bac26c547c9398968780b2c18c4740af322e55fe (patch) | |
tree | 0d8d52836136339b3cfbc85c3324f8e3a261c24e /plugins/cover.mk | |
parent | 754bad09421c70034242f4370c633e177a869151 (diff) | |
download | erlang.mk-bac26c547c9398968780b2c18c4740af322e55fe.tar.gz erlang.mk-bac26c547c9398968780b2c18c4740af322e55fe.tar.bz2 erlang.mk-bac26c547c9398968780b2c18c4740af322e55fe.zip |
Add COVER_APPS and COVER_DEPS to cover compile other apps/deps
By default COVER_APPS will cover compile all apps. COVER_DEPS
will not cover compile any dependency by default, however.
Diffstat (limited to 'plugins/cover.mk')
-rw-r--r-- | plugins/cover.mk | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/plugins/cover.mk b/plugins/cover.mk index 6fd8829..04ea657 100644 --- a/plugins/cover.mk +++ b/plugins/cover.mk @@ -5,6 +5,11 @@ COVER_REPORT_DIR ?= cover COVER_DATA_DIR ?= $(COVER_REPORT_DIR) +ifdef COVER +COVER_APPS ?= $(notdir $(ALL_APPS_DIRS)) +COVER_DEPS ?= +endif + # Code coverage for Common Test. ifdef COVER @@ -15,6 +20,9 @@ test-build:: $(TEST_DIR)/ct.cover.spec $(TEST_DIR)/ct.cover.spec: cover-data-dir $(gen_verbose) printf "%s\n" \ "{incl_app, '$(PROJECT)', details}." \ + "{incl_dirs, '$(PROJECT)', [\"$(CURDIR)/ebin\" \ + $(foreach a,$(COVER_APPS),$(comma) \"$(APPS_DIR)/$a/ebin\") \ + $(foreach d,$(COVER_DEPS),$(comma) \"$(DEPS_DIR)/$d/ebin\")]}." \ '{export,"$(abspath $(COVER_DATA_DIR))/ct.coverdata"}.' > $@ CT_RUN += -cover $(TEST_DIR)/ct.cover.spec @@ -27,14 +35,19 @@ endif ifdef COVER define cover.erl CoverSetup = fun() -> - case filelib:is_dir("ebin") of - false -> false; - true -> - case cover:compile_beam_directory("ebin") of - {error, _} -> halt(1); - _ -> true - end - end + Dirs = ["$(CURDIR)/ebin" + $(foreach a,$(COVER_APPS),$(comma) "$(APPS_DIR)/$a/ebin") + $(foreach d,$(COVER_DEPS),$(comma) "$(DEPS_DIR)/$d/ebin")], + [begin + case filelib:is_dir(Dir) of + false -> false; + true -> + case cover:compile_beam_directory(Dir) of + {error, _} -> halt(1); + _ -> true + end + end + end || Dir <- Dirs] end, CoverExport = fun(Filename) -> cover:export(Filename) end, endef |