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
2023-08-21 21:46:38 +02:00

117 lines
3.5 KiB
Plaintext

import io.papermc.paperweight.tasks.CollectATsFromPatches
import io.papermc.paperweight.util.path
import org.gradle.configurationcache.extensions.capitalized
import kotlin.io.path.deleteRecursively
plugins {
java
`maven-publish`
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
id("io.papermc.paperweight.patcher") version "1.5.5"
id("com.github.ManifestClasspath") version "0.1.0-RELEASE"
}
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
repositories {
mavenCentral()
maven(paperMavenPublicUrl) {
content { onlyForConfigurations(configurations.paperclip.name) }
}
}
dependencies {
remapper("net.fabricmc:tiny-remapper:0.8.6:fat")
decompiler("net.minecraftforge:forgeflower:2.0.627.2")
paperclip("io.papermc:paperclip:3.0.3")
}
allprojects {
apply(plugin = "java")
apply(plugin = "maven-publish")
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
}
subprojects {
tasks.withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
}
tasks.withType<Javadoc> {
options.encoding = Charsets.UTF_8.name()
}
tasks.withType<ProcessResources> {
filteringCharset = Charsets.UTF_8.name()
}
repositories {
mavenCentral()
maven(paperMavenPublicUrl)
}
}
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
}
}
}
// Uncomment while updating for a new Minecraft version
//tasks.withType<CollectATsFromPatches> {
// extraPatchDir.set(layout.projectDirectory.dir("patches/unapplied/server"))
//}
// Gale start - branding changes - package license into jar
for (classifier in arrayOf("mojmap", "reobf")) {
// Based on io.papermc.paperweight.taskcontainers.BundlerJarTasks
tasks.named("create${classifier.capitalized()}PaperclipJar") {
doLast {
// Based on io.papermc.paperweight.taskcontainers.BundlerJarTasks
val jarName = listOfNotNull(
project.name,
"paperclip",
project.version,
classifier
).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