9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-19 14:59:29 +00:00
Files
Gale/build.gradle.kts
2024-12-13 00:14:12 -05:00

145 lines
4.2 KiB
Plaintext

import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import io.papermc.paperweight.util.path
import kotlin.io.path.deleteRecursively
plugins {
java
`maven-publish`
id("io.papermc.paperweight.patcher") version "1.7.7"
}
allprojects {
apply(plugin = "java")
apply(plugin = "maven-publish")
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}
}
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
subprojects {
tasks.withType<JavaCompile>().configureEach {
options.encoding = Charsets.UTF_8.name()
options.release.set(21)
}
tasks.withType<Javadoc> {
options.encoding = Charsets.UTF_8.name()
}
tasks.withType<ProcessResources> {
filteringCharset = Charsets.UTF_8.name()
}
tasks.withType<Test> {
testLogging {
showStackTraces = true
exceptionFormat = TestExceptionFormat.FULL
events(TestLogEvent.STANDARD_OUT)
}
}
repositories {
mavenCentral()
maven(paperMavenPublicUrl)
}
}
repositories {
mavenCentral()
maven(paperMavenPublicUrl) {
content {
onlyForConfigurations(configurations.paperclip.name)
}
}
}
dependencies {
remapper("net.fabricmc:tiny-remapper:0.10.3:fat")
decompiler("org.vineflower:vineflower:1.10.1")
paperclip("io.papermc:paperclip:3.0.3")
}
paperweight {
serverProject.set(project(":gale-server")) // Gale - build changes
remapRepo.set(paperMavenPublicUrl)
decompileRepo.set(paperMavenPublicUrl)
usePaperUpstream(providers.gradleProperty("paperRef")) {
withPaperPatcher {
apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
apiOutputDir.set(layout.projectDirectory.dir("gale-api")) // Gale - build changes
serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
serverOutputDir.set(layout.projectDirectory.dir("gale-server")) // Gale - build changes
}
patchTasks.register("generatedApi") {
isBareDirectory = true
upstreamDirPath = "paper-api-generator/generated"
patchDir = layout.projectDirectory.dir("patches/generated-api")
outputDir = layout.projectDirectory.dir("paper-api-generator/generated")
}
}
}
// Uncomment while updating for a new Minecraft version
//tasks.withType<io.papermc.paperweight.tasks.CollectATsFromPatches> {
// extraPatchDir.set(layout.projectDirectory.dir("patches/unapplied/server"))
//}
// tasks.withType<io.papermc.paperweight.tasks.RebuildGitPatches> {
// filterPatches.set(false)
// }
tasks.register("printMinecraftVersion") {
doLast {
println(providers.gradleProperty("mcVersion").get().trim())
}
}
tasks.register("printGaleVersion") { // Gale - branding changes
doLast {
println(project.version)
}
}
// Gale start - branding changes - package license into jar
// Based on io.papermc.paperweight.taskcontainers.BundlerJarTasks
tasks.named("createMojmapPaperclipJar") {
doLast {
// Based on io.papermc.paperweight.taskcontainers.BundlerJarTasks
val jarName = listOfNotNull(
project.name,
"paperclip",
project.version,
"mojmap"
).joinToString("-") + ".jar"
// Based on io.papermc.paperweight.taskcontainers.BundlerJarTasks
val zipFile = layout.buildDirectory.file("libs/$jarName").path
val rootDir = io.papermc.paperweight.util.findOutputDir(zipFile)
try {
io.papermc.paperweight.util.unzip(zipFile, rootDir)
val licenseFileName = "LICENSE.txt"
project(":gale-server").projectDir.resolve(licenseFileName)
.copyTo(rootDir.resolve(licenseFileName).toFile())
io.papermc.paperweight.util.ensureDeleted(zipFile)
io.papermc.paperweight.util.zip(rootDir, zipFile)
} finally {
@OptIn(kotlin.io.path.ExperimentalPathApi::class)
rootDir.deleteRecursively()
}
}
}
// Gale end - branding changes - package license into jar