-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
110 lines (94 loc) · 3.54 KB
/
build.gradle.kts
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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
plugins {
application
id("checkstyle")
id("jacoco")
id("io.freefair.lombok") version "8.4"
id("org.springframework.boot") version "3.2.2"
id("io.spring.dependency-management") version "1.1.4"
id("com.github.ben-manes.versions") version "0.51.0"
id("io.sentry.jvm.gradle") version "4.3.0"
}
group = "hexlet.code"
version = "0.0.1-SNAPSHOT"
java {
sourceCompatibility = JavaVersion.VERSION_20
}
application {
mainClass.set("hexlet.code.AppApplication")
}
configurations {
compileOnly {
extendsFrom(configurations.annotationProcessor.get())
}
}
repositories {
mavenCentral()
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-oauth2-resource-server")
implementation("org.mapstruct:mapstruct:1.5.5.Final")
implementation("com.fasterxml.jackson.core:jackson-databind:2.16.1")
implementation("org.openapitools:jackson-databind-nullable:0.2.6")
// https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-starter-webmvc-ui
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0")
developmentOnly("org.springframework.boot:spring-boot-devtools")
annotationProcessor("org.mapstruct:mapstruct-processor:1.5.5.Final")
runtimeOnly("com.h2database:h2:2.2.224")
runtimeOnly("org.postgresql:postgresql:42.7.1")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.security:spring-security-test")
testImplementation(platform("org.junit:junit-bom:5.10.1"))
testImplementation("org.junit.jupiter:junit-jupiter:5.10.1")
testImplementation("org.instancio:instancio-junit:4.1.0")
testImplementation("net.datafaker:datafaker:2.1.0")
testImplementation("net.javacrumbs.json-unit:json-unit-assertj:3.2.2")
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.test {
useJUnitPlatform()
finalizedBy(tasks.jacocoTestReport)
}
tasks.jacocoTestReport {
dependsOn(tasks.test)
reports {
xml.required = true
csv.required = false
html.outputLocation = layout.buildDirectory.dir("jacocoHtml")
}
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}
tasks.named<DependencyUpdatesTask>("dependencyUpdates").configure {
// optional parameters
checkForGradleUpdate = true
outputFormatter = "json"
outputDir = "build/dependencyUpdates"
reportfileName = "report"
rejectVersionIf {
isNonStable(candidate.version)
}
}
sentry {
// Generates a JVM (Java, Kotlin, etc.) source bundle and uploads your source code to Sentry.
// This enables source context, allowing you to see your source
// code as part of your stack traces in Sentry.
includeSourceContext = true
org = "sidorenkov-anton"
projectName = "java-spring-boot"
authToken = System.getenv("SENTRY_AUTH_TOKEN")
}
tasks.sentryBundleSourcesJava {
enabled = System.getenv("SENTRY_AUTH_TOKEN") != null
}