Skip to content

Support scoverage 1.0 #21

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 6 commits into from
Dec 21, 2014
Merged
Show file tree
Hide file tree
Changes from 3 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
23 changes: 16 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
buildscript {
repositories {
mavenCentral()
def isDirty = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'status', '--porcelain'
standardOutput = stdout
}
dependencies {
classpath 'com.github.townsfolk:gradle-release:1.2'
return stdout.toString().trim()
}
def getVersionName = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdout
}
def gitVersionName = stdout.toString().trim()
return isDirty() ? gitVersionName + '-SNAPSHOT' : gitVersionName
}
version = getVersionName()

repositories {
mavenCentral()
Expand All @@ -19,7 +29,6 @@ ext {
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'groovy'
apply plugin: 'release'

group 'org.scoverage'

Expand All @@ -31,7 +40,7 @@ configurations {
dependencies {
compile gradleApi()
compile localGroovy()
scoverage 'org.scoverage:scalac-scoverage-plugin_2.10:0.99.5'
scoverage 'org.scoverage:scalac-scoverage-plugin_2.11:1.0.1','org.scoverage:scalac-scoverage-plugin_2.11:1.0.1'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have plugin here twice, did you meant runtime in second case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot! Interestingly enough, no - I shouldn't have added the runtime dependency at all, it's not required here. I think I accidentally edited this file when I meant to edit the gradle build that is used for testing...

The plugin is compiled against a version of the scalac plugin, but then doesn't expose this dependency downstream; this is the reasoning behind not adding it directly to the compile configuration.

In hindsight I wonder if it would be helpful to provide a default configuration rather than forcing users to state the scoverage version.

I'm going to try to rebase this pull request, so this comment may disappear, or I may have to start a new one...

}

task groovydocJar(type: Jar, dependsOn: groovydoc) {
Expand Down
1 change: 0 additions & 1 deletion gradle.properties

This file was deleted.

6 changes: 4 additions & 2 deletions src/main/groovy/org/scoverage/ScoverageReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import scala.collection.Set;
import scoverage.Coverage;
import scoverage.IOUtils;
import scoverage.Serializer;
import scoverage.report.CoberturaXmlWriter;
import scoverage.report.ScoverageHtmlWriter;

Expand All @@ -19,13 +20,14 @@ public static void main(String... args) {
File sourceDir = new File(args[0]);
File dataDir = new File(args[1]);
File reportDir = new File(args[2]);
reportDir.mkdirs();

File coverageFile = IOUtils.coverageFile(dataDir);
File coverageFile = Serializer.coverageFile(dataDir);
File[] array = IOUtils.findMeasurementFiles(dataDir);
// TODO: patch scoverage core to use a consistent collection type?
Seq<File> measurementFiles = scala.collection.JavaConversions.asScalaBuffer(Arrays.asList(array));

Coverage coverage = IOUtils.deserialize(coverageFile);
Coverage coverage = Serializer.deserialize(coverageFile);

Set<Object> measurements = IOUtils.invoked(measurementFiles);
coverage.apply(measurements);
Expand Down
3 changes: 2 additions & 1 deletion src/test/happyday/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ repositories {
}

dependencies {
scoverage 'org.scoverage:scalac-scoverage-plugin_2.11:0.99.5'
scoverage 'org.scoverage:scalac-scoverage-plugin_2.11:1.0.1',
'org.scoverage:scalac-scoverage-runtime_2.11:1.0.1'
compile 'org.scala-lang:scala-library:2.11.0'
testCompile 'junit:junit:4.11'
}
Expand Down