From fe6dbf0377c5eb9da382b9fc7963261dba4b034a Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Fri, 6 Dec 2024 14:02:39 -0700 Subject: [PATCH] Move paperweight use to -server --- build.gradle.kts | 51 +++++------------------------------ gradle.properties | 3 +++ paper-server/build.gradle.kts | 44 +++++++++++++++++++++++++++--- 3 files changed, 51 insertions(+), 47 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index b265f02abd..0252749c00 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,16 +9,14 @@ import java.util.regex.Pattern import kotlin.io.path.* plugins { - java - `maven-publish` - id("io.papermc.paperweight.core") version "2.0.0-SNAPSHOT" + id("io.papermc.paperweight.core") version "2.0.0-SNAPSHOT" apply false } -allprojects { - apply(plugin = "java") +subprojects { + apply(plugin = "java-library") apply(plugin = "maven-publish") - java { + extensions.configure { toolchain { languageVersion = JavaLanguageVersion.of(21) } @@ -51,45 +49,8 @@ subprojects { mavenCentral() maven(paperMavenPublicUrl) } -} -dependencies { - mache("io.papermc:mache:1.21.4+build.3") -} - -paperweight { - softSpoon = true - minecraftVersion = "1.21.4" - // macheOldPath = file("F:\\Projects\\PaperTooling\\mache\\versions\\1.21.4\\src\\main\\java") - // gitFilePatches = true - - paper { - paperServerDir = file("paper-server") - } - - serverProject = project(":paper-server") -} - -tasks.generateDevelopmentBundle { - apiCoordinates = "io.papermc.paper:paper-api" - libraryRepositories.addAll( - "https://repo.maven.apache.org/maven2/", - paperMavenPublicUrl, - ) -} - -publishing { - if (project.providers.gradleProperty("publishDevBundle").isPresent) { - publications.create("devBundle") { - artifact(tasks.generateDevelopmentBundle) { - artifactId = "dev-bundle" - } - } - } -} - -allprojects { - publishing { + extensions.configure { repositories { maven("https://repo.papermc.io/repository/maven-snapshots/") { name = "paperSnapshots" @@ -112,6 +73,7 @@ tasks.register("printPaperVersion") { } // see gradle.properties +/* if (providers.gradleProperty("updatingMinecraft").getOrElse("false").toBoolean()) { tasks.collectAtsFromPatches { val dir = layout.projectDirectory.dir("patches/unapplied/server") @@ -256,3 +218,4 @@ abstract class RebasePatches : BaseTask() { git("add", unappliedPatches.path.toString() + "/*").runSilently() } } + */ diff --git a/gradle.properties b/gradle.properties index 7a2b3bf89e..aeeaa7b209 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,3 +8,6 @@ updatingMinecraft=false org.gradle.caching=true org.gradle.parallel=true org.gradle.vfs.watch=false + +# TODO: this should be removed when we move things to forked JVMs +org.gradle.jvmargs=-Xmx2G diff --git a/paper-server/build.gradle.kts b/paper-server/build.gradle.kts index 56f9075087..4634193258 100644 --- a/paper-server/build.gradle.kts +++ b/paper-server/build.gradle.kts @@ -2,8 +2,46 @@ import io.papermc.paperweight.util.* import java.time.Instant plugins { - java + `java-library` `maven-publish` + id("io.papermc.paperweight.core") +} + +val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/" + +dependencies { + mache("io.papermc:mache:1.21.4+build.5") +} + +paperweight { + softSpoon = true + minecraftVersion = "1.21.4" + // macheOldPath = file("F:\\Projects\\PaperTooling\\mache\\versions\\1.21.4\\src\\main\\java") + // gitFilePatches = true + + paper { + paperServerDir = file("./") + } + + serverProject = project(":paper-server") +} + +tasks.generateDevelopmentBundle { + apiCoordinates = "io.papermc.paper:paper-api" + libraryRepositories.addAll( + "https://repo.maven.apache.org/maven2/", + paperMavenPublicUrl, + ) +} + +publishing { + if (project.providers.gradleProperty("publishDevBundle").isPresent) { + publications.create("devBundle") { + artifact(tasks.generateDevelopmentBundle) { + artifactId = "dev-bundle" + } + } + } } val log4jPlugins = sourceSets.create("log4jPlugins") @@ -225,7 +263,7 @@ tasks.registerRunTask("runDevServer") { tasks.registerRunTask("runBundler") { description = "Spin up a test server from the Mojang mapped bundler jar" - classpath(rootProject.tasks.named("createMojmapBundlerJar").flatMap { it.outputZip }) + classpath(tasks.named("createMojmapBundlerJar").flatMap { it.outputZip }) mainClass.set(null as String?) } // tasks.registerRunTask("runReobfBundler") { @@ -235,7 +273,7 @@ tasks.registerRunTask("runBundler") { // } tasks.registerRunTask("runPaperclip") { description = "Spin up a test server from the Mojang mapped Paperclip jar" - classpath(rootProject.tasks.named("createMojmapPaperclipJar").flatMap { it.outputZip }) + classpath(tasks.named("createMojmapPaperclipJar").flatMap { it.outputZip }) mainClass.set(null as String?) } // tasks.registerRunTask("runReobfPaperclip") {