Skip to content

Commit

Permalink
Fixed Sonar coverage (ReactiveX#854)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlsrb6342 authored Feb 14, 2020
1 parent 20a30b0 commit 8206abc
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "org.sonarqube" version "2.7"
id "org.sonarqube" version "2.8"
id "com.jfrog.bintray" version "1.8.4"
id "me.champeau.gradle.jmh" version "0.4.8"
id 'org.asciidoctor.convert' version '1.6.0'
Expand Down Expand Up @@ -67,14 +67,15 @@ configure(project.coreProjects) {
options.deprecation = true
options.encoding = 'UTF-8'
options.compilerArgs += ["-Xlint:unchecked", "-parameters"]

}

jmh {
duplicateClassesStrategy = 'warn'
}
}

def allTestCoverageFile = "${rootProject.projectDir}/build/reports/jacoco/report.xml"

sonarqube {
properties {
property "sonar.projectName", "resilience4j"
Expand All @@ -84,25 +85,44 @@ sonarqube {
property "sonar.links.scm", "https://github.com/resilience4j/resilience4j"
property "sonar.links.issue", "https://github.com/resilience4j/resilience4j/issues"
property "sonar.language", "java"
property "sonar.coverage.jacoco.xmlReportPaths", allTestCoverageFile
}
}
def allTestCoverageFile = "$buildDir/jacoco/allTestCoverage.exec"

task jacocoMergeTest(type: JacocoMerge) {
destinationFile = file(allTestCoverageFile)
executionData = project.fileTree(dir: '.', include: '**/build/jacoco/test.exec')
}

task jacocoMerge(dependsOn: ['jacocoMergeTest']) {
// used to run the other merge tasks
task jacocoRootTestReport(type: JacocoReport) {

subprojects.each { dependsOn("${it.name}:test") }
subprojects.each { dependsOn("${it.name}:jacocoTestReport") }

additionalSourceDirs.from = subprojects.sourceSets.main.allSource.srcDirs
sourceDirectories.from = subprojects.sourceSets.main.allSource.srcDirs
classDirectories.from = subprojects.sourceSets.main.output
executionData.setFrom project.fileTree(dir: '.', include: '**/build/jacoco/test.exec')

onlyIf {
true
}

reports {
xml.enabled true
xml.destination file(allTestCoverageFile)
html.enabled true
csv.enabled false
}
}

subprojects {
sonarqube {
properties {
property "sonar.jacoco.reportPaths", allTestCoverageFile
jacocoTestReport {
reports {
xml.enabled true
}
}

afterEvaluate {
// exclude subprojects that don't produce a jar file or by design.
if (!project.name.equals('resilience4j-bom') && !project.name.equals('resilience4j-documentation')
Expand All @@ -117,8 +137,8 @@ subprojects {
}
}

tasks.check.dependsOn tasks.jacocoTestReport

tasks.check.dependsOn tasks.jacocoRootTestReport
tasks.jacocoRootTestReport.dependsOn tasks.test

test {
dependsOn(subprojects.test) // required by cobertura to aggregate report
Expand Down

0 comments on commit 8206abc

Please sign in to comment.