Skip to content

Don't compile main sources in scoverage lifecycle when skip is set #340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/it/test_skip_configured/invoker.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invoker.goals=clean verify site -e -ntp
invoker.goals=clean scoverage:check site -e -ntp
6 changes: 6 additions & 0 deletions src/it/test_skip_configured/validate.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ try {
assert lines.contains("[INFO] Skipping Scoverage execution as configured")
assert !lines.contains("Generating \"SCoverage\" report")

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

return true

} catch (Throwable e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ public void execute() throws MojoExecutionException

Properties projectProperties = project.getProperties();

// for maven-compiler-plugin (compile), scala-maven-plugin (compile)
setProperty( projectProperties, "maven.main.skip", "true" );

// for maven-resources-plugin (testResources), maven-compiler-plugin (testCompile),
// scala-maven-plugin (testCompile), maven-surefire-plugin and scalatest-maven-plugin
setProperty( projectProperties, "maven.test.skip", "true" );
Expand Down