Skip to content

upgrade to scoverage 1.4.2 (dropping support for 2.11 as it is gone u… #146

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 2 commits into from
Nov 17, 2020
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
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ You can find instructions on how to apply the plugin at http://plugins.gradle.or
The plugin exposes multiple options that can be configured by setting them in an `scoverage` block within the project's
build script. These options are as follows:

* `scoverageVersion = <String>` (default `"1.4.1"`): The version of the scoverage scalac plugin. This (gradle) plugin
* `scoverageVersion = <String>` (default `"1.4.2`): The version of the scoverage scalac plugin. This (gradle) plugin
should be compatible with all 1+ versions.

* `scoverageScalaVersion = <String>` (default `"2.12"`): The scala version of the scoverage scalac plugin. This
* `scoverageScalaVersion = <String>` (default `detected`): The scala version of the scoverage scalac plugin. This
overrides the version of the `scala-library` compile dependency (if the dependency is configured).

* `coverageOutputCobertura = <boolean>` (default `true`): Enables/disables cobertura.xml file generation (for both aggregated and non-aggregated reports).
Expand Down Expand Up @@ -122,6 +122,13 @@ In order for the plugin to work alongside [Palantir's consistent versions plugin
the Scala version must be manually configured (via `scoverageScalaVersion`); otherwise, the plugin will attempt to
resolve the compilation classpath, which is prohibited by the versions plugin.

Migration to 5.x
----------------

* Requires scoverage 1.4.2 or higher (and uses this version by default)
* Adds support for Scala 2.13
* Drops support for Scala 2.11

Migration to 4.x
----------------

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ targetCompatibility = '1.8'


dependencies {
compileOnly "org.scoverage:scalac-scoverage-plugin_2.12:1.4.1"
compileOnly "org.scoverage:scalac-scoverage-plugin_2.13:1.4.2"
implementation group: 'commons-io', name: 'commons-io', version: '2.6'

testImplementation 'junit:junit:4.12'
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
package org.scoverage;

import org.junit.Ignore;

/**
* Tests is currently ignored as support for Scala 2.13 is not available yet.
*
* @see <a href="https://github.com/scoverage/gradle-scoverage/issues/106">Issue #106</a>.
*/
@Ignore
public class Scala213Test extends ScalaVersionTest {
public Scala213Test() {
super("2_13");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ public void checkAndAggregateAll() throws Exception {
ScoveragePlugin.getAGGREGATE_NAME());

result.assertTaskSkipped(ScoveragePlugin.getREPORT_NAME());
result.assertTaskSucceeded("2_11:" + ScoveragePlugin.getREPORT_NAME());
result.assertTaskSucceeded("2_12:" + ScoveragePlugin.getREPORT_NAME());
result.assertTaskSucceeded("2_13:" + ScoveragePlugin.getREPORT_NAME());
result.assertTaskSucceeded(ScoveragePlugin.getCHECK_NAME());
result.assertTaskSucceeded("2_11:" + ScoveragePlugin.getCHECK_NAME());
result.assertTaskSucceeded("2_12:" + ScoveragePlugin.getCHECK_NAME());
result.assertTaskSucceeded("2_13:" + ScoveragePlugin.getCHECK_NAME());
result.assertTaskSucceeded(ScoveragePlugin.getAGGREGATE_NAME());
Expand All @@ -39,7 +37,6 @@ public void checkAndAggregateAll() throws Exception {
private void assertAggregationFilesExist() {

Assert.assertTrue(resolve(reportDir(), "index.html").exists());
Assert.assertTrue(resolve(reportDir(), "2_11/src/main/scala/org/hello/World2_11.scala.html").exists());
Assert.assertTrue(resolve(reportDir(), "2_12/src/main/scala/org/hello/World2_12.scala.html").exists());
Assert.assertTrue(resolve(reportDir(), "2_13/src/main/scala/org/hello/World2_13.scala.html").exists());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Tag;
import org.scoverage.ScoverageFunctionalTest;
import org.scoverage.ScoveragePlugin;

import java.io.File;

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
include '2_11', '2_12', '2_13'
include '2_12', '2_13'
2 changes: 1 addition & 1 deletion src/main/groovy/org/scoverage/ScoverageExtension.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ScoverageExtension {
project.plugins.apply(ScalaPlugin.class)

scoverageVersion = project.objects.property(String)
scoverageVersion.set('1.4.1')
scoverageVersion.set('1.4.2')

scoverageScalaVersion = project.objects.property(String)

Expand Down
6 changes: 1 addition & 5 deletions src/main/groovy/org/scoverage/ScoverageWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@

import org.gradle.api.logging.Logger;
import scala.Some;
import scala.collection.JavaConverters;
import scala.collection.mutable.Buffer;
import scoverage.Constants;
import scoverage.Coverage;
import scoverage.report.CoberturaXmlWriter;
import scoverage.report.ScoverageHtmlWriter;
import scoverage.report.ScoverageXmlWriter;

import java.io.File;
import java.util.Arrays;

/**
* Util for generating and saving coverage files.
Expand Down Expand Up @@ -76,8 +73,7 @@ public void write(File sourceDir,
}

if (coverageOutputHTML) {
Buffer<File> sources = JavaConverters.asScalaBufferConverter(Arrays.asList(sourceDir)).asScala();
new ScoverageHtmlWriter(sources, reportDir, new Some<>(sourceEncoding)).write(coverage);
new ScoverageHtmlWriter(new File[]{sourceDir}, reportDir, new Some<>(sourceEncoding)).write(coverage);
logger.info("[scoverage] Written HTML report to " +
reportDir.getAbsolutePath() +
File.separator +
Expand Down