Skip to content

Commit 6e0c877

Browse files
committed
Update paperweight to 2.0.0-beta.6
1 parent fd1b6b1 commit 6e0c877

File tree

3 files changed

+66
-64
lines changed

3 files changed

+66
-64
lines changed

build.gradle.kts

+16-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import io.papermc.paperweight.util.*
2+
import io.papermc.paperweight.util.constants.*
23
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
34
import org.gradle.api.tasks.testing.logging.TestLogEvent
45
import java.io.IOException
@@ -11,7 +12,7 @@ import java.nio.file.Path
1112
import kotlin.random.Random
1213

1314
plugins {
14-
id("io.papermc.paperweight.core") version "2.0.0-beta.5" apply false
15+
id("io.papermc.paperweight.core") version "2.0.0-beta.6" apply false
1516
}
1617

1718
subprojects {
@@ -146,19 +147,18 @@ tasks.register("checkWork") {
146147
return Path.of(path.replaceFirst("^~".toRegex(), System.getProperty("user.home")))
147148
}
148149

149-
val input = layout.cache.resolve("last-updating-folder").readText().trim()
150-
val patchFolder = layout.projectDirectory.file("paper-server/patches/sources").convertToPath().resolve(input)
151-
val sourceFolder = layout.projectDirectory.file("paper-server/src/vanilla/java/").convertToPath().resolve(input)
152-
val targetFolder = expandUserHome(
153-
providers.gradleProperty("cleanPaperRepo").orNull
154-
?: error("cleanPaperRepo is required, define it in gradle.properties")
155-
).resolve(input)
150+
val input = providers.fileContents(layout.projectDirectory.file("$CACHE_PATH/last-updating-folder")).asText.map { it.trim() }
151+
val patchFolder = layout.projectDirectory.dir("paper-server/patches/sources").dir(input)
152+
val sourceFolder = layout.projectDirectory.dir("paper-server/src/vanilla/java").dir(input)
153+
val targetFolder = providers.gradleProperty("cleanPaperRepo").map {
154+
expandUserHome(it).resolve(input.get())
155+
}
156156

157157
fun copy(back: Boolean = false) {
158-
patchFolder.listDirectoryEntries().forEach {
159-
val relative = patchFolder.relativize(it).toString().replace(".patch", "")
160-
val source = sourceFolder.resolve(relative)
161-
val target = targetFolder.resolve(relative)
158+
patchFolder.path.listDirectoryEntries().forEach {
159+
val relative = patchFolder.path.relativize(it).toString().replace(".patch", "")
160+
val source = sourceFolder.path.resolve(relative)
161+
val target = targetFolder.get().resolve(relative)
162162
if (target.isDirectory()) { return@forEach }
163163
if (back) {
164164
target.copyTo(source, overwrite = true)
@@ -169,8 +169,11 @@ tasks.register("checkWork") {
169169
}
170170

171171
doLast {
172+
if (!targetFolder.isPresent) {
173+
error("cleanPaperRepo is required, define it in gradle.properties")
174+
}
172175
copy()
173-
val files = patchFolder.listDirectoryEntries().map { it.fileName.toString().replace(".patch", "") }
176+
val files = patchFolder.path.listDirectoryEntries().map { it.fileName.toString().replace(".patch", "") }
174177
println("Copied $files from $sourceFolder to $targetFolder")
175178
println("Make the files compile, then press enter to copy them back!")
176179
System.`in`.read()

gradle.properties

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ mcVersion=1.21.4
66
updatingMinecraft=false
77
updateTaskListIssue=https://github.com/PaperMC/Paper/issues/11736
88

9-
# todo - bundler/paperclip tasks not compatible yet when using libraries
10-
org.gradle.configuration-cache=false
9+
org.gradle.configuration-cache=true
1110
org.gradle.caching=true
1211
org.gradle.parallel=true
1312
org.gradle.vfs.watch=false

paper-server/build.gradle.kts

+49-49
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
1313
dependencies {
1414
mache("io.papermc:mache:1.21.4+build.6")
1515
paperclip("io.papermc:paperclip:3.0.3")
16-
remapper("net.fabricmc:tiny-remapper:0.10.3:fat")
1716
}
1817

1918
paperweight {
@@ -23,23 +22,24 @@ paperweight {
2322

2423
paper {
2524
reobfMappingsPatch = layout.projectDirectory.file("../build-data/reobf-mappings-patch.tiny")
26-
reobfPackagesToFix.addAll(
27-
"co.aikar.timings",
28-
"com.destroystokyo.paper",
29-
"com.mojang",
30-
"io.papermc.paper",
31-
"ca.spottedleaf",
32-
"net.kyori.adventure.bossbar",
33-
"net.minecraft",
34-
"org.bukkit.craftbukkit",
35-
"org.spigotmc",
36-
)
3725
}
3826

3927
spigot {
4028
buildDataRef = "3edaf46ec1eed4115ce1b18d2846cded42577e42"
4129
packageVersion = "v1_21_R3" // also needs to be updated in MappingEnvironment
4230
}
31+
32+
reobfPackagesToFix.addAll(
33+
"co.aikar.timings",
34+
"com.destroystokyo.paper",
35+
"com.mojang",
36+
"io.papermc.paper",
37+
"ca.spottedleaf",
38+
"net.kyori.adventure.bossbar",
39+
"net.minecraft",
40+
"org.bukkit.craftbukkit",
41+
"org.spigotmc",
42+
)
4343
}
4444

4545
tasks.generateDevelopmentBundle {
@@ -58,45 +58,45 @@ abstract class Services {
5858
}
5959
val services = objects.newInstance<Services>()
6060

61-
publishing {
62-
if (project.providers.gradleProperty("publishDevBundle").isPresent) {
63-
val devBundleComponent = services.softwareComponentFactory.adhoc("devBundle")
64-
components.add(devBundleComponent)
61+
if (project.providers.gradleProperty("publishDevBundle").isPresent) {
62+
val devBundleComponent = services.softwareComponentFactory.adhoc("devBundle")
63+
components.add(devBundleComponent)
6564

66-
val devBundle = configurations.consumable("devBundle") {
67-
attributes.attribute(DevBundleOutput.ATTRIBUTE, objects.named(DevBundleOutput.ZIP))
68-
outgoing.artifact(tasks.generateDevelopmentBundle.flatMap { it.devBundleFile })
69-
}
70-
devBundleComponent.addVariantsFromConfiguration(devBundle.get()) {}
65+
val devBundle = configurations.consumable("devBundle") {
66+
attributes.attribute(DevBundleOutput.ATTRIBUTE, objects.named(DevBundleOutput.ZIP))
67+
outgoing.artifact(tasks.generateDevelopmentBundle.flatMap { it.devBundleFile })
68+
}
69+
devBundleComponent.addVariantsFromConfiguration(devBundle.get()) {}
7170

72-
val runtime = configurations.consumable("serverRuntimeClasspath") {
73-
attributes.attribute(DevBundleOutput.ATTRIBUTE, objects.named(DevBundleOutput.SERVER_DEPENDENCIES))
74-
attributes.attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
75-
extendsFrom(configurations.runtimeClasspath.get())
76-
}
77-
devBundleComponent.addVariantsFromConfiguration(runtime.get()) {
78-
mapToMavenScope("runtime")
79-
}
71+
val runtime = configurations.consumable("serverRuntimeClasspath") {
72+
attributes.attribute(DevBundleOutput.ATTRIBUTE, objects.named(DevBundleOutput.SERVER_DEPENDENCIES))
73+
attributes.attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
74+
extendsFrom(configurations.runtimeClasspath.get())
75+
}
76+
devBundleComponent.addVariantsFromConfiguration(runtime.get()) {
77+
mapToMavenScope("runtime")
78+
}
8079

81-
val compile = configurations.consumable("serverCompileClasspath") {
82-
attributes.attribute(DevBundleOutput.ATTRIBUTE, objects.named(DevBundleOutput.SERVER_DEPENDENCIES))
83-
attributes.attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_API))
84-
extendsFrom(configurations.compileClasspath.get())
85-
}
86-
devBundleComponent.addVariantsFromConfiguration(compile.get()) {
87-
mapToMavenScope("compile")
88-
}
80+
val compile = configurations.consumable("serverCompileClasspath") {
81+
attributes.attribute(DevBundleOutput.ATTRIBUTE, objects.named(DevBundleOutput.SERVER_DEPENDENCIES))
82+
attributes.attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_API))
83+
extendsFrom(configurations.compileClasspath.get())
84+
}
85+
devBundleComponent.addVariantsFromConfiguration(compile.get()) {
86+
mapToMavenScope("compile")
87+
}
8988

90-
tasks.withType(GenerateMavenPom::class).configureEach {
91-
doLast {
92-
val text = destination.readText()
93-
// Remove dependencies from pom, dev bundle is designed for gradle module metadata consumers
94-
destination.writeText(
95-
text.substringBefore("<dependencies>") + text.substringAfter("</dependencies>")
96-
)
97-
}
89+
tasks.withType(GenerateMavenPom::class).configureEach {
90+
doLast {
91+
val text = destination.readText()
92+
// Remove dependencies from pom, dev bundle is designed for gradle module metadata consumers
93+
destination.writeText(
94+
text.substringBefore("<dependencies>") + text.substringAfter("</dependencies>")
95+
)
9896
}
97+
}
9998

99+
publishing {
100100
publications.create<MavenPublication>("devBundle") {
101101
artifactId = "dev-bundle"
102102
from(devBundleComponent)
@@ -317,21 +317,21 @@ tasks.registerRunTask("runDevServer") {
317317

318318
tasks.registerRunTask("runBundler") {
319319
description = "Spin up a test server from the Mojang mapped bundler jar"
320-
classpath(tasks.named<io.papermc.paperweight.tasks.CreateBundlerJar>("createMojmapBundlerJar").flatMap { it.outputZip })
320+
classpath(tasks.createMojmapBundlerJar.flatMap { it.outputZip })
321321
mainClass.set(null as String?)
322322
}
323323
tasks.registerRunTask("runReobfBundler") {
324324
description = "Spin up a test server from the reobf bundler jar"
325-
classpath(tasks.named<io.papermc.paperweight.tasks.CreateBundlerJar>("createReobfBundlerJar").flatMap { it.outputZip })
325+
classpath(tasks.createReobfBundlerJar.flatMap { it.outputZip })
326326
mainClass.set(null as String?)
327327
}
328328
tasks.registerRunTask("runPaperclip") {
329329
description = "Spin up a test server from the Mojang mapped Paperclip jar"
330-
classpath(tasks.named<io.papermc.paperweight.tasks.CreatePaperclipJar>("createMojmapPaperclipJar").flatMap { it.outputZip })
330+
classpath(tasks.createMojmapPaperclipJar.flatMap { it.outputZip })
331331
mainClass.set(null as String?)
332332
}
333333
tasks.registerRunTask("runReobfPaperclip") {
334334
description = "Spin up a test server from the reobf Paperclip jar"
335-
classpath(tasks.named<io.papermc.paperweight.tasks.CreatePaperclipJar>("createReobfPaperclipJar").flatMap { it.outputZip })
335+
classpath(tasks.createReobfPaperclipJar.flatMap { it.outputZip })
336336
mainClass.set(null as String?)
337337
}

0 commit comments

Comments
 (0)