2021-06-13 07:42:41 +08:00
|
|
|
import io.papermc.paperweight.util.Git
|
|
|
|
|
2020-12-18 21:04:33 +08:00
|
|
|
plugins {
|
2021-06-13 02:51:24 +08:00
|
|
|
java
|
|
|
|
id("com.github.johnrengelman.shadow") version "7.0.0" apply false
|
2021-06-13 07:42:41 +08:00
|
|
|
id("io.papermc.paperweight.patcher") version "1.0.0-SNAPSHOT"
|
2020-12-18 21:04:33 +08:00
|
|
|
}
|
|
|
|
|
2021-06-13 18:23:53 +08:00
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
maven("https://wav.jfrog.io/artifactory/repo/") {
|
|
|
|
content {
|
|
|
|
onlyForConfigurations("paperclip")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
maven("https://maven.quiltmc.org/repository/release/") {
|
|
|
|
content {
|
|
|
|
onlyForConfigurations("remapper")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2021-06-13 18:58:48 +08:00
|
|
|
remapper("org.quiltmc:tiny-remapper:0.4.1")
|
|
|
|
paperclip("io.papermc:paperclip:2.0.0-SNAPSHOT@jar")
|
2021-06-13 18:23:53 +08:00
|
|
|
}
|
2020-12-18 21:04:33 +08:00
|
|
|
|
2021-06-13 07:42:41 +08:00
|
|
|
subprojects {
|
2021-06-13 02:51:24 +08:00
|
|
|
apply(plugin = "java")
|
2020-12-18 21:04:33 +08:00
|
|
|
|
2021-06-13 02:51:24 +08:00
|
|
|
java {
|
|
|
|
toolchain {
|
|
|
|
languageVersion.set(JavaLanguageVersion.of(16))
|
|
|
|
}
|
2020-12-18 21:04:33 +08:00
|
|
|
}
|
|
|
|
|
2021-06-13 02:51:24 +08:00
|
|
|
tasks.withType<JavaCompile>().configureEach {
|
|
|
|
options.encoding = "UTF-8"
|
|
|
|
options.release.set(16)
|
|
|
|
}
|
|
|
|
|
2020-12-18 21:04:33 +08:00
|
|
|
repositories {
|
2021-06-13 02:51:24 +08:00
|
|
|
mavenCentral()
|
|
|
|
maven("https://oss.sonatype.org/content/groups/public/")
|
|
|
|
maven("https://papermc.io/repo/repository/maven-public/")
|
|
|
|
maven("https://ci.emc.gs/nexus/content/groups/aikar/")
|
|
|
|
maven("https://repo.aikar.co/content/groups/aikar")
|
|
|
|
maven("https://repo.md-5.net/content/repositories/releases/")
|
|
|
|
maven("https://hub.spigotmc.org/nexus/content/groups/public/")
|
2020-12-18 21:04:33 +08:00
|
|
|
maven("https://nexus.velocitypowered.com/repository/velocity-artifacts-snapshots/")
|
2021-06-13 07:42:41 +08:00
|
|
|
maven("https://oss.sonatype.org/content/repositories/snapshots/")
|
2020-12-18 21:04:33 +08:00
|
|
|
}
|
2021-06-13 02:51:24 +08:00
|
|
|
}
|
2020-12-18 21:04:33 +08:00
|
|
|
|
2021-06-13 20:39:12 +08:00
|
|
|
/*
|
2021-06-13 07:42:41 +08:00
|
|
|
val paperDir = layout.projectDirectory.dir("Paper")
|
2021-06-13 20:39:12 +08:00
|
|
|
val paperBranch = "dev/1.17"
|
|
|
|
|
2021-06-13 07:42:41 +08:00
|
|
|
val initSubmodules by tasks.registering {
|
2021-06-13 20:39:12 +08:00
|
|
|
group = "paperweight"
|
|
|
|
|
2021-06-13 07:42:41 +08:00
|
|
|
outputs.upToDateWhen { false }
|
|
|
|
doLast {
|
|
|
|
paperDir.asFile.mkdirs()
|
2021-06-13 20:39:12 +08:00
|
|
|
Git(layout.projectDirectory)("submodule", "update", "--init", "--recursive").executeOut()
|
2021-06-13 07:42:41 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-13 20:39:12 +08:00
|
|
|
val upstreamUpdate by tasks.registering {
|
|
|
|
group = "paperweight"
|
|
|
|
|
|
|
|
outputs.upToDateWhen { false }
|
|
|
|
finalizedBy(cleanUpstreamCaches)
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
Git(paperDir)("fetch").executeOut()
|
|
|
|
Git(paperDir)("clean", "-fd").executeOut()
|
|
|
|
Git(paperDir)("reset", "--hard", "origin/$paperBranch").executeOut()
|
|
|
|
Git(layout.projectDirectory)("add", "--force", paperDir.asFile.name).executeOut()
|
|
|
|
Git(layout.projectDirectory)("submodule", "update", "--init", "--recursive").executeOut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
val cleanUpstreamCaches by tasks.registering(GradleBuild::class) {
|
|
|
|
dir = paperDir.asFile
|
|
|
|
tasks = listOf("cleanCache")
|
|
|
|
}
|
|
|
|
|
|
|
|
val upstreamCommit by tasks.registering {
|
|
|
|
group = "paperweight"
|
|
|
|
|
|
|
|
outputs.upToDateWhen { false }
|
|
|
|
doLast {
|
|
|
|
val old = Git(layout.projectDirectory)("ls-tree", "HEAD", paperDir.asFile.name).readText()
|
|
|
|
?.substringAfter("commit ")?.substringBefore("\t")
|
|
|
|
val changes = Git(paperDir)("log", "--oneline", "$old...HEAD").readText()
|
|
|
|
changes ?: run {
|
|
|
|
println("No changes to commit?")
|
|
|
|
return@doLast
|
|
|
|
}
|
|
|
|
val commitMessage = """
|
|
|
|
|Updated Upstream (Paper)
|
|
|
|
|
|
|
|
|
|Upstream has released updates that appear to apply and compile correctly.
|
|
|
|
|
|
|
|
|
|Paper Changes:
|
|
|
|
|$changes
|
|
|
|
""".trimMargin()
|
|
|
|
Git(layout.projectDirectory)("commit", "-m", commitMessage).executeOut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2021-06-13 02:51:24 +08:00
|
|
|
paperweight {
|
|
|
|
serverProject.set(project(":Purpur-Server"))
|
|
|
|
|
2021-06-13 18:58:48 +08:00
|
|
|
usePaperUpstream(providers.gradleProperty("paperRef")) {
|
|
|
|
withPaperPatcher {
|
|
|
|
apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
|
|
|
|
apiOutputDir.set(layout.projectDirectory.dir("Purpur-API"))
|
|
|
|
|
|
|
|
serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
|
|
|
|
serverOutputDir.set(layout.projectDirectory.dir("Purpur-Server"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-13 20:39:12 +08:00
|
|
|
/*
|
2021-06-13 07:42:41 +08:00
|
|
|
upstreams {
|
|
|
|
register("paper") {
|
|
|
|
upstreamDataTask {
|
|
|
|
dependsOn(initSubmodules)
|
|
|
|
projectDir.set(paperDir)
|
|
|
|
workDir.set(layout.projectDirectory)
|
|
|
|
}
|
2021-06-13 02:51:24 +08:00
|
|
|
|
2021-06-13 07:42:41 +08:00
|
|
|
patchTasks {
|
|
|
|
register("api") {
|
|
|
|
sourceDir.set(paperDir.dir("Paper-API"))
|
|
|
|
patchDir.set(layout.projectDirectory.dir("patches/api"))
|
|
|
|
outputDir.set(layout.projectDirectory.dir("Purpur-API"))
|
|
|
|
}
|
|
|
|
register("server") {
|
|
|
|
sourceDir.set(paperDir.dir("Paper-Server"))
|
|
|
|
patchDir.set(layout.projectDirectory.dir("patches/server"))
|
|
|
|
outputDir.set(layout.projectDirectory.dir("Purpur-Server"))
|
|
|
|
}
|
|
|
|
}
|
2021-06-13 02:51:24 +08:00
|
|
|
}
|
2020-12-20 16:21:38 +08:00
|
|
|
}
|
2021-06-13 20:39:12 +08:00
|
|
|
*/
|
|
|
|
}
|