-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
executable file
·158 lines (126 loc) · 5.11 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
import org.apache.tools.ant.taskdefs.condition.Os
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
plugins {
id 'java'
id 'org.springframework.boot' version '3.2.2'
id 'io.spring.dependency-management' version '1.1.3'
id 'org.openapi.generator' version '7.7.0'
id 'jacoco'
}
jacoco {
toolVersion = "0.8.11"
}
repositories {
mavenCentral()
}
java {
group = 'com.company.base'
sourceCompatibility = '21'
targetCompatibility = '21'
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
test {
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
useJUnitPlatform()
finalizedBy jacocoTestCoverageVerification
}
jacocoTestCoverageVerification {
dependsOn test
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"**/gen/**"
])
}))
}
violationRules {
rule {
limit {
counter = "LINE"
minimum = 0.4
}
}
}
finalizedBy jacocoTestReport
}
jacocoTestReport {
reports {
xml.required = true
html.required = true
}
afterEvaluate {
// Need to be duplicated like this from jacocoTestCoverageVerification,
// else display coverageRate is inconsistent with what was computed during coverage...
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"**/gen/**"
])
}))
}
doLast {
def coverageReportFile = file("$rootDir/build/reports/jacoco/test/jacocoTestReport.xml")
if (coverageReportFile.exists()) {
def xmlParser = new XmlParser()
xmlParser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false)
xmlParser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false)
def xml = xmlParser.parse(coverageReportFile)
def lineCounter = xml.'counter'.find { it.@type == 'LINE' }
if (lineCounter != null) {
def totalLines = lineCounter.@missed?.toInteger() + lineCounter.@covered?.toInteger() ?: 0
def coveredLines = lineCounter.@covered?.toInteger() ?: 0
if (totalLines > 0) {
def coverageRate = coveredLines / totalLines.toDouble() * 100
println "Total Line Coverage Rate: ${coverageRate.round(2)}%"
} else {
println "No lines were covered or missed in the report."
}
} else {
println "No LINE coverage counter found in the JaCoCo report."
}
} else {
println "No JaCoCo coverage report found. Make sure you run 'gradle test jacocoTestReport' first."
}
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.flywaydb:flyway-core'
testImplementation 'org.testcontainers:postgresql:1.20.0'
implementation 'org.postgresql:postgresql'
implementation 'org.xerial:sqlite-jdbc:3.45.1.0'
implementation 'org.hibernate.orm:hibernate-community-dialects:6.4.3.Final'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
implementation 'com.amazonaws.serverless:aws-serverless-java-container-springboot3:2.1.0'
implementation 'software.amazon.awssdk:aws-query-protocol:2.20.26'
implementation 'com.amazonaws:aws-lambda-java-core:1.2.3'
implementation 'com.amazonaws:aws-lambda-java-events:3.11.3'
implementation 'software.amazon.awssdk:sqs:2.21.40'
implementation 'software.amazon.awssdk:eventbridge:2.21.40'
implementation 'software.amazon.awssdk:s3:2.21.40'
implementation 'software.amazon.awssdk:s3-transfer-manager:2.21.40'
implementation 'software.amazon.awssdk.crt:aws-crt:0.28.12'
implementation 'software.amazon.awssdk:ses:2.21.40'
implementation 'software.amazon.awssdk:core:2.21.40'
implementation 'jakarta.mail:jakarta.mail-api:2.1.2'
implementation 'jakarta.activation:jakarta.activation-api:2.1.2'
implementation 'com.sun.mail:jakarta.mail:2.0.1'
implementation 'com.sun.activation:jakarta.activation:2.0.1'
implementation 'org.apache.tika:tika-core:2.9.1'
implementation 'org.reflections:reflections:0.10.2'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
implementation 'org.openapitools:jackson-databind-nullable:0.2.6'
implementation 'io.swagger:swagger-annotations:1.6.12'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.testcontainers:junit-jupiter:1.19.1'
testImplementation 'org.junit-pioneer:junit-pioneer:2.2.0'
implementation 'com.opencsv:opencsv:5.8'
implementation 'org.springframework.boot:spring-boot-starter-security'
}