mirror of
https://github.com/corda/corda.git
synced 2025-04-12 05:40:48 +00:00
Added Jacoco code coverage to gradle.
This commit is contained in:
parent
2a0066ae74
commit
ffc3c8f421
41
build.gradle
41
build.gradle
@ -8,6 +8,9 @@ apply plugin: QuasarPlugin
|
||||
apply plugin: 'com.github.ben-manes.versions'
|
||||
|
||||
allprojects {
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'jacoco'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
||||
@ -16,6 +19,23 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
dependencies {
|
||||
testCompile 'junit:junit:4.12'
|
||||
}
|
||||
|
||||
jacocoTestReport {
|
||||
additionalSourceDirs = files(sourceSets.main.allSource.srcDirs)
|
||||
sourceDirectories = files(sourceSets.main.allSource.srcDirs)
|
||||
classDirectories = files(sourceSets.main.output)
|
||||
reports {
|
||||
html.enabled = true
|
||||
xml.enabled = true
|
||||
csv.enabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.0.3'
|
||||
ext.quasar_version = '0.7.5'
|
||||
@ -166,3 +186,24 @@ applicationDistribution.into("bin") {
|
||||
from(getTraderDemo)
|
||||
fileMode = 0755
|
||||
}
|
||||
|
||||
task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
|
||||
dependsOn = subprojects.test
|
||||
additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
|
||||
sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
|
||||
classDirectories = files(subprojects.sourceSets.main.output)
|
||||
executionData = files(subprojects.jacocoTestReport.executionData)
|
||||
reports {
|
||||
html.enabled = true
|
||||
xml.enabled = true
|
||||
csv.enabled = false
|
||||
}
|
||||
onlyIf = {
|
||||
true
|
||||
}
|
||||
doFirst {
|
||||
executionData = files(executionData.findAll {
|
||||
it.exists()
|
||||
})
|
||||
}
|
||||
}
|
@ -114,7 +114,7 @@ fun <T> Iterable<T>.noneOrSingle(): T? {
|
||||
// An alias that can sometimes make code clearer to read.
|
||||
val RunOnCallerThread = MoreExecutors.directExecutor()
|
||||
|
||||
inline fun <T> logElapsedTime(label: String, logger: Logger? = null, body: () -> T): T {
|
||||
fun <T> logElapsedTime(label: String, logger: Logger? = null, body: () -> T): T {
|
||||
val now = System.currentTimeMillis()
|
||||
val r = body()
|
||||
val elapsed = System.currentTimeMillis() - now
|
||||
|
Loading…
x
Reference in New Issue
Block a user