forked from Java-Discord/JavaBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
131 lines (108 loc) · 3.49 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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.github.jengelman.gradle.plugins.shadow.transformers.*
plugins {
java
id("com.github.johnrengelman.shadow") version "7.1.2"
id("org.springframework.boot") version "3.3.5"
id("io.spring.dependency-management") version "1.1.6"
id("org.graalvm.buildtools.native") version "0.10.3"
checkstyle
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
group = "net.discordjug"
version = "1.0.0-SNAPSHOT"
repositories {
mavenCentral()
maven(url = "https://m2.dv8tion.net/releases")
maven(url = "https://jitpack.io")
}
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.0")
compileOnly("com.google.code.findbugs:jsr305:3.0.2")
compileOnly("org.jetbrains:annotations:23.0.0")
// DIH4JDA (Command Framework) & JDA
implementation("com.github.DynxstyGIT:DIH4JDA:120a15ad2e")
implementation("net.dv8tion:JDA:5.1.2") {
exclude(module = "opus-java")
}
// Caffeine (Caching Library)
implementation("com.github.ben-manes.caffeine:caffeine:3.1.1")
implementation("com.google.code.gson:gson:2.9.0")
implementation("org.yaml:snakeyaml:1.30")
implementation("com.google.re2j:re2j:1.6")
implementation("commons-validator:commons-validator:1.7")
implementation("com.mashape.unirest:unirest-java:1.4.9")
// H2 Database
implementation("com.h2database:h2:2.1.212")
implementation("com.zaxxer:HikariCP:5.0.1")
// Webhooks
implementation("com.github.DynxstyGIT:discord-webhooks:74301a46a0")
// Lombok Annotations
compileOnly("org.projectlombok:lombok:1.18.30")
annotationProcessor("org.projectlombok:lombok:1.18.30")
testCompileOnly("org.projectlombok:lombok:1.18.30")
testAnnotationProcessor("org.projectlombok:lombok:1.18.30")
// Sentry
implementation("io.sentry:sentry:6.3.0")
// Spring
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-data-jdbc")
//required for registering native hints
implementation("org.jetbrains.kotlin:kotlin-reflect")
}
configurations {
all {
exclude(group = "commons-logging", module = "commons-logging")
}
}
tasks.withType<Jar> {
manifest {
attributes["Manifest-Version"] = "1.0"
attributes["Main-Class"] = "net.discordjug.javabot.Bot"
}
}
tasks.withType<JavaCompile>{ options.encoding = "UTF-8" }
tasks.withType<JavaCompile>().configureEach {
options.forkOptions.jvmArgs = listOf("--add-opens", "jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED")
}
tasks.withType<Test>{ useJUnitPlatform() }
tasks.withType<ShadowJar> {
isZip64 = true
// Required for Spring
mergeServiceFiles()
append("META-INF/spring.handlers")
append("META-INF/spring.schemas")
append("META-INF/spring.tooling")
transform(PropertiesFileTransformer().apply {
paths = listOf("META-INF/spring.factories")
mergeStrategy = "append"
})
}
checkstyle {
toolVersion = "9.1"
configDirectory.set(File("checkstyle"))
}
tasks.withType<Checkstyle>() {
exclude("**/generated/**")
}
tasks.checkstyleAot {
isEnabled = false
}
tasks.processTestAot {
isEnabled = false
}
graalvmNative {
binaries {
named("main") {
if (hasProperty("prod")) {
buildArgs.add("-O3")
} else {
quickBuild.set(true)
}
}
}
}