forked from spotbugs/spotbugs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
65 lines (52 loc) · 1.79 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
plugins {
id 'org.sonarqube' version '2.7.1'
id "com.diffplug.gradle.spotless" version "3.23.0"
}
version = '4.0.0-SNAPSHOT'
apply from: "$rootDir/gradle/java.gradle"
apply from: "$rootDir/gradle/jacoco.gradle"
apply from: "$rootDir/gradle/sonar.gradle"
subprojects {
apply from: "$rootDir/gradle/java.gradle"
apply from: "$rootDir/gradle/eclipse.gradle"
apply from: "$rootDir/gradle/idea.gradle"
apply from: "$rootDir/gradle/test.gradle"
apply from: "$rootDir/gradle/jacoco.gradle"
if (!project.name.equals("spotbugsTestCases")) {
apply from: "$rootDir/gradle/spotless.gradle"
}
group = 'com.github.spotbugs'
version = rootProject.version
// Java versions
project.sourceCompatibility = 1.8
project.targetCompatibility = 1.8
repositories {
jcenter()
}
}
repositories {
jcenter()
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}
// https://discuss.gradle.org/t/merge-jacoco-coverage-reports-for-multiproject-setups/12100/6
task jacocoRootReport(type: JacocoReport) {
description = 'Merge all coverage reports before submit to SonarQube'
dependsOn(subprojects.jacocoTestReport)
executionData = files(subprojects.jacocoTestReport.executionData)
sourceDirectories = files(subprojects.jacocoTestReport.sourceDirectories)
// Only enable class directories related to non-test project
classDirectories = files(subprojects.jacocoTestReport.classDirectories).filter {
!it.toString().contains("-test") && !it.toString().contains("Test") && !it.toString().contains("junit")
}
reports {
// JaCoCo SonarQube plugin needs a XML file to parse
// https://docs.sonarqube.org/display/PLUG/JaCoCo+Plugin
xml.enabled = true
}
doFirst {
executionData = files(executionData.findAll { it.exists() })
}
}
tasks.sonarqube.dependsOn jacocoRootReport