Skip to content

Commit 4912e47

Browse files
committed
Don't compile main sources in scoverage lifecycle when skip is set
1 parent fa5fda8 commit 4912e47

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
invoker.goals=clean verify site -e -ntp
1+
invoker.goals=clean scoverage:check site -e -ntp

src/it/test_skip_configured/validate.groovy

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ try {
55
assert lines.contains("[INFO] Skipping Scoverage execution as configured")
66
assert !lines.contains("Generating \"SCoverage\" report")
77

8+
// let's check main code is also not compiled
9+
def scalaMainSourcesCompilerInfoIndex = lines.findIndexOf { it ==~ /.*:compile \(default-sbt-compile\).*/ } + 1
10+
def scalaMainSourcesCompilerInfo = lines.get(scalaMainSourcesCompilerInfoIndex)
11+
def expectedInfo = "[INFO] Not compiling main sources"
12+
assert scalaMainSourcesCompilerInfo.contains(expectedInfo) : "Expected '$expectedInfo' but got: '$scalaMainSourcesCompilerInfo'"
13+
814
return true
915

1016
} catch (Throwable e) {

src/main/java/org/scoverage/plugin/SCoveragePreCompileMojo.java

+3
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ public void execute() throws MojoExecutionException
201201

202202
Properties projectProperties = project.getProperties();
203203

204+
// for maven-compiler-plugin (compile), scala-maven-plugin (compile)
205+
setProperty( projectProperties, "maven.main.skip", "true" );
206+
204207
// for maven-resources-plugin (testResources), maven-compiler-plugin (testCompile),
205208
// scala-maven-plugin (testCompile), maven-surefire-plugin and scalatest-maven-plugin
206209
setProperty( projectProperties, "maven.test.skip", "true" );

0 commit comments

Comments
 (0)