forked from KengoTODA/gradle-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
62 lines (53 loc) · 2 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
plugins {
id 'jacoco'
id 'org.sonarqube' version '3.1.1'
id 'com.diffplug.spotless' version '5.9.0' apply false
id 'org.springframework.boot' version '2.4.2' apply false
id 'io.spring.dependency-management' version '1.0.11.RELEASE' apply false
id 'net.ltgt.errorprone' version '1.3.0' apply false
id 'org.siouan.frontend-jdk11' version '5.0.0' apply false
id 'com.google.cloud.tools.jib' version '2.7.1' apply false
}
ext {
junitVersion = '5.7.0'
immutablesVersion = '2.8.9-ea-1'
errorproneVersion = '2.5.1'
}
allprojects {
repositories { mavenCentral() }
}
subprojects {
if (project != project(':frontend')) {
apply from: "$rootDir/gradle/java.gradle"
apply from: "$rootDir/gradle/test.gradle"
apply from: "$rootDir/gradle/spotless.gradle"
}
ext {
mavenBom = org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES
}
}
tasks.register('jacocoRootReport', JacocoReport).configure {
description = 'Merge all coverage reports before submit to SonarQube'
List<JacocoReport> reportTasks = project.subprojects.collect {it.tasks.withType(JacocoReport)}.flatten()
dependsOn reportTasks
executionData reportTasks.collect({ it.executionData })
classDirectories.setFrom reportTasks.collect({it.classDirectories })
sourceDirectories.setFrom reportTasks.collect({it.sourceDirectories })
reports {
html.destination file("${buildDir}/reports/jacoco/merged/html")
xml.enabled = true
xml.destination file("${buildDir}/reports/jacoco/merged/merged.xml")
}
}
sonarqube {
properties {
property 'sonar.coverage.jacoco.xmlReportPaths', jacocoRootReport.reports.xml.destination
property 'sonar.host.url', 'https://sonarcloud.io'
property 'sonar.organization', 'kengotoda-github'
property 'sonar.projectKey', 'KengoTODA_gradle-boilerplate'
}
}
tasks.named('sonarqube').configure {
dependsOn jacocoRootReport
}
defaultTasks 'spotlessApply', 'build'