This repository has been archived by the owner on Oct 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
116 lines (101 loc) · 3.42 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
plugins {
id 'java'
id 'io.quarkus'
id 'jacoco'
id "org.sonarqube" version "${sonarPluginVersion}"
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
implementation 'io.quarkus:quarkus-resteasy-reactive'
implementation 'io.quarkus:quarkus-resteasy-reactive-jackson'
implementation 'io.quarkus:quarkus-arc'
implementation "org.projectlombok:lombok:${lombokVersion}"
implementation 'io.quarkus:quarkus-hibernate-validator'
implementation 'io.quarkus:quarkus-mongodb-panache-common'
implementation 'io.quarkus:quarkus-mongodb-panache'
implementation 'org.eclipse.microprofile.jwt:microprofile-jwt-auth-api'
implementation 'io.quarkus:quarkus-smallrye-jwt'
testImplementation 'io.quarkus:quarkus-test-security'
testImplementation 'io.quarkus:quarkus-test-security-jwt'
testImplementation 'io.quarkus:quarkus-junit5'
testImplementation 'io.rest-assured:rest-assured'
testImplementation "io.quarkus:quarkus-jacoco"
testImplementation 'org.mockito:mockito-core'
testImplementation 'io.quarkus:quarkus-junit5-mockito'
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
}
group 'it.pagopa.swclient.mil'
version "${projectVersion}"
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
test {
systemProperty "java.util.logging.manager", "org.jboss.logmanager.LogManager"
}
compileJava {
options.encoding = 'UTF-8'
options.compilerArgs << '-parameters'
}
compileTestJava {
options.encoding = 'UTF-8'
}
jacoco {
toolVersion = "${jacocoToolVersion}"
}
def jacocoQuarkusPath = project.layout.buildDirectory.file("jacoco-quarkus.exec")
// allows to collect jacoco coverage on non-quarkus test
// refers to https://quarkus.io/guides/tests-with-coverage#coverage-for-tests-not-using-quarkustest
test {
finalizedBy jacocoTestReport
jacoco {
excludeClassLoaders = ["*QuarkusClassLoader"]
destinationFile = jacocoQuarkusPath.map { it.asFile }.getOrNull()
}
}
// configure line coverage verification
// refers to https://quarkus.io/guides/tests-with-coverage#setting-coverage-thresholds
jacocoTestCoverageVerification {
executionData.setFrom(jacocoQuarkusPath.map { (it.asFile as File).getPath() }.get())
violationRules {
rule {
element = 'CLASS'
limit {
counter = 'LINE'
value = 'COVEREDRATIO'
minimum = 0.90
}
limit {
counter = 'BRANCH'
value = 'COVEREDRATIO'
minimum = 0.90
}
}
rule {
element = 'METHOD'
limit {
counter = 'COMPLEXITY'
value = 'TOTALCOUNT'
maximum = 15
}
}
}
}
// refers to https://docs.gradle.org/8.5/userguide/dependency_locking.html
dependencyLocking {
lockMode = LockMode.STRICT
lockAllConfigurations()
}
sonar {
properties {
property 'sonar.host.url', 'https://sonarcloud.io/'
property 'sonar.organization', 'pagopa'
property 'sonar.projectKey', "${sonarProjectKey}"
property 'sonar.core.codeCoveragePlugin', 'jacoco'
property 'sonar.coverage.jacoco.xmlReportPaths', 'build/jacoco-report/jacoco.xml'
}
}