This repository was archived by the owner on Jan 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.gradle.kts
132 lines (108 loc) · 4.19 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import com.gorylenko.GitPropertiesPluginExtension
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
id("idea")
id("java")
id("project-report")
id("org.springframework.boot") version "3.1.4"
id("io.spring.dependency-management") version "1.1.3"
id("com.github.ben-manes.versions") version "0.48.0"
id("com.gorylenko.gradle-git-properties") version "2.4.1"
}
repositories {
mavenCentral()
maven { url = uri("https://oss.sonatype.org/content/repositories/releases/") }
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
mavenLocal()
}
group = "de.otto.edison"
base.archivesName.set("edison-jobtrigger")
version = "3.0.3-SNAPSHOT"
configurations.all {
exclude(group = "org.slf4j", module = "slf4j-log4j12")
exclude(group = "log4j", module = "log4j")
exclude(module = "spring-boot-starter-tomcat")
}
buildscript {
// jetty 11 does not yet support jakarta 6
extra["jakarta-servlet.version"] = "5.0.0"
}
dependencies {
val edisonrelease = "3.1.5"
val logbackVersion = "1.4.11"
// edison
implementation("de.otto.edison:edison-core:${edisonrelease}")
// bootstrap
//Don't forget to also update the links in the html templates if you change this!
implementation("org.webjars:jquery:3.7.1")
implementation("org.webjars:bootstrap:5.3.2")
//Don't forget to also update the links in the html templates if you change this!
// guava
implementation("com.google.guava:guava:32.1.2-jre")
// logging
implementation("ch.qos.logback:logback-core:${logbackVersion}")
implementation("ch.qos.logback:logback-classic:${logbackVersion}")
// spring
implementation("org.springframework.vault:spring-vault-core:3.0.4")
implementation("org.hibernate.validator:hibernate-validator:8.0.1.Final")
implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
// jetty
implementation("org.springframework.boot:spring-boot-starter-jetty")
// gson
implementation("com.google.code.gson:gson:2.10.1")
// asyncHttp
implementation("org.asynchttpclient:async-http-client:2.12.3")
// test
testImplementation("org.junit.jupiter:junit-jupiter:5.11.4")
testImplementation("org.mockito:mockito-core:5.5.0")
testImplementation("org.hamcrest:java-hamcrest:2.0.0.0")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("de.otto.edison:edison-testsupport:${edisonrelease}")
// workaround to make spring boot test work, which depends on jakarta 6
testImplementation("org.eclipse.jetty:jetty-server:11.0.15")
testImplementation("jakarta.servlet:jakarta.servlet-api:6.0.0")
}
tasks {
dependencyUpdates {
rejectVersionIf {
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
}
withType<ProcessResources> {
doLast {
val resourcesDir = project.sourceSets.main.get().output.resourcesDir
resourcesDir!!.mkdirs()
val versionProperties = File(resourcesDir, "version.properties")
val version = version
val commit = getCommitHash()
versionProperties.writeText("\nedison.status.vcs.version = $version\nedison.status.vcs.commit = $commit")
}
}
withType<Test> {
useJUnitPlatform {
// Show test results.
testLogging {
showStackTraces = true
showCauses = true
displayGranularity = -1
exceptionFormat = TestExceptionFormat.FULL
events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
}
excludeEngines("junit-vintage")
}
jvmArgs("-XX:+AllowRedefinitionToAddDeleteMethods")
}
}
fun getCommitHash(): String {
val env = System.getenv()
return env["COMMIT"] ?: "unknown"
}
configure<GitPropertiesPluginExtension> {
dateFormat = "yyyy-MM-dd'T'HH:mmZ"
dateFormatTimeZone = "CET"
}
fun isNonStable(version: String): Boolean {
val regex = """(?i).*[.-](alpha|beta|rc|cr|m|preview|b|ea|pr)[.\d-+]*""".toRegex()
return regex.matches(version)
}