From e49dc899920dce06383cb7f9bd3cba5316cda09b Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Sat, 21 Nov 2020 16:48:49 +0100 Subject: Update kotlin-compiler-embeddable to 1.3.72 Since 1.3.70, the Kotlin compiler by default uses an internal framework to read binary Java class files instead of relying on IntelliJ's PSI to do it for them. This internal framework was introduced in commit d65af8f to reduce the amount of unnecessary work done by the PSI model. Our entire mapper was written for the PSI model though (and remains to be because it must also support Java), so it would fail to remap any Kotlin files if kotlin-compiler-embeddable was upgraded (for whatever reason) to at least 70 where the new behavior became the default. Luckily there exists a config flag (renamed in the same version) which allows us to go back to the PSI reader, so that's what this commit does. --- src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt b/src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt index ed3b53c..85e5acd 100644 --- a/src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt +++ b/src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt @@ -26,6 +26,7 @@ import org.jetbrains.kotlin.com.intellij.psi.PsiManager import org.jetbrains.kotlin.com.intellij.psi.search.GlobalSearchScope import org.jetbrains.kotlin.config.CommonConfigurationKeys import org.jetbrains.kotlin.config.CompilerConfiguration +import org.jetbrains.kotlin.config.JVMConfigurationKeys import org.jetbrains.kotlin.psi.KtFile import java.io.BufferedReader import java.io.File @@ -59,6 +60,9 @@ class Transformer(private val map: MappingSet) { config.addAll(CLIConfigurationKeys.CONTENT_ROOTS, classpath!!.map { JvmClasspathRoot(File(it)) }) config.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, PrintingMessageCollector(System.err, MessageRenderer.GRADLE_STYLE, true)) + // Our PsiMapper only works with the PSI tree elements, not with the faster (but kotlin-specific) classes + config.put(JVMConfigurationKeys.USE_PSI_CLASS_FILES_READING, true) + val environment = KotlinCoreEnvironment.createForProduction( disposable, config, -- cgit