-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
115 lines (98 loc) · 3.29 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
import org.apache.tools.ant.filters.ReplaceTokens
buildscript {
configurations.classpath {
resolutionStrategy.activateDependencyLocking()
}
}
plugins {
id "java"
id "application"
id "com.gorylenko.gradle-git-properties" version "$gradleGitPluginVersion"
id "com.github.ben-manes.versions" version "$versionsPluginVersion"
id "org.springframework.boot" version "$springBootVersion"
}
group 'space.npstr.icu'
version '0.1.0-SNAPSHOT'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
vendor = JvmVendorSpec.ADOPTIUM
}
}
repositories {
mavenCentral() // everything else
maven { url 'https://jitpack.io' } // for getting builds from github
}
dependencies {
implementation platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")
implementation "org.springframework.boot:spring-boot-starter"
implementation "org.springframework.boot:spring-boot-starter-data-jpa"
implementation "net.dv8tion:JDA:$jdaVersion"
implementation "ch.qos.logback:logback-classic"
implementation "io.sentry:sentry-logback:$sentryVersion"
implementation "io.sentry:sentry-spring-boot-starter-jakarta:$sentryVersion"
runtimeOnly "org.postgresql:postgresql"
implementation "com.github.ben-manes.caffeine:caffeine"
compileOnly "com.google.code.findbugs:jsr305:$findbugsVersion" // to avoid warning about some missing annotations
}
tasks.withType(JavaCompile).configureEach {
dependsOn(processResources)
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
bootJar {
archiveFileName.set("icu.jar")
doLast {
copy {
from 'build/libs/icu.jar'
into '.'
}
}
}
processResources {
//inject values into app.properties
filesMatching("**/app.properties") {
filter ReplaceTokens, tokens: [
"project.version" : project.version,
"project.groupId" : project.group,
"project.artifactId": project.name,
"env.BUILD_NUMBER" : (System.getenv('CI') ? System.getenv('BUILD_NUMBER') : 'DEV'),
"env.BUILD_TIME" : System.currentTimeMillis() + ''
]
}
}
dependencyLocking {
lockAllConfigurations()
}
// ./gradlew resolveAndLockAll --write-locks
task resolveAndLockAll {
doFirst {
assert gradle.startParameter.writeDependencyLocks
}
doLast {
configurations.all {
resolutionStrategy {
componentSelection properReleasesOnly()
}
}
configurations
.findAll { it.canBeResolved }
.each { it.resolve() }
}
}
// https://github.com/ben-manes/gradle-versions-plugin
dependencyUpdates.resolutionStrategy {
componentSelection properReleasesOnly()
}
static def properReleasesOnly() {
return { rules ->
rules.all { ComponentSelection selection ->
boolean rejected = ['alpha', 'beta', 'rc', 'preview', 'm1', 'm2', 'm3', 'cr1'].any {
q -> selection.candidate.version.toLowerCase().contains(q) && !selection.candidate.module.equals("JDA")
}
if (rejected) {
selection.reject('Release candidate')
}
}
}
}