From 6ab77ad775048d980d2b2e21f3e2cb49e3c6e8d5 Mon Sep 17 00:00:00 2001 From: "Josiah (Gaming32) Glosson" Date: Thu, 4 Jan 2024 11:51:11 -0600 Subject: [PATCH] Bump Kotlin Gradle plugin and fix Kotlin daemon crash --- build.gradle.kts | 2 +- .../com/replaymod/gradle/remap/util/TestData.kt | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 3f5a284..cca42eb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +1,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - kotlin("jvm") version "1.5.21" + kotlin("jvm") version "1.6.20" `maven-publish` application id("com.github.johnrengelman.shadow") version "7.1.2" diff --git a/src/test/kotlin/com/replaymod/gradle/remap/util/TestData.kt b/src/test/kotlin/com/replaymod/gradle/remap/util/TestData.kt index 9b2b886..700099c 100644 --- a/src/test/kotlin/com/replaymod/gradle/remap/util/TestData.kt +++ b/src/test/kotlin/com/replaymod/gradle/remap/util/TestData.kt @@ -6,6 +6,7 @@ import org.cadixdev.lorenz.MappingSet import java.io.ByteArrayOutputStream import java.io.File import java.net.URL +import java.nio.file.Path import java.nio.file.Paths import kotlin.io.path.absolutePathString @@ -18,21 +19,21 @@ object TestData { } val transformer = Transformer(mappings).apply { - fun findClasspathEntry(cls: String): String { + fun findClasspathEntry(cls: String): Path { val classFilePath = "/${cls.replace('.', '/')}.class" val url = javaClass.getResource(classFilePath) ?: throw RuntimeException("Failed to find $cls on classpath.") return when { url.protocol == "jar" && url.file.endsWith("!$classFilePath") -> { - Paths.get(URL(url.file.removeSuffix("!$classFilePath")).toURI()).absolutePathString() + Paths.get(URL(url.file.removeSuffix("!$classFilePath")).toURI()) } url.protocol == "file" && url.file.endsWith(classFilePath) -> { var path = Paths.get(url.toURI()) repeat(cls.count { it == '.' } + 1) { path = path.parent } - path.absolutePathString() + path } else -> { throw RuntimeException("Do not know how to turn $url into classpath entry.") @@ -40,15 +41,15 @@ object TestData { } } jdkHome = File(System.getProperty("java.home")) - classpath = arrayOf( + classpath = listOf( findClasspathEntry("org.spongepowered.asm.mixin.Mixin"), findClasspathEntry("a.pkg.A"), findClasspathEntry("AMarkerKt"), ) remappedClasspath = arrayOf( - findClasspathEntry("org.spongepowered.asm.mixin.Mixin"), - findClasspathEntry("b.pkg.B"), - findClasspathEntry("BMarkerKt"), + findClasspathEntry("org.spongepowered.asm.mixin.Mixin").absolutePathString(), + findClasspathEntry("b.pkg.B").absolutePathString(), + findClasspathEntry("BMarkerKt").absolutePathString(), ) patternAnnotation = "remap.Pattern" manageImports = true