aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt
diff options
context:
space:
mode:
authorJonas Herzig <jonas@spark-squared.com>2020-11-21 16:48:49 +0100
committerJonas Herzig <jonas@spark-squared.com>2020-11-21 16:48:49 +0100
commite49dc899920dce06383cb7f9bd3cba5316cda09b (patch)
tree73c63b28ccd93331467302e60891768fd0c5103d /src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt
parent39b3db94179e8fb99041fb0d303140697c091585 (diff)
downloadRemap-e49dc899920dce06383cb7f9bd3cba5316cda09b.tar.gz
Remap-e49dc899920dce06383cb7f9bd3cba5316cda09b.tar.bz2
Remap-e49dc899920dce06383cb7f9bd3cba5316cda09b.zip
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.
Diffstat (limited to 'src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt')
-rw-r--r--src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt4
1 files changed, 4 insertions, 0 deletions
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<ContentRoot>(CLIConfigurationKeys.CONTENT_ROOTS, classpath!!.map { JvmClasspathRoot(File(it)) })
config.put<MessageCollector>(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,