mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[kotlin] KTIJ-36850 Move AbstractReferenceResolveWithCompilerPluginsWithLibTest.kt to intellij.kotlin.base.test
Change the code so that there's no dependency on the `kotlin.bundled-compiler-plugins-support` module, which is considered to be K2-specific GitOrigin-RevId: b661aaa4858174136c0e82a4d2198464df2e6343
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c43e3b9bfb
commit
cf31cc5234
@@ -70,6 +70,8 @@ jvm_library(
|
||||
"//platform/platform-util-io:ide-util-io",
|
||||
"@lib//:kotlin-test",
|
||||
"//plugins/kotlin/completion/tests-shared:kotlin-completion-tests-shared_test_lib",
|
||||
"//java/openapi:java",
|
||||
"//java/idea-ui:ui",
|
||||
]
|
||||
)
|
||||
### auto-generated section `build intellij.kotlin.base.test` end
|
||||
|
||||
@@ -59,5 +59,7 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.ide.util.io" scope="TEST" />
|
||||
<orderEntry type="library" scope="TEST" name="kotlin-test" level="project" />
|
||||
<orderEntry type="module" module-name="kotlin.completion.tests.shared" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.java" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.java.ui" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
+19
-4
@@ -1,11 +1,12 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.resolve
|
||||
|
||||
import com.intellij.jarRepository.JarRepositoryManager
|
||||
import com.intellij.openapi.application.PathManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.idea.maven.utils.library.RepositoryLibraryProperties
|
||||
import org.jetbrains.kotlin.idea.fir.extensions.KotlinK2BundledCompilerPlugins
|
||||
import java.io.File
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.absolutePathString
|
||||
|
||||
abstract class AbstractReferenceResolveWithCompilerPluginsWithLibTest : AbstractReferenceResolveWithLibTest() {
|
||||
@@ -42,6 +43,20 @@ private fun Project.resolveAdditionalLibClasspath(): List<File> {
|
||||
return dependencyCoordinates.map(::loadSingleJarFromMaven)
|
||||
}
|
||||
|
||||
/**
|
||||
* This variable dynamically resolves the location of the `SerializationComponentRegistrar` class
|
||||
* to determine the associated plugin's jar path.
|
||||
*
|
||||
* It is used to avoid direct dependency on the [org.jetbrains.kotlin.idea.fir.extensions.KotlinK2BundledCompilerPlugins].
|
||||
*/
|
||||
private val KOTLINX_SERIALIZATION_COMPILER_PLUGIN_PATH: Path
|
||||
get() {
|
||||
// Hack to avoid using KotlinK2BundledCompilerPlugins explicitly
|
||||
val registrarClass = Class.forName("org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationComponentRegistrar")
|
||||
|
||||
return PathManager.getJarForClass(registrarClass) ?: error("Jar file for $registrarClass not found")
|
||||
}
|
||||
|
||||
private val additionalLibCompilationOptions: List<String>
|
||||
get() {
|
||||
/*
|
||||
@@ -50,10 +65,10 @@ private val additionalLibCompilationOptions: List<String>
|
||||
The plugin jar should contain both K1 and K2 plugin implementations.
|
||||
*/
|
||||
val compilerPlugins = listOf(
|
||||
KotlinK2BundledCompilerPlugins.KOTLINX_SERIALIZATION_COMPILER_PLUGIN
|
||||
KOTLINX_SERIALIZATION_COMPILER_PLUGIN_PATH
|
||||
)
|
||||
|
||||
return compilerPlugins.map { "-Xplugin=${it.bundledJarLocation.absolutePathString()}" }
|
||||
return compilerPlugins.map { "-Xplugin=${it.absolutePathString()}" }
|
||||
}
|
||||
|
||||
fun Project.loadSingleJarFromMaven(mavenCoordinates: String): File {
|
||||
Reference in New Issue
Block a user