Files

98 lines
2.9 KiB
Kotlin

import org.gradle.api.GradleException
import org.gradle.api.tasks.testing.Test
import dev.projectcapture.buildlogic.VerifyFanProjectPolicy
plugins {
base
}
group = "dev.projectcapture"
version = "0.1.0"
allprojects {
group = rootProject.group
version = rootProject.version
repositories {
mavenCentral()
maven {
name = "hytaleRelease"
url = uri("https://maven.hytale.com/release")
mavenContent { releasesOnly() }
}
}
}
subprojects {
plugins.withId("java") {
extensions.configure<JavaPluginExtension> {
toolchain.languageVersion.set(JavaLanguageVersion.of(25))
withSourcesJar()
}
tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
options.release.set(25)
options.compilerArgs.addAll(listOf("-Xlint:all", "-parameters"))
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
testLogging {
events("failed", "skipped")
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
}
}
}
val verifyFanProjectPolicy = tasks.register<VerifyFanProjectPolicy>("verifyFanProjectPolicy") {
group = "verification"
description = "Verifies the public, non-commercial and unofficial fan-project safeguards."
projectRoot.set(layout.projectDirectory)
}
tasks.named("check") {
dependsOn(
verifyFanProjectPolicy,
":engine:check",
":content-pokemon:check",
":content-tools:check",
":hytale-adapter:check",
)
}
tasks.register("fanBuild") {
group = "build"
description = "Builds and verifies the unofficial non-commercial fan mod."
dependsOn("check", ":hytale-adapter:fanModJar")
}
val releaseReviewFile = layout.projectDirectory.file("release-review.json").asFile
tasks.register("publish") {
group = "release"
description = "Guarded public publishing entry point; no upload is performed by this task."
doFirst {
if (!releaseReviewFile.isFile || !releaseReviewFile.readText().contains("\"approved\": true")) {
throw GradleException(
"Release review is missing. Copy release-review.example.json to release-review.json, " +
"complete the Hytale and third-party-rights review, then set approved to true."
)
}
}
}
tasks.register("release") {
group = "release"
description = "Guarded release entry point; requires a current manual policy review."
doFirst {
if (!releaseReviewFile.isFile || !releaseReviewFile.readText().contains("\"approved\": true")) {
throw GradleException(
"Release review is missing. Copy release-review.example.json to release-review.json, " +
"complete the Hytale and third-party-rights review, then set approved to true."
)
}
}
}