fix(userdev): invalidate caches for preceding steps when a step fails (#250)
* userdev: invalidate caches for preceding steps when a step fails a common cause for patch apply failing is decompiling with the wrong jdk, and we don't want to have to manually clean cache to fix it after replacing the jdk * adjust message
This commit is contained in:
parent
a5ae66c59a
commit
a788a9770d
2 changed files with 12 additions and 4 deletions
|
@ -76,8 +76,7 @@ class ApplyDevBundlePatches(
|
|||
op.operate().throwOnError()
|
||||
} catch (ex: Exception) {
|
||||
throw PaperweightException(
|
||||
"Failed to apply dev bundle patches. See the log file at '${log.toFile()}' for more details. " +
|
||||
"Usually, the issue is with the dev bundle itself, and not the userdev project.",
|
||||
"Failed to apply dev bundle patches. See the log file at '${log.toFile()}' for more details.",
|
||||
ex
|
||||
)
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.userdev.internal.setup.step
|
||||
|
||||
import io.papermc.paperweight.PaperweightException
|
||||
import io.papermc.paperweight.userdev.internal.setup.SetupHandler
|
||||
import io.papermc.paperweight.userdev.internal.setup.UserdevSetup
|
||||
import io.papermc.paperweight.userdev.internal.setup.util.HashFunction
|
||||
|
@ -29,6 +30,7 @@ import io.papermc.paperweight.userdev.internal.setup.util.HashFunctionBuilder
|
|||
import io.papermc.paperweight.userdev.internal.setup.util.buildHashFunction
|
||||
import java.nio.file.Path
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import kotlin.io.path.*
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.KProperty1
|
||||
import kotlin.reflect.full.declaredMemberProperties
|
||||
|
@ -73,9 +75,16 @@ object StepExecutor {
|
|||
}
|
||||
}
|
||||
|
||||
try {
|
||||
for (step in steps) {
|
||||
executeStep(context, step)
|
||||
}
|
||||
} catch (ex: Exception) {
|
||||
for (step in steps) {
|
||||
step.hashFile.deleteIfExists()
|
||||
}
|
||||
throw PaperweightException("Failed to execute steps, invalidated relevant caches. Run with --stacktrace for more details.", ex)
|
||||
}
|
||||
}
|
||||
|
||||
fun executeStep(context: SetupHandler.Context, step: SetupStep) {
|
||||
|
|
Loading…
Reference in a new issue