2023-11-29 22:41:07 +01:00
|
|
|
import java.time.Duration
|
|
|
|
|
2022-01-01 18:27:52 +01:00
|
|
|
plugins {
|
|
|
|
`java-library`
|
2022-12-31 04:09:07 +01:00
|
|
|
alias(libs.plugins.blossom)
|
2023-05-06 22:18:22 +02:00
|
|
|
|
|
|
|
`maven-publish`
|
|
|
|
signing
|
|
|
|
alias(libs.plugins.nexuspublish)
|
2022-01-01 18:27:52 +01:00
|
|
|
}
|
|
|
|
|
2023-11-23 11:46:53 +01:00
|
|
|
// Read env vars (used for publishing generally)
|
|
|
|
version = System.getenv("MINESTOM_VERSION") ?: "dev"
|
2023-11-23 17:13:09 +01:00
|
|
|
val channel = System.getenv("MINESTOM_CHANNEL") ?: "local" // local, snapshot, release
|
|
|
|
|
2023-12-19 00:01:52 +01:00
|
|
|
val shortDescription = "1.20.4 Lightweight Minecraft server"
|
2023-05-06 22:18:22 +02:00
|
|
|
|
2022-01-01 18:27:52 +01:00
|
|
|
allprojects {
|
2023-05-06 22:18:22 +02:00
|
|
|
apply(plugin = "java")
|
|
|
|
|
|
|
|
group = "net.minestom"
|
|
|
|
version = rootProject.version
|
2023-11-23 17:13:09 +01:00
|
|
|
description = shortDescription
|
2023-05-06 22:18:22 +02:00
|
|
|
|
|
|
|
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")
|
|
|
|
}
|
2023-10-16 00:00:59 +02:00
|
|
|
|
|
|
|
tasks.withType<JavaCompile> {
|
|
|
|
options.encoding = "UTF-8"
|
|
|
|
}
|
2022-01-01 18:27:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
main {
|
2023-05-06 22:18:22 +02:00
|
|
|
java.srcDir(file("src/main/java"))
|
|
|
|
java.srcDir(file("src/autogenerated/java"))
|
2022-01-01 18:27:52 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-06 22:18:22 +02:00
|
|
|
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"))
|
2022-01-01 18:27:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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()}/")
|
|
|
|
}
|
|
|
|
}
|
2022-12-31 04:09:07 +01:00
|
|
|
|
|
|
|
blossom {
|
2023-05-06 22:18:22 +02:00
|
|
|
val gitFile = "src/main/java/net/minestom/server/Git.java"
|
2022-12-31 04:09:07 +01:00
|
|
|
|
|
|
|
val gitCommit = System.getenv("GIT_COMMIT")
|
|
|
|
val gitBranch = System.getenv("GIT_BRANCH")
|
|
|
|
val group = System.getenv("GROUP")
|
|
|
|
val artifact = System.getenv("ARTIFACT")
|
|
|
|
|
2023-05-06 22:18:22 +02:00
|
|
|
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)
|
2022-12-31 04:09:07 +01:00
|
|
|
}
|
|
|
|
|
2023-05-06 22:18:22 +02:00
|
|
|
nexusPublishing{
|
|
|
|
useStaging.set(true)
|
|
|
|
this.packageGroup.set("dev.hollowcube")
|
2022-01-01 18:27:52 +01:00
|
|
|
|
2023-11-29 22:41:07 +01:00
|
|
|
transitionCheckOptions {
|
|
|
|
maxRetries.set(360) // 1 hour
|
|
|
|
delayBetween.set(Duration.ofSeconds(10))
|
|
|
|
}
|
|
|
|
|
2023-05-06 22:18:22 +02:00
|
|
|
repositories.sonatype {
|
|
|
|
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
|
|
|
|
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
|
2022-01-01 18:27:52 +01:00
|
|
|
|
2023-05-06 22:18:22 +02:00
|
|
|
if (System.getenv("SONATYPE_USERNAME") != null) {
|
|
|
|
username.set(System.getenv("SONATYPE_USERNAME"))
|
|
|
|
password.set(System.getenv("SONATYPE_PASSWORD"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-01-01 18:27:52 +01:00
|
|
|
|
2023-05-06 22:18:22 +02:00
|
|
|
publishing.publications.create<MavenPublication>("maven") {
|
|
|
|
groupId = "dev.hollowcube"
|
2023-11-23 11:46:53 +01:00
|
|
|
artifactId = if (channel == "snapshot") "minestom-ce-snapshots" else "minestom-ce"
|
2023-05-06 22:18:22 +02:00
|
|
|
version = project.version.toString()
|
|
|
|
|
|
|
|
from(project.components["java"])
|
|
|
|
|
|
|
|
pom {
|
2023-11-23 17:13:09 +01:00
|
|
|
name.set(this@create.artifactId)
|
|
|
|
description.set(shortDescription)
|
2023-05-06 22:18:22 +02:00
|
|
|
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")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-01-01 18:27:52 +01:00
|
|
|
|
2023-05-06 22:18:22 +02:00
|
|
|
signing {
|
|
|
|
isRequired = System.getenv("CI") != null
|
2022-01-01 18:27:52 +01:00
|
|
|
|
2023-05-06 22:18:22 +02:00
|
|
|
val privateKey = System.getenv("GPG_PRIVATE_KEY")
|
|
|
|
val keyPassphrase = System.getenv()["GPG_PASSPHRASE"]
|
|
|
|
useInMemoryPgpKeys(privateKey, keyPassphrase)
|
2022-01-01 18:27:52 +01:00
|
|
|
|
2023-05-06 22:18:22 +02:00
|
|
|
sign(publishing.publications)
|
|
|
|
}
|
2022-01-01 18:27:52 +01:00
|
|
|
}
|