diff options
author | Jonas Herzig <jonas@spark-squared.com> | 2022-05-10 11:11:27 +0200 |
---|---|---|
committer | Jonas Herzig <jonas@spark-squared.com> | 2022-05-10 11:11:27 +0200 |
commit | aac68af7dbad25b29531b8544c100c497146c250 (patch) | |
tree | 73364c9157b43b31ec06b306164b8b2aa23f018e /src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt | |
parent | c7eaf63caad15b8e1935be5acc9b85fd3765faa9 (diff) | |
download | Remap-aac68af7dbad25b29531b8544c100c497146c250.tar.gz Remap-aac68af7dbad25b29531b8544c100c497146c250.tar.bz2 Remap-aac68af7dbad25b29531b8544c100c497146c250.zip |
Add support for kotlin-compiler-embeddable 1.6.20
While, unlike last time, maintaining backwards compatibility with 1.5.21 (and
anything in between).
Diffstat (limited to 'src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt')
-rw-r--r-- | src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt b/src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt index 24f41ce..67b065e 100644 --- a/src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt +++ b/src/main/kotlin/com/replaymod/gradle/remap/Transformer.kt @@ -10,8 +10,6 @@ import org.jetbrains.kotlin.cli.common.messages.MessageRenderer import org.jetbrains.kotlin.cli.common.messages.PrintingMessageCollector import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment -import org.jetbrains.kotlin.cli.jvm.compiler.NoScopeRecordCliBindingTrace -import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM import org.jetbrains.kotlin.cli.jvm.config.JavaSourceRoot import org.jetbrains.kotlin.cli.jvm.config.JvmClasspathRoot import org.jetbrains.kotlin.com.intellij.codeInsight.CustomExceptionHandler @@ -25,7 +23,6 @@ import org.jetbrains.kotlin.com.intellij.openapi.vfs.StandardFileSystems import org.jetbrains.kotlin.com.intellij.openapi.vfs.VirtualFileManager import org.jetbrains.kotlin.com.intellij.openapi.vfs.local.CoreLocalFileSystem 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 @@ -90,13 +87,11 @@ class Transformer(private val map: MappingSet) { val psiFiles = virtualFiles.mapValues { psiManager.findFile(it.value)!! } val ktFiles = psiFiles.values.filterIsInstance<KtFile>() - val analysis = TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration( - project, - ktFiles, - NoScopeRecordCliBindingTrace(), - environment.configuration, - { scope: GlobalSearchScope -> environment.createPackagePartProvider(scope) } - ) + val analysis = try { + analyze1521(environment, ktFiles) + } catch (e: NoSuchMethodError) { + analyze1620(environment, ktFiles) + } val remappedProject = remappedClasspath?.let { setupRemappedProject(disposable, it) } @@ -146,14 +141,11 @@ class Transformer(private val map: MappingSet) { config, EnvironmentConfigFiles.JVM_CONFIG_FILES ) - val project = environment.project - TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration( - project, - emptyList(), - NoScopeRecordCliBindingTrace(), - environment.configuration, - { scope: GlobalSearchScope -> environment.createPackagePartProvider(scope) } - ) + try { + analyze1521(environment, emptyList()) + } catch (e: NoSuchMethodError) { + analyze1620(environment, emptyList()) + } return environment.project } |