This repository has been archived by the owner on Feb 24, 2024. It is now read-only.
forked from Minestom/Minestom
-
Notifications
You must be signed in to change notification settings - Fork 37
/
build.gradle.kts
195 lines (157 loc) · 5.63 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
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
import java.time.Duration
plugins {
`java-library`
alias(libs.plugins.blossom)
`maven-publish`
signing
alias(libs.plugins.nexuspublish)
}
// Read env vars (used for publishing generally)
version = System.getenv("MINESTOM_VERSION") ?: "dev"
val channel = System.getenv("MINESTOM_CHANNEL") ?: "local" // local, snapshot, release
val shortDescription = "1.20.4 Lightweight Minecraft server"
allprojects {
apply(plugin = "java")
group = "net.minestom"
version = rootProject.version
description = shortDescription
repositories {
mavenCentral()
maven(url = "https://jitpack.io")
}
configurations.all {
// We only use Jetbrains Annotations
exclude("org.checkerframework", "checker-qual")
}
java {
withSourcesJar()
withJavadocJar()
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
tasks.withType<Zip> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
tasks.withType<Test> {
useJUnitPlatform()
// Viewable packets make tracking harder. Could be re-enabled later.
jvmArgs("-Dminestom.viewable-packet=false")
jvmArgs("-Dminestom.inside-test=true")
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
}
sourceSets {
main {
java.srcDir(file("src/main/java"))
java.srcDir(file("src/autogenerated/java"))
}
}
dependencies {
// Core dependencies
api(libs.slf4j)
api(libs.jetbrainsAnnotations)
api(libs.bundles.adventure)
api(libs.hydrazine)
api(libs.bundles.kotlin)
api(libs.bundles.hephaistos)
implementation(libs.minestomData)
// Performance/data structures
implementation(libs.caffeine)
api(libs.fastutil)
implementation(libs.bundles.flare)
api(libs.gson)
implementation(libs.jcTools)
// Testing
testImplementation(libs.bundles.junit)
testImplementation(project(":testing"))
}
tasks {
withType<Javadoc> {
(options as? StandardJavadocDocletOptions)?.apply {
encoding = "UTF-8"
// Custom options
addBooleanOption("html5", true)
addStringOption("-release", "17")
// Links to external javadocs
links("https://docs.oracle.com/en/java/javase/17/docs/api/")
links("https://jd.adventure.kyori.net/api/${libs.versions.adventure.get()}/")
}
}
blossom {
val gitFile = "src/main/java/net/minestom/server/Git.java"
val gitCommit = System.getenv("GIT_COMMIT")
val gitBranch = System.getenv("GIT_BRANCH")
val group = System.getenv("GROUP")
val artifact = System.getenv("ARTIFACT")
replaceToken("\"&COMMIT\"", if (gitCommit == null) "null" else "\"${gitCommit}\"", gitFile)
replaceToken("\"&BRANCH\"", if (gitBranch == null) "null" else "\"${gitBranch}\"", gitFile)
replaceToken("\"&GROUP\"", if (group == null) "null" else "\"${group}\"", gitFile)
replaceToken("\"&ARTIFACT\"", if (artifact == null) "null" else "\"${artifact}\"", gitFile)
}
nexusPublishing{
useStaging.set(true)
this.packageGroup.set("dev.hollowcube")
transitionCheckOptions {
maxRetries.set(360) // 1 hour
delayBetween.set(Duration.ofSeconds(10))
}
repositories.sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
if (System.getenv("SONATYPE_USERNAME") != null) {
username.set(System.getenv("SONATYPE_USERNAME"))
password.set(System.getenv("SONATYPE_PASSWORD"))
}
}
}
publishing.publications.create<MavenPublication>("maven") {
groupId = "dev.hollowcube"
artifactId = if (channel == "snapshot") "minestom-ce-snapshots" else "minestom-ce"
version = project.version.toString()
from(project.components["java"])
pom {
name.set(this@create.artifactId)
description.set(shortDescription)
url.set("https://github.com/hollow-cube/minestom-ce")
licenses {
license {
name.set("Apache 2.0")
url.set("https://github.com/hollow-cube/minestom-ce/blob/main/LICENSE")
}
}
developers {
developer {
id.set("TheMode")
}
developer {
id.set("mworzala")
name.set("Matt Worzala")
email.set("matt@hollowcube.dev")
}
}
issueManagement {
system.set("GitHub")
url.set("https://github.com/hollow-cube/minestom-ce/issues")
}
scm {
connection.set("scm:git:git://github.com/hollow-cube/minestom-ce.git")
developerConnection.set("scm:git:git@github.com:hollow-cube/minestom-ce.git")
url.set("https://github.com/hollow-cube/minestom-ce")
tag.set("HEAD")
}
ciManagement {
system.set("Github Actions")
url.set("https://github.com/hollow-cube/minestom-ce/actions")
}
}
}
signing {
isRequired = System.getenv("CI") != null
val privateKey = System.getenv("GPG_PRIVATE_KEY")
val keyPassphrase = System.getenv()["GPG_PASSPHRASE"]
useInMemoryPgpKeys(privateKey, keyPassphrase)
sign(publishing.publications)
}
}