forked from ciprian-radu/rent-a-car
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
136 lines (114 loc) · 4.04 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
plugins {
id 'com.github.ben-manes.versions' version '0.25.0'
id 'org.javamodularity.moduleplugin' version '1.6.0'
}
allprojects {
apply plugin: 'jacoco'
repositories {
jcenter()
}
}
subprojects {
apply plugin: 'java'
apply plugin: "org.javamodularity.moduleplugin"
sourceCompatibility = JavaVersion.VERSION_12
ext {
junit_version = '5.5.2'
mockito_version = '3.0.0'
archunit_version = '0.11.0'
spring_version = '5.1.9.RELEASE'
spring_boot_version = '2.1.8.RELEASE'
spring_cloud_version = 'Greenwich.SR3'
h2_version = '1.4.199'
postgresql_version = '42.2.8'
thymeleaf_extras_version = '3.0.4.RELEASE'
slf4j_version = '2.0.0-alpha0'
logback_version = '1.3.0-alpha4'
}
ext.libs = [
junit : [
"org.junit.jupiter:junit-jupiter:${junit_version}",
],
mockito_core : [
"org.mockito:mockito-core:${mockito_version}",
],
spring_jdbc : [
"org.springframework:spring-jdbc:${spring_version}",
],
h2 : [
"com.h2database:h2:${h2_version}",
],
postgresql : [
"org.postgresql:postgresql:${postgresql_version}",
],
spring_context : [
"org.springframework:spring-context:${spring_version}",
],
thymeleaf_extras: [
"org.thymeleaf.extras:thymeleaf-extras-springsecurity5:${thymeleaf_extras_version}"
],
log : [
"org.slf4j:slf4j-api:${slf4j_version}",
"ch.qos.logback:logback-core:${logback_version}",
"ch.qos.logback:logback-classic:${logback_version}"
],
]
dependencies {
// See https://github.com/java9-modularity/gradle-modules-plugin/issues/97#issuecomment-527264923
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.5.2'
testRuntimeOnly 'org.junit.platform:junit-platform-commons:1.5.2'
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
reports {
html.enabled = true
}
}
jacocoTestReport {
dependsOn test
additionalSourceDirs.from = files(sourceSets.main.allSource.srcDirs)
sourceDirectories.from = files(sourceSets.main.allSource.srcDirs)
classDirectories.from = files(sourceSets.main.output)
reports {
xml.enabled = false
csv.enabled = false
html.destination file("${buildDir}/jacocoHtml")
}
}
task stage {
dependsOn build
}
}
task jacocoMergeAll(type: JacocoMerge) {
dependsOn(subprojects.test, subprojects.jacocoTestReport)
def jacocoProjects = subprojects.findAll {
def buildDir = it.getBuildDir()
def testExecFile = file(buildDir.getAbsolutePath() + '/jacoco/test.exec')
logger.debug('Looking for JaCoCo test.exec file {}', testExecFile)
return testExecFile.exists()
}
jacocoProjects.each { subproject ->
executionData subproject.tasks.withType(Test)
}
}
// Credits: https://discuss.gradle.org/t/merge-jacoco-coverage-reports-for-multiproject-setups/12100/10
task jacocoRootReport(type: JacocoReport, group: 'Coverage reports') {
description = 'Generates an aggregate report from all subprojects'
dependsOn(jacocoMergeAll)
additionalSourceDirs.from =
files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories.from =
files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories.from =
files(subprojects.sourceSets.main.output)
executionData.from =
files("${buildDir}/jacoco/jacocoMergeAll.exec")
reports {
html.enabled = true
xml.enabled = false
html.destination file("${buildDir}/jacocoHtml")
}
}