Move to paperweight v2

Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
This commit is contained in:
MiniDigger | Martin 2024-11-01 08:58:55 +01:00 committed by Nassim Jahnke
parent 4ea25cd504
commit 40ec8fb606
No known key found for this signature in database
GPG key ID: EF6771C01F6EF02F
8 changed files with 87 additions and 121 deletions

24
.gitignore vendored
View file

@ -28,20 +28,6 @@ bin/
dist/
manifest.mf
/work/Temp/
work/1.*
work/Minecraft
work/BuildData
work/Bukkit
work/CraftBukkit
work/Paperclip
work/Spigot
work/Spigot-Server
work/Spigot-API
work/*.jar
work/test-server
work/ForgeFlower
# Mac filesystem dust
.DS_Store/
.DS_Store
@ -63,14 +49,10 @@ out/
run/
logs/
Paper-Server
Paper-API
Paperclip.jar
paperclip.jar
paperclip-*.jar
paperclip.properties
!gradle/wrapper/gradle-wrapper.jar
test-plugin.settings.gradle.kts
paper-api-generator.settings.gradle.kts
# Don't track patched vanilla submodules
paper-server/src/vanilla/

View file

@ -11,7 +11,7 @@ import kotlin.io.path.*
plugins {
java
`maven-publish`
id("io.papermc.paperweight.core") version "1.7.7"
id("io.papermc.paperweight.core") version "2.0.0-SNAPSHOT"
}
allprojects {
@ -53,59 +53,21 @@ subprojects {
}
}
val spigotDecompiler: Configuration by configurations.creating
repositories {
mavenCentral()
maven(paperMavenPublicUrl) {
content {
onlyForConfigurations(
configurations.paperclip.name,
spigotDecompiler.name,
)
}
}
}
dependencies {
paramMappings("net.fabricmc:yarn:1.21.4+build.1:mergedv2")
remapper("net.fabricmc:tiny-remapper:0.10.3:fat")
decompiler("org.vineflower:vineflower:1.10.1")
spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.13")
paperclip("io.papermc:paperclip:3.0.3")
mache("io.papermc:mache:1.21.4+build.3")
}
paperweight {
minecraftVersion = providers.gradleProperty("mcVersion")
serverProject = project(":paper-server")
paramMappingsRepo = paperMavenPublicUrl
remapRepo = paperMavenPublicUrl
decompileRepo = paperMavenPublicUrl
craftBukkit {
fernFlowerJar = layout.file(spigotDecompiler.elements.map { it.single().asFile })
}
softSpoon = true
minecraftVersion = "1.21.4"
// macheOldPath = file("F:\\Projects\\PaperTooling\\mache\\versions\\1.21.4\\src\\main\\java")
// gitFilePatches = true
paper {
spigotApiPatchDir = layout.projectDirectory.dir("patches/api")
spigotServerPatchDir = layout.projectDirectory.dir("patches/server")
mappingsPatch = layout.projectDirectory.file("build-data/mappings-patch.tiny")
reobfMappingsPatch = layout.projectDirectory.file("build-data/reobf-mappings-patch.tiny")
reobfPackagesToFix.addAll(
"co.aikar.timings",
"com.destroystokyo.paper",
"com.mojang",
"io.papermc.paper",
"ca.spottedleaf",
"net.kyori.adventure.bossbar",
"net.minecraft",
"org.bukkit.craftbukkit",
"org.spigotmc",
)
paperServerDir = file("paper-server")
}
serverProject = project(":paper-server")
}
tasks.generateDevelopmentBundle {

View file

@ -40,9 +40,6 @@ dependency-reduced-pom.xml
*.iws
.idea/
/src/main/resources/achievement
/src/main/resources/lang
# vs code
/.vscode
/.factorypath

View file

@ -78,9 +78,6 @@ dependencies {
// Paper end - spark
}
paperweight {
craftBukkitPackageVersion.set("v1_21_R3") // also needs to be updated in MappingEnvironment
}
tasks.jar {
archiveClassifier.set("dev")
@ -107,7 +104,6 @@ tasks.jar {
"Build-Time" to Instant.now().toString(),
"Git-Branch" to gitBranch, // Paper
"Git-Commit" to gitHash, // Paper
"CraftBukkit-Package-Version" to paperweight.craftBukkitPackageVersion.get(), // Paper
)
for (tld in setOf("net", "com", "org")) {
attributes("$tld/bukkit", "Sealed" to true)
@ -127,27 +123,27 @@ publishing {
}
// Paper start
val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.ScanJarForBadCalls::class) {
badAnnotations.add("Lio/papermc/paper/annotation/DoNotUse;")
jarToScan.set(tasks.serverJar.flatMap { it.archiveFile })
classpath.from(configurations.compileClasspath)
}
tasks.check {
dependsOn(scanJar)
}
// val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.ScanJarForBadCalls::class) {
// badAnnotations.add("Lio/papermc/paper/annotation/DoNotUse;")
// jarToScan.set(tasks.serverJar.flatMap { it.archiveFile })
// classpath.from(configurations.compileClasspath)
// }
// tasks.check {
// dependsOn(scanJar)
// }
// Paper end
// Paper start - use TCA for console improvements
tasks.serverJar {
from(alsoShade.elements.map {
it.map { f ->
if (f.asFile.isFile) {
zipTree(f.asFile)
} else {
f.asFile
}
}
})
}
// tasks.serverJar {
// from(alsoShade.elements.map {
// it.map { f ->
// if (f.asFile.isFile) {
// zipTree(f.asFile)
// } else {
// f.asFile
// }
// }
// })
// }
// Paper end - use TCA for console improvements
tasks.test {
@ -204,22 +200,22 @@ fun TaskContainer.registerRunTask(
block(this)
}
val runtimeClasspathWithoutVanillaServer = configurations.runtimeClasspath.flatMap { it.elements }
.zip(configurations.vanillaServer.map { it.singleFile.absolutePath }) { runtime, vanilla ->
runtime.filterNot { it.asFile.absolutePath == vanilla }
}
tasks.registerRunTask("runServer") {
description = "Spin up a test server from the Mojang mapped server jar"
classpath(tasks.includeMappings.flatMap { it.outputJar })
classpath(runtimeClasspathWithoutVanillaServer)
}
tasks.registerRunTask("runReobfServer") {
description = "Spin up a test server from the reobfJar output jar"
classpath(tasks.reobfJar.flatMap { it.outputJar })
classpath(runtimeClasspathWithoutVanillaServer)
}
// val runtimeClasspathWithoutVanillaServer = configurations.runtimeClasspath.flatMap { it.elements }
// .zip(configurations.vanillaServer.map { it.singleFile.absolutePath }) { runtime, vanilla ->
// runtime.filterNot { it.asFile.absolutePath == vanilla }
// }
//
// tasks.registerRunTask("runServer") {
// description = "Spin up a test server from the Mojang mapped server jar"
// classpath(tasks.includeMappings.flatMap { it.outputJar })
// classpath(runtimeClasspathWithoutVanillaServer)
// }
//
// tasks.registerRunTask("runReobfServer") {
// description = "Spin up a test server from the reobfJar output jar"
// classpath(tasks.reobfJar.flatMap { it.outputJar })
// classpath(runtimeClasspathWithoutVanillaServer)
// }
tasks.registerRunTask("runDevServer") {
description = "Spin up a test server without assembling a jar"
@ -232,18 +228,18 @@ tasks.registerRunTask("runBundler") {
classpath(rootProject.tasks.named<io.papermc.paperweight.tasks.CreateBundlerJar>("createMojmapBundlerJar").flatMap { it.outputZip })
mainClass.set(null as String?)
}
tasks.registerRunTask("runReobfBundler") {
description = "Spin up a test server from the reobf bundler jar"
classpath(rootProject.tasks.named<io.papermc.paperweight.tasks.CreateBundlerJar>("createReobfBundlerJar").flatMap { it.outputZip })
mainClass.set(null as String?)
}
// tasks.registerRunTask("runReobfBundler") {
// description = "Spin up a test server from the reobf bundler jar"
// classpath(rootProject.tasks.named<io.papermc.paperweight.tasks.CreateBundlerJar>("createReobfBundlerJar").flatMap { it.outputZip })
// mainClass.set(null as String?)
// }
tasks.registerRunTask("runPaperclip") {
description = "Spin up a test server from the Mojang mapped Paperclip jar"
classpath(rootProject.tasks.named<io.papermc.paperweight.tasks.CreatePaperclipJar>("createMojmapPaperclipJar").flatMap { it.outputZip })
mainClass.set(null as String?)
}
tasks.registerRunTask("runReobfPaperclip") {
description = "Spin up a test server from the reobf Paperclip jar"
classpath(rootProject.tasks.named<io.papermc.paperweight.tasks.CreatePaperclipJar>("createReobfPaperclipJar").flatMap { it.outputZip })
mainClass.set(null as String?)
}
// tasks.registerRunTask("runReobfPaperclip") {
// description = "Spin up a test server from the reobf Paperclip jar"
// classpath(rootProject.tasks.named<io.papermc.paperweight.tasks.CreatePaperclipJar>("createReobfPaperclipJar").flatMap { it.outputZip })
// mainClass.set(null as String?)
// }

View file

View file

@ -33,7 +33,7 @@ if (!file(".git").exists()) {
rootProject.name = "paper"
for (name in listOf("Paper-API", "Paper-Server")) {
for (name in listOf("paper-api", "paper-server")) {
val projName = name.lowercase(Locale.ENGLISH)
include(projName)
file(name).mkdirs()

5
softspoon/.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
buildtools
spigot-mapped
spigot-decomp
vine-decomp
vineflower.jar

24
softspoon/setup.sh Normal file
View file

@ -0,0 +1,24 @@
#!/bin/sh
mkdir "buildtools" || true
(
cd buildtools || exit
wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
#java -jar BuildTools.jar --rev 4369 # random 1.21.3 version
)
echo "copying spigot-mapped"
mkdir "spigot-mapped" || true
cp -r buildtools/work/decompile-7331f017/classes spigot-mapped
echo "copying spigot-decomp"
mkdir "spigot-decomp" || true
cp -r buildtools/work/decompile-7331f017/net spigot-decomp/net
echo "making vine-decomp"
mkdir "vine-decomp" || true
wget https://s01.oss.sonatype.org/content/repositories/snapshots/org/vineflower/vineflower/1.11.0-SNAPSHOT/vineflower-1.11.0-20240911.205325-50.jar -O vineflower.jar
# todo double check vineflower version and arguments, rn this is mache stuff
java -jar vineflower.jar --synthetic-not-set=true --ternary-constant-simplification=true --include-runtime=current --decompile-complex-constant-dynamic=true --indent-string=" " --decompile-inner=true --remove-bridge=true --decompile-generics=true --ascii-strings=false --remove-synthetic=true --include-classpath=true --inline-simple-lambdas=true --ignore-invalid-bytecode=false --bytecode-source-mapping=true --dump-code-lines=true --override-annotation=false --skip-extra-files=true spigot-mapped/classes vine-decomp
# todo spigot and vf decompile a paper (old) remapped jar (just steal from some paper project cache folder)