[JS] Migrate tests onto IR compiler with outputDir API instead of outputFile
^KT-61117 fixed
This commit is contained in:
committed by
Space Team
parent
e50f6e6bca
commit
08e3cb300a
+20
-3
@@ -2,15 +2,17 @@ package org.jetbrains.kotlin.incremental
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
|
||||
import org.jetbrains.kotlin.incremental.testingUtils.BuildLogFinder
|
||||
import org.jetbrains.kotlin.incremental.utils.TestCompilationResult
|
||||
import org.jetbrains.kotlin.incremental.utils.TestICReporter
|
||||
import org.jetbrains.kotlin.incremental.utils.TestMessageCollector
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractIncrementalK1JsKlibCompilerRunnerTest : AbstractIncrementalK1JsLegacyCompilerRunnerTest() {
|
||||
abstract class AbstractIncrementalK1JsKlibCompilerRunnerTest : AbstractIncrementalCompilerRunnerTestBase<K2JSCompilerArguments>() {
|
||||
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JSCompilerArguments =
|
||||
K2JSCompilerArguments().apply {
|
||||
libraries = "build/js-ir-runtime/full-runtime.klib"
|
||||
outputDir = destinationDir.path
|
||||
moduleName = testDir.name
|
||||
outputFile = null
|
||||
sourceMap = false
|
||||
irProduceKlibDir = false
|
||||
irProduceKlibFile = true
|
||||
@@ -19,7 +21,22 @@ abstract class AbstractIncrementalK1JsKlibCompilerRunnerTest : AbstractIncrement
|
||||
}
|
||||
|
||||
override val buildLogFinder: BuildLogFinder
|
||||
get() = super.buildLogFinder.copy(isKlibEnabled = true)
|
||||
get() = super.buildLogFinder.copy(
|
||||
isKlibEnabled = true,
|
||||
isJsEnabled = true,
|
||||
isScopeExpansionEnabled = scopeExpansionMode != CompileScopeExpansionMode.NEVER,
|
||||
)
|
||||
|
||||
override fun make(cacheDir: File, outDir: File, sourceRoots: Iterable<File>, args: K2JSCompilerArguments): TestCompilationResult {
|
||||
val reporter = TestICReporter()
|
||||
val messageCollector = TestMessageCollector()
|
||||
makeJsIncrementally(cacheDir, sourceRoots, args, buildHistoryFile(cacheDir), messageCollector, reporter, scopeExpansionMode)
|
||||
return TestCompilationResult(reporter, messageCollector)
|
||||
}
|
||||
|
||||
protected open val scopeExpansionMode = CompileScopeExpansionMode.NEVER
|
||||
|
||||
override fun failFile(testDir: File): File = testDir.resolve("fail_js_legacy.txt")
|
||||
}
|
||||
|
||||
abstract class AbstractIncrementalK1JsKlibCompilerWithScopeExpansionRunnerTest : AbstractIncrementalK1JsKlibCompilerRunnerTest() {
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.incremental
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractIncrementalK1JsLegacyCompilerRunnerWithFriendModulesDisabledTest : AbstractIncrementalK1JsLegacyCompilerRunnerTest() {
|
||||
abstract class AbstractIncrementalK1JsKlibCompilerRunnerWithFriendModulesDisabledTest : AbstractIncrementalK1JsKlibCompilerRunnerTest() {
|
||||
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JSCompilerArguments =
|
||||
super.createCompilerArguments(destinationDir, testDir).apply {
|
||||
friendModulesDisabled = true
|
||||
+1
-1
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.incremental
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractIncrementalK1JsLegacyMultiplatformJsCompilerRunnerTest : AbstractIncrementalK1JsLegacyCompilerRunnerTest() {
|
||||
abstract class AbstractIncrementalK1JsKlibMultiplatformJsCompilerRunnerTest : AbstractIncrementalK1JsKlibCompilerRunnerTest() {
|
||||
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JSCompilerArguments {
|
||||
return super.createCompilerArguments(destinationDir, testDir).apply {
|
||||
multiPlatform = true
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.incremental
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
|
||||
import org.jetbrains.kotlin.incremental.testingUtils.BuildLogFinder
|
||||
import org.jetbrains.kotlin.incremental.utils.TestCompilationResult
|
||||
import org.jetbrains.kotlin.incremental.utils.TestICReporter
|
||||
import org.jetbrains.kotlin.incremental.utils.TestMessageCollector
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractIncrementalK1JsLegacyCompilerRunnerTest : AbstractIncrementalCompilerRunnerTestBase<K2JSCompilerArguments>() {
|
||||
override fun make(cacheDir: File, outDir: File, sourceRoots: Iterable<File>, args: K2JSCompilerArguments): TestCompilationResult {
|
||||
val reporter = TestICReporter()
|
||||
val messageCollector = TestMessageCollector()
|
||||
makeJsIncrementally(cacheDir, sourceRoots, args, buildHistoryFile(cacheDir), messageCollector, reporter, scopeExpansionMode)
|
||||
return TestCompilationResult(reporter, messageCollector)
|
||||
}
|
||||
|
||||
override val buildLogFinder: BuildLogFinder
|
||||
get() = super.buildLogFinder.copy(
|
||||
isJsEnabled = true,
|
||||
isScopeExpansionEnabled = scopeExpansionMode != CompileScopeExpansionMode.NEVER
|
||||
)
|
||||
|
||||
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JSCompilerArguments =
|
||||
K2JSCompilerArguments().apply {
|
||||
outputFile = File(destinationDir, "${testDir.name}.js").path
|
||||
sourceMap = true
|
||||
metaInfo = true
|
||||
forceDeprecatedLegacyCompilerUsage = true
|
||||
languageVersion = "1.9"
|
||||
}
|
||||
|
||||
protected open val scopeExpansionMode = CompileScopeExpansionMode.NEVER
|
||||
|
||||
override fun failFile(testDir: File): File = testDir.resolve("fail_js_legacy.txt")
|
||||
}
|
||||
+1
-1
@@ -20,7 +20,7 @@ import java.util.regex.Pattern;
|
||||
@TestMetadata("jps/jps-plugin/testData/incremental/js/friendsModuleDisabled")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class IncrementalK1JsLegacyCompilerRunnerWithFriendModulesDisabledTestGenerated extends AbstractIncrementalK1JsLegacyCompilerRunnerWithFriendModulesDisabledTest {
|
||||
public class IncrementalK1JsKlibCompilerRunnerWithFriendModulesDisabledTestGenerated extends AbstractIncrementalK1JsKlibCompilerRunnerWithFriendModulesDisabledTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
+3
-3
@@ -20,7 +20,7 @@ import java.util.regex.Pattern;
|
||||
@TestMetadata("jps/jps-plugin/testData/incremental/mpp/allPlatforms")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class IncrementalK1JsLegacyMultiplatformJsCompilerRunnerTestGenerated extends AbstractIncrementalK1JsLegacyMultiplatformJsCompilerRunnerTest {
|
||||
public class IncrementalK1JsKlibMultiplatformJsCompilerRunnerTestGenerated extends AbstractIncrementalK1JsKlibMultiplatformJsCompilerRunnerTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
@@ -42,7 +42,7 @@ public class IncrementalK1JsLegacyMultiplatformJsCompilerRunnerTestGenerated ext
|
||||
@TestMetadata("jps/jps-plugin/testData/incremental/mpp/allPlatforms/touchActual")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class TouchActual extends AbstractIncrementalK1JsLegacyMultiplatformJsCompilerRunnerTest {
|
||||
public static class TouchActual extends AbstractIncrementalK1JsKlibMultiplatformJsCompilerRunnerTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public class IncrementalK1JsLegacyMultiplatformJsCompilerRunnerTestGenerated ext
|
||||
@TestMetadata("jps/jps-plugin/testData/incremental/mpp/allPlatforms/touchExpect")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class TouchExpect extends AbstractIncrementalK1JsLegacyMultiplatformJsCompilerRunnerTest {
|
||||
public static class TouchExpect extends AbstractIncrementalK1JsKlibMultiplatformJsCompilerRunnerTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
Reference in New Issue
Block a user