diff options
author | Jonas Herzig <jonas@spark-squared.com> | 2020-11-21 16:48:49 +0100 |
---|---|---|
committer | Jonas Herzig <jonas@spark-squared.com> | 2020-11-21 16:48:49 +0100 |
commit | e49dc899920dce06383cb7f9bd3cba5316cda09b (patch) | |
tree | 73c63b28ccd93331467302e60891768fd0c5103d | |
parent | 39b3db94179e8fb99041fb0d303140697c091585 (diff) | |
download | Remap-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.
-rw-r--r-- | build.gradle.kts | 2 | ||||
-rw-r--r-- | src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/build.gradle.kts b/build.gradle.kts index de0684b..8493ae8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,7 +17,7 @@ repositories { } dependencies { - compile("org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.40") + compile("org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.72") implementation(kotlin("stdlib")) compile("org.cadixdev:lorenz:0.5.0") } 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, |