Remove dependency of compiler tests on fir2ir tests

Compiler tests use the old test infrastructure, but fir2ir tests use the
new one (tests-common-new). Removing this dependency means that now the
two big modules, `:compiler:compileTestKotlin` and
`:compiler:tests-common-new:compileTestKotlin` can be compiled in
parallel, which improves the total build time.
This commit is contained in:
Alexander Udalov
2022-06-15 22:58:31 +02:00
parent fd5800e8b5
commit bd0fe2f146
4 changed files with 1 additions and 1 deletions
@@ -0,0 +1,25 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.test.utils
import java.util.function.Function
class ReplacingSourceTransformer(val from: String, val to: String) : Function<String, String>, (String) -> String {
init {
require(from.isNotEmpty()) { "Cannot replace empty string" }
}
private val randomComment: String = CharArray(6) { (('0'..'9') + ('a'..'z') + ('A'..'Z')).random() }
.joinToString("", prefix = "/* ", postfix = " */")
fun invokeForTestFile(source: String): String = source.replace(from, to + randomComment)
fun revertForFile(actual: String): String =
actual.replace(to + randomComment, from).replace(randomComment, "")
override fun apply(source: String): String = invokeForTestFile(source)
override fun invoke(source: String): String = invokeForTestFile(source)
}
@@ -0,0 +1,27 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.test.utils
import java.io.File
object TransformersFunctions {
@JvmStatic
val replaceOptionalJvmInlineAnnotationWithReal = ReplacingSourceTransformer("OPTIONAL_JVM_INLINE_ANNOTATION", "@JvmInline")
@JvmStatic
val replaceOptionalJvmInlineAnnotationWithUniversal = ReplacingSourceTransformer("OPTIONAL_JVM_INLINE_ANNOTATION", "@Suppress(\"OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE\") @kotlin.jvm.JvmInline")
@JvmStatic
val removeOptionalJvmInlineAnnotation = ReplacingSourceTransformer("OPTIONAL_JVM_INLINE_ANNOTATION", "")
object Android {
val forAll: List<(String) -> String> = listOf(
replaceOptionalJvmInlineAnnotationWithReal,
)
val forSpecificFile: Map<File, (String) -> String> = mapOf(
)
}
}