From c0a903bbf9b74df01fad71bbf9d267d1aa7cff4c Mon Sep 17 00:00:00 2001 From: alisdair sullivan Date: Tue, 20 Sep 2016 00:35:46 -0700 Subject: cover compile prior to calculating coverage fixes #1327 --- src/rebar_prv_cover.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/rebar_prv_cover.erl b/src/rebar_prv_cover.erl index 401c331..968a632 100644 --- a/src/rebar_prv_cover.erl +++ b/src/rebar_prv_cover.erl @@ -15,7 +15,7 @@ -include("rebar.hrl"). -define(PROVIDER, cover). --define(DEPS, [app_discovery]). +-define(DEPS, [compile]). %% =================================================================== %% Public API @@ -84,6 +84,11 @@ reset(State) -> {ok, State}. analyze(State) -> + %% modules have to be cover compiled in order for + %% cover data to be reloaded + %% this maybe breaks if modules have been deleted + %% since code coverage was collected? + ok = cover_compile(State, apps), ?INFO("Performing cover analysis...", []), %% figure out what coverdata we have CoverDir = cover_dir(State), -- cgit v1.1 From f653d4dffec599f0d488aef30430e9761fc8955b Mon Sep 17 00:00:00 2001 From: alisdair sullivan Date: Tue, 20 Sep 2016 00:47:16 -0700 Subject: only compile/cover compile when generating analysis don't compile when resetting coverdata --- src/rebar_prv_cover.erl | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/rebar_prv_cover.erl b/src/rebar_prv_cover.erl index 968a632..b62a796 100644 --- a/src/rebar_prv_cover.erl +++ b/src/rebar_prv_cover.erl @@ -15,7 +15,7 @@ -include("rebar.hrl"). -define(PROVIDER, cover). --define(DEPS, [compile]). +-define(DEPS, [lock]). %% =================================================================== %% Public API @@ -84,11 +84,20 @@ reset(State) -> {ok, State}. analyze(State) -> - %% modules have to be cover compiled in order for - %% cover data to be reloaded + %% modules have to be compiled and then cover compiled + %% in order for cover data to be reloaded %% this maybe breaks if modules have been deleted %% since code coverage was collected? - ok = cover_compile(State, apps), + case rebar_prv_compile:do(State) of + %% successfully compiled apps + {ok, S} -> + ok = cover_compile(S, apps), + do_analyze(State); + %% this should look like a compiler error, not a cover error + Error -> Error + end. + +do_analyze(State) -> ?INFO("Performing cover analysis...", []), %% figure out what coverdata we have CoverDir = cover_dir(State), -- cgit v1.1