Skip to content

Add support for Scala 2.13 #145

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

Closed
wants to merge 1 commit into from
Closed
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
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
13 changes: 7 additions & 6 deletions src/main/groovy/org/scoverage/ScoverageWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

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;
import java.lang.reflect.Field;

/**
* Util for generating and saving coverage files.
Expand Down Expand Up @@ -46,7 +44,7 @@ public void write(File sourceDir,
Boolean coverageOutputCobertura,
Boolean coverageOutputXML,
Boolean coverageOutputHTML,
Boolean coverageDebug) {
Boolean coverageDebug) throws NoSuchFieldException, IllegalAccessException {

logger.info("[scoverage] Generating scoverage reports...");

Expand Down Expand Up @@ -76,8 +74,11 @@ 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);
ScoverageHtmlWriter writer = new ScoverageHtmlWriter(sourceDir, reportDir);
Field field = ScoverageHtmlWriter.class.getDeclaredField("sourceEncoding");
field.setAccessible(true);
field.set(writer, new Some<>(sourceEncoding));
writer.write(coverage);
logger.info("[scoverage] Written HTML report to " +
reportDir.getAbsolutePath() +
File.separator +
Expand Down