[K/JS] Add a secret system property to enable the old Kotlin/JS compiler only for tests until it will be removed from the sources

This commit is contained in:
Artem Kobzar
2022-12-29 13:32:01 +00:00
committed by Space Team
parent 47f32b715f
commit fbf06b5495
49 changed files with 109 additions and 16 deletions
@@ -11,6 +11,7 @@ import com.intellij.util.ThrowableRunnable
import com.intellij.util.containers.Interner
import org.jetbrains.kotlin.TestWithWorkingDir
import org.jetbrains.kotlin.build.JvmSourceRoot
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
import org.jetbrains.kotlin.cli.common.ExitCode
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
@@ -168,6 +169,8 @@ abstract class AbstractJsLookupTrackerTest : AbstractLookupTrackerTest() {
reportOutputFiles = true
freeArgs = filesToCompile.map { it.canonicalPath }
useDeprecatedLegacyCompiler = true
// TODO: It will be deleted after all of our internal vendors will use the new Kotlin/JS compiler
CompilerSystemProperties.KOTLIN_JS_COMPILER_LEGACY_FORCE_ENABLED.value = "true"
}
configureAdditionalArgs(args)
return runJSCompiler(args, env)
@@ -27,6 +27,7 @@ import org.jetbrains.jps.model.library.JpsLibrary
import org.jetbrains.jps.model.library.JpsOrderRootType
import org.jetbrains.jps.model.library.sdk.JpsSdk
import org.jetbrains.jps.util.JpsPathUtil
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
import org.jetbrains.kotlin.compilerRunner.JpsKotlinCompilerRunner
import org.jetbrains.kotlin.test.WithMutedInDatabaseRunTest
import org.jetbrains.kotlin.test.runTest
@@ -36,6 +37,7 @@ abstract class BaseKotlinJpsBuildTestCase : JpsBuildTestCase() {
override fun setUp() {
super.setUp()
System.setProperty("kotlin.jps.tests", "true")
CompilerSystemProperties.KOTLIN_JS_COMPILER_LEGACY_FORCE_ENABLED.value = "true"
}
override fun shouldRunTest(): Boolean {
@@ -11,6 +11,7 @@ import com.intellij.util.ThrowableRunnable
import org.jetbrains.jps.model.java.JpsJavaExtensionService
import org.jetbrains.jps.model.module.JpsModule
import org.jetbrains.jps.util.JpsPathUtil
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
import org.jetbrains.kotlin.config.CompilerSettings
import org.jetbrains.kotlin.config.KotlinFacetSettings
@@ -91,6 +92,8 @@ abstract class KotlinJpsBuildTestBase : AbstractKotlinJpsBuildTestCase() {
val facet = KotlinFacetSettings()
facet.compilerArguments = K2JSCompilerArguments().apply {
useDeprecatedLegacyCompiler = true
// TODO: It will be deleted after all of our internal vendors will use the new Kotlin/JS compiler
CompilerSystemProperties.KOTLIN_JS_COMPILER_LEGACY_FORCE_ENABLED.value = "true"
}
facet.targetPlatform = JsPlatforms.defaultJsPlatform
@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.jps.incremental
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants
import org.jetbrains.kotlin.compilerRunner.OutputItemsCollectorImpl
@@ -51,6 +52,8 @@ abstract class AbstractJsProtoComparisonTest : AbstractProtoComparisonTest<Proto
main = K2JsArgumentConstants.NO_CALL
freeArgs = ktFiles
useDeprecatedLegacyCompiler = true
// TODO: It will be deleted after all of our internal vendors will use the new Kotlin/JS compiler
CompilerSystemProperties.KOTLIN_JS_COMPILER_LEGACY_FORCE_ENABLED.value = "true"
}
val env = createTestingCompilerEnvironment(messageCollector, outputItemsCollector, services)