Modularized tests. Support configuring known compiler plugins in FP test
Construct compiler plugins classpath based on original compiler arguments Support of plugins in full pipeline test allows us to test projects where some common compiler plugins are used without excluding modules ^KT-56075
This commit is contained in:
committed by
Space Team
parent
59e69481a3
commit
6ffd3ed970
@@ -30,6 +30,8 @@ dependencies {
|
||||
testApi(project(":compiler:fir:semantics"))
|
||||
testApi(project(":compiler:fir:dump"))
|
||||
|
||||
testRuntimeOnly(project(":compiler:fir:plugin-utils"))
|
||||
|
||||
val asyncProfilerClasspath = project.findProperty("fir.bench.async.profiler.classpath") as? String
|
||||
if (asyncProfilerClasspath != null) {
|
||||
testRuntimeOnly(files(*asyncProfilerClasspath.split(File.pathSeparatorChar).toTypedArray()))
|
||||
@@ -42,6 +44,7 @@ sourceSets {
|
||||
}
|
||||
|
||||
projectTest(minHeapSizeMb = 8192, maxHeapSizeMb = 8192, reservedCodeCacheSizeMb = 512) {
|
||||
dependsOn(":dist")
|
||||
systemProperties(project.properties.filterKeys { it.startsWith("fir.") })
|
||||
workingDir = rootDir
|
||||
|
||||
|
||||
+27
@@ -16,7 +16,11 @@ import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
||||
import org.jetbrains.kotlin.config.Services
|
||||
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
|
||||
import org.jetbrains.kotlin.modules.KotlinModuleXmlBuilder
|
||||
import org.jetbrains.kotlin.test.kotlinPathsForDistDirectoryForTests
|
||||
import org.jetbrains.kotlin.util.PerformanceCounter
|
||||
import org.jetbrains.kotlin.utils.KotlinPaths
|
||||
import org.jetbrains.kotlin.utils.PathUtil
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.io.PrintStream
|
||||
import java.nio.file.Files
|
||||
@@ -143,6 +147,12 @@ abstract class AbstractFullPipelineModularizedTest : AbstractModularizedTest() {
|
||||
args.progressiveMode = originalArguments.progressiveMode
|
||||
args.optIn = (moduleData.optInAnnotations + (originalArguments.optIn ?: emptyArray())).toTypedArray()
|
||||
args.allowKotlinPackage = originalArguments.allowKotlinPackage
|
||||
|
||||
args.pluginOptions = originalArguments.pluginOptions
|
||||
args.pluginClasspaths = originalArguments.pluginClasspaths?.mapNotNull {
|
||||
substituteCompilerPluginPathForKnownPlugins(it)?.absolutePath
|
||||
}?.toTypedArray()
|
||||
|
||||
} else {
|
||||
args.jvmTarget = JVM_TARGET
|
||||
args.allowKotlinPackage = true
|
||||
@@ -365,3 +375,20 @@ abstract class AbstractFullPipelineModularizedTest : AbstractModularizedTest() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun substituteCompilerPluginPathForKnownPlugins(path: String): File? {
|
||||
val file = File(path)
|
||||
val paths = PathUtil.kotlinPathsForDistDirectoryForTests
|
||||
return when {
|
||||
file.name.startsWith("kotlinx-serialization") || file.name.startsWith("kotlin-serialization") ->
|
||||
paths.jar(KotlinPaths.Jar.SerializationPlugin)
|
||||
file.name.startsWith("kotlin-sam-with-receiver") -> paths.jar(KotlinPaths.Jar.SamWithReceiver)
|
||||
file.name.startsWith("kotlin-allopen") -> paths.jar(KotlinPaths.Jar.AllOpenPlugin)
|
||||
file.name.startsWith("kotlin-noarg") -> paths.jar(KotlinPaths.Jar.NoArgPlugin)
|
||||
file.name.startsWith("kotlin-lombok") -> paths.jar(KotlinPaths.Jar.LombokPlugin)
|
||||
else -> null
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -20,6 +20,7 @@ class FullPipelineModularizedTest : AbstractFullPipelineModularizedTest() {
|
||||
args.useK2 = true
|
||||
args.useIR = true
|
||||
args.languageVersion = LANGUAGE_VERSION_K2
|
||||
|
||||
// TODO: Remove when support for old modularized tests is removed
|
||||
if (moduleData.arguments == null) {
|
||||
args.apiVersion = API_VERSION
|
||||
|
||||
Reference in New Issue
Block a user