-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
basic support for aggregating scoverage across subprojects
- Loading branch information
Showing
5 changed files
with
69 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.scoverage; | ||
|
||
import scoverage.Coverage; | ||
import scoverage.report.CoberturaXmlWriter; | ||
import scoverage.report.CoverageAggregator; | ||
import scoverage.report.ScoverageHtmlWriter; | ||
|
||
import java.io.File; | ||
|
||
public class AggregateReportApp { | ||
|
||
public static void main(String... args) { | ||
File rootDir = new File(args[0]); | ||
File reportDir = new File(args[1]); | ||
Boolean clean = Boolean.parseBoolean(args[2]); | ||
reportDir.mkdirs(); | ||
Coverage coverage = CoverageAggregator.aggregate(rootDir, clean).get(); | ||
new ScoverageHtmlWriter(rootDir, reportDir).write(coverage); | ||
new CoberturaXmlWriter(rootDir, reportDir).write(coverage); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.scoverage | ||
|
||
import org.gradle.api.tasks.JavaExec | ||
|
||
class ScoverageAggregate extends JavaExec { | ||
|
||
boolean clean = false | ||
File reportDir | ||
|
||
@Override | ||
void exec() { | ||
setClasspath(ScoveragePlugin.extensionIn(project).pluginClasspath) | ||
setMain('org.scoverage.AggregateReportApp') | ||
def reportPath = reportDirOrDefault() | ||
setArgs([project.projectDir, reportPath.absolutePath, clean]) | ||
super.exec() | ||
def reportEntryPoint = new File(reportPath, 'index.html').absolutePath | ||
project.logger.lifecycle("Wrote aggregated scoverage report to ${reportEntryPoint}") | ||
} | ||
|
||
def reportDirOrDefault() { | ||
return reportDir ? reportDir : new File(project.buildDir, 'scoverage-aggregate') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.scoverage | ||
|
||
import org.gradle.api.tasks.JavaExec | ||
|
||
class ScoverageReport extends JavaExec { | ||
|
||
@Override | ||
void exec() { | ||
def extension = ScoveragePlugin.extensionIn(project) | ||
extension.reportDir.mkdirs() | ||
setClasspath(extension.pluginClasspath) | ||
setMain('org.scoverage.SingleReportApp') | ||
setArgs([extension.sources.absolutePath, extension.dataDir.absolutePath, extension.reportDir.absolutePath]) | ||
super.exec() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters