Skip to content

Commit

Permalink
Bump Kotlin Gradle plugin and fix Kotlin daemon crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaming32 committed Jan 4, 2024
1 parent b6e2373 commit 6ab77ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
15 changes: 8 additions & 7 deletions src/test/kotlin/com/replaymod/gradle/remap/util/TestData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -18,37 +19,37 @@ 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.")
}
}
}
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
Expand Down

0 comments on commit 6ab77ad

Please sign in to comment.