-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
173 lines (129 loc) · 4.77 KB
/
build.gradle.kts
File metadata and controls
173 lines (129 loc) · 4.77 KB
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
import dev.freya02.botcommands.plugins.configureJarArtifact
import dev.freya02.botcommands.tasks.GenerateBCInfoTask
import dev.freya02.botcommands.utils.registerBucket4JDocs
import dev.freya02.botcommands.utils.registerJetbrainsAnnotationsDocs
import dev.freya02.botcommands.utils.registerSourceSet
plugins {
id("repositories-conventions")
id("kotlin-conventions")
id("publish-conventions")
id("dokka-conventions")
id("spring-configuration-metadata-conventions")
}
// Register other source sets
// NOTE: Register them before dependencies, or you won't be able to add deps to them
registerSourceSet(name = "examples")
// Use different source sets so we can use the same class names without clashes
registerSourceSet(name = "javaDocExamples")
registerSourceSet(name = "kotlinDocExamples")
val byteBuddyAgent: Configuration by configurations.creating
dependencies {
// -------------------- CORE DEPENDENCIES --------------------
// Kotlin
api(libs.kotlin.reflect)
api(libs.kotlinx.coroutines.core)
compileOnly(libs.kotlinx.coroutines.debug) // Optional
// Logging
api(libs.slf4j.api)
implementation(libs.kotlin.logging)
// JDA
compileOnly(libs.jda)
implementation(projects.botCommandsJdaKtx)
// Classpath scanning
api(libs.classgraph)
api(projects.botCommandsMethodAccessors.core) // API due to opt-in annotation
implementation(projects.botCommandsMethodAccessors.kotlinReflect)
// -------------------- GLOBAL DEPENDENCIES --------------------
// Deserialization
api(libs.jackson.databind)
api(libs.jackson.module.kotlin)
// Efficient data structures
api(libs.trove4j.core)
// Rate limiting
api(libs.bucket4j.jdk17.core)
// -------------------- DATABASE DEPENDENCIES --------------------
// SQL connection pooling
compileOnly(libs.hikaricp) // Optional
// -------------------- EMOJI DEPENDENCIES --------------------
// All Unicode emojis
api(libs.jemoji)
// JDA-specific emojis
api(libs.jda.emojis) {
exclude(module = "JDA")
}
// -------------------- AUTOCOMPLETE DEPENDENCIES --------------------
// Fuzzy matching
implementation(libs.java.string.similarity)
// Caching
implementation(libs.caffeine)
// -------------------- SPRING DEPENDENCIES --------------------
// Spring Boot (only for compatibility that cannot be put in a different module)
compileOnly(libs.spring.boot) // Optional
compileOnly(libs.spring.boot.autoconfigure) // Optional
// -------------------- ANNOTATION DEPENDENCIES --------------------
api(libs.jsr305)
compileOnly(libs.jetbrains.annotations)
api(libs.jspecify)
// -------------------- DOC EXAMPLES DEPENDENCIES --------------------
// YAML (de)serialization
"javaDocExamplesImplementation"(libs.jackson.dataformat.yaml)
"kotlinDocExamplesImplementation"(libs.jackson.dataformat.yaml)
// Persistent rate limiting
"javaDocExamplesImplementation"(libs.bucket4j.jdk17.postgresql)
"kotlinDocExamplesImplementation"(libs.bucket4j.jdk17.postgresql)
// -------------------- EXAMPLES DEPENDENCIES --------------------
// Logging
"examplesImplementation"(libs.logback.classic)
// Database
"examplesImplementation"(libs.h2)
"examplesImplementation"(libs.flyway.core)
// -------------------- TEST DEPENDENCIES --------------------
// JUnit + Mockk + Logback
testImplementation(projects.testCommons)
byteBuddyAgent(libs.bytebuddy.agent) { isTransitive = false }
// Database
testImplementation(libs.h2)
testImplementation(libs.flyway.core)
testRuntimeOnly(libs.flyway.database.postgresql)
testImplementation(projects.botCommandsMethodAccessors.classfile)
testImplementation(libs.kotlin.metadata)
}
tasks.withType<Test> {
useJUnitPlatform()
jvmArgs("-javaagent:${byteBuddyAgent.asPath}")
}
val generateInfo by tasks.registering(GenerateBCInfoTask::class) {
doNotTrackState("Can't know when Git hash/branch changes")
outputs.upToDateWhen { false }
}
sourceSets {
main {
resources {
srcDir(generateInfo)
}
}
}
dokka {
dokkaSourceSets.configureEach {
suppressGeneratedFiles = false
registerBucket4JDocs()
registerJetbrainsAnnotationsDocs()
}
}
kotlin {
compilerOptions {
freeCompilerArgs.addAll(
"-Xcontext-parameters",
)
optIn.addAll(
"io.github.freya022.botcommands.api.core.annotations.ExperimentalCoreApi"
)
}
}
publishedProjectEnvironment {
configureJarArtifact(
artifactId = "BotCommands-core",
description = "Includes a core set of features bots typically need.",
url = "https://github.com/freya022/BotCommands/tree/3.X/BotCommands-core",
)
}