Skip to content

Commit 793086a

Browse files
committed
fix: resolve deprecation warnings in SetupForkMinecraftSources
1 parent 5728dfc commit 793086a

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/MinecraftPatchingTasks.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ class MinecraftPatchingTasks(
194194

195195
if (project.hasProperty("old${configName.capitalized()}Commit")) {
196196
oldCommit.convention(project.providers.gradleProperty("old${configName.capitalized()}Commit"))
197+
oldOutputDir.set(layout.cache.resolve("$PAPER_PATH/old${configName.capitalized()}"))
197198
}
198199
libraryImports.set(importLibFiles.flatMap { it.outputDir })
199200
atFile.set(mergeCollectedAts.flatMap { it.outputFile })

paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/SetupForkMinecraftSources.kt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import io.papermc.paperweight.core.util.ApplySourceATs
2828
import io.papermc.paperweight.core.util.coreExt
2929
import io.papermc.paperweight.tasks.*
3030
import io.papermc.paperweight.util.*
31-
import io.papermc.paperweight.util.constants.PAPER_PATH
3231
import io.papermc.paperweight.util.constants.paperTaskOutput
3332
import java.util.concurrent.TimeUnit
3433
import kotlin.io.path.*
@@ -60,6 +59,10 @@ abstract class SetupForkMinecraftSources : JavaLauncherTask() {
6059
@get:OutputDirectory
6160
abstract val outputDir: DirectoryProperty
6261

62+
@get:OutputDirectory
63+
@get:Optional
64+
abstract val oldOutputDir: DirectoryProperty
65+
6366
@get:Internal
6467
abstract val atWorkingDir: DirectoryProperty
6568

@@ -88,6 +91,9 @@ abstract class SetupForkMinecraftSources : JavaLauncherTask() {
8891
@get:Input
8992
abstract val identifier: Property<String>
9093

94+
@get:Internal
95+
abstract val forkName: Property<String>
96+
9197
@get:Input
9298
@get:Optional
9399
abstract val oldCommit: Property<String>
@@ -100,6 +106,7 @@ abstract class SetupForkMinecraftSources : JavaLauncherTask() {
100106
atWorkingDir.set(layout.cache.resolve(paperTaskOutput(name = "${name}_atWorkingDir")))
101107
mappingsWorkingDir.set(layout.cache.resolve(paperTaskOutput(name = "${name}_mappingsWorkingDir")))
102108
additionalRemoteName.convention("old")
109+
forkName.convention(project.coreExt.activeFork.map { it.name.capitalized() })
103110
}
104111

105112
@TaskAction
@@ -151,12 +158,12 @@ abstract class SetupForkMinecraftSources : JavaLauncherTask() {
151158
}
152159

153160
private fun setupOld() {
154-
val name = project.coreExt.activeFork.get().name.capitalized()
161+
val name = forkName.get()
155162
logger.lifecycle("Setting up $name commit ${oldCommit.get()} to use as base for 3-way apply...")
156163

157164
val rootProjectDir = layout.projectDirectory.dir("../").path
158-
val oldDir = layout.cache.resolve("$PAPER_PATH/old$name/${oldCommit.get()}")
159-
val oldLog = layout.cache.resolve("$PAPER_PATH/old$name/${oldCommit.get()}.log")
165+
val oldDir = oldOutputDir.get().path.resolve(oldCommit.get())
166+
val oldLog = oldOutputDir.get().path.resolve("${oldCommit.get()}.log")
160167

161168
val oldGit: Git
162169
if (oldDir.exists()) {

0 commit comments

Comments
 (0)