mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-19 14:59:29 +00:00
Package license into binaries
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
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
|
||||
@@ -73,3 +76,41 @@ paperweight {
|
||||
//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
|
||||
|
||||
Reference in New Issue
Block a user