From 962bfaca9cc306319f45018a736a00b572ebdca2 Mon Sep 17 00:00:00 2001 From: Anton Bannykh Date: Wed, 9 Aug 2023 17:37:58 +0200 Subject: [PATCH] [JS] Support multimodule IC tests with K2 Includes supporting klib file generation. --- .../jetbrains/kotlin/cli/js/K2JsIrCompiler.kt | 1 + .../kotlin/cli/js/klib/compilerPipeline.kt | 3 +- ...ntalMultiModuleJsKlibCompilerRunnerTest.kt | 11 + ...eJsFirKlibCompilerRunnerTestGenerated.java | 463 ++++++++++++++++++ .../kotlin/generators/tests/GenerateTests.kt | 4 + .../FirAbstractInvalidationTest.kt | 1 + 6 files changed, 482 insertions(+), 1 deletion(-) create mode 100644 compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/IncrementalMultiModuleJsFirKlibCompilerRunnerTestGenerated.java diff --git a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt index dca692b62b9..e256b697c5c 100644 --- a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt +++ b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt @@ -555,6 +555,7 @@ class K2JsIrCompiler : CLICompiler() { firOutputs = analyzedOutput.output, fir2IrActualizedResult = fir2IrActualizedResult, outputKlibPath = outputKlibPath, + nopack = arguments.irProduceKlibDir, messageCollector = messageCollector, diagnosticsReporter = diagnosticsReporter, jsOutputName = arguments.irPerModuleOutputName, diff --git a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/klib/compilerPipeline.kt b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/klib/compilerPipeline.kt index ad572f1118f..c7b2256c508 100644 --- a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/klib/compilerPipeline.kt +++ b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/klib/compilerPipeline.kt @@ -302,6 +302,7 @@ fun serializeFirKlib( firOutputs: List, fir2IrActualizedResult: Fir2IrActualizedResult, outputKlibPath: String, + nopack: Boolean, messageCollector: MessageCollector, diagnosticsReporter: BaseDiagnosticsCollector, jsOutputName: String?, @@ -320,7 +321,7 @@ fun serializeFirKlib( fir2IrActualizedResult.irModuleFragment, expectDescriptorToSymbol = mutableMapOf(), cleanFiles = icData ?: emptyList(), - nopack = true, + nopack = nopack, perFile = false, containsErrorCode = messageCollector.hasErrors() || diagnosticsReporter.hasErrors, abiVersion = KotlinAbiVersion.CURRENT, // TODO get from test file data diff --git a/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/AbstractIncrementalMultiModuleJsKlibCompilerRunnerTest.kt b/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/AbstractIncrementalMultiModuleJsKlibCompilerRunnerTest.kt index cd35264bde0..f8602bc8b36 100644 --- a/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/AbstractIncrementalMultiModuleJsKlibCompilerRunnerTest.kt +++ b/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/AbstractIncrementalMultiModuleJsKlibCompilerRunnerTest.kt @@ -90,4 +90,15 @@ abstract class AbstractIncrementalMultiModuleJsKlibCompilerRunnerTest : private const val STDLIB_DEPENDENCY = "build/js-ir-runtime/full-runtime.klib" } +} + +abstract class AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest : + AbstractIncrementalMultiModuleJsKlibCompilerRunnerTest() { + + override fun createCompilerArguments(destinationDir: File, testDir: File): K2JSCompilerArguments { + return super.createCompilerArguments(destinationDir, testDir).apply { + useK2 = true + languageVersion = "2.0" + } + } } \ No newline at end of file diff --git a/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/IncrementalMultiModuleJsFirKlibCompilerRunnerTestGenerated.java b/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/IncrementalMultiModuleJsFirKlibCompilerRunnerTestGenerated.java new file mode 100644 index 00000000000..eddc7b8e7c8 --- /dev/null +++ b/compiler/incremental-compilation-impl/test/org/jetbrains/kotlin/incremental/IncrementalMultiModuleJsFirKlibCompilerRunnerTestGenerated.java @@ -0,0 +1,463 @@ +/* + * Copyright 2010-2023 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.incremental; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.util.KtTestUtil; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateTestsKt}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class IncrementalMultiModuleJsFirKlibCompilerRunnerTestGenerated extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInCommon() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common"), Pattern.compile("^([^\\.]+)$"), null, true); + } + + @TestMetadata("classAdded") + public void testClassAdded() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/classAdded/"); + } + + @TestMetadata("classRemoved") + public void testClassRemoved() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/classRemoved/"); + } + + @TestMetadata("constantValueChanged") + public void testConstantValueChanged() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/constantValueChanged/"); + } + + @TestMetadata("copyFileToAnotherModule") + public void testCopyFileToAnotherModule() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/copyFileToAnotherModule/"); + } + + @TestMetadata("defaultArgumentInConstructorRemoved") + public void testDefaultArgumentInConstructorRemoved() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/defaultArgumentInConstructorRemoved/"); + } + + @TestMetadata("defaultParameterAdded") + public void testDefaultParameterAdded() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/defaultParameterAdded/"); + } + + @TestMetadata("defaultParameterAddedForTopLevelFun") + public void testDefaultParameterAddedForTopLevelFun() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/defaultParameterAddedForTopLevelFun/"); + } + + @TestMetadata("defaultParameterRemoved") + public void testDefaultParameterRemoved() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/defaultParameterRemoved/"); + } + + @TestMetadata("defaultParameterRemovedForTopLevelFun") + public void testDefaultParameterRemovedForTopLevelFun() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/defaultParameterRemovedForTopLevelFun/"); + } + + @TestMetadata("defaultValueInConstructorRemoved") + public void testDefaultValueInConstructorRemoved() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/defaultValueInConstructorRemoved/"); + } + + @TestMetadata("duplicatedClass") + public void testDuplicatedClass() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/duplicatedClass/"); + } + + @TestMetadata("exportedDependency") + public void testExportedDependency() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/exportedDependency/"); + } + + @TestMetadata("functionFromDifferentPackageChanged") + public void testFunctionFromDifferentPackageChanged() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/functionFromDifferentPackageChanged/"); + } + + @TestMetadata("inlineFunctionInlined") + public void testInlineFunctionInlined() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/inlineFunctionInlined/"); + } + + @TestMetadata("inlineFunctionTwoPackageParts") + public void testInlineFunctionTwoPackageParts() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/inlineFunctionTwoPackageParts/"); + } + + @TestMetadata("moveFileToAnotherModule") + public void testMoveFileToAnotherModule() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/moveFileToAnotherModule/"); + } + + @TestMetadata("simple") + public void testSimple() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/simple/"); + } + + @TestMetadata("simpleDependency") + public void testSimpleDependency() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/simpleDependency/"); + } + + @TestMetadata("simpleDependencyErrorOnAccessToInternal1") + public void testSimpleDependencyErrorOnAccessToInternal1() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/simpleDependencyErrorOnAccessToInternal1/"); + } + + @TestMetadata("simpleDependencyErrorOnAccessToInternal2") + public void testSimpleDependencyErrorOnAccessToInternal2() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/simpleDependencyErrorOnAccessToInternal2/"); + } + + @TestMetadata("simpleDependencyUnchanged") + public void testSimpleDependencyUnchanged() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/simpleDependencyUnchanged/"); + } + + @TestMetadata("transitiveDependency") + public void testTransitiveDependency() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/transitiveDependency/"); + } + + @TestMetadata("transitiveInlining") + public void testTransitiveInlining() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/transitiveInlining/"); + } + + @TestMetadata("twoDependants") + public void testTwoDependants() throws Exception { + runTest("jps/jps-plugin/testData/incremental/multiModule/common/twoDependants/"); + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/classAdded") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ClassAdded extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInClassAdded() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/classAdded"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/classRemoved") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ClassRemoved extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInClassRemoved() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/classRemoved"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/constantValueChanged") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ConstantValueChanged extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInConstantValueChanged() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/constantValueChanged"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/copyFileToAnotherModule") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class CopyFileToAnotherModule extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInCopyFileToAnotherModule() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/copyFileToAnotherModule"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/defaultArgumentInConstructorRemoved") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class DefaultArgumentInConstructorRemoved extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInDefaultArgumentInConstructorRemoved() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/defaultArgumentInConstructorRemoved"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/defaultParameterAdded") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class DefaultParameterAdded extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInDefaultParameterAdded() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/defaultParameterAdded"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/defaultParameterAddedForTopLevelFun") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class DefaultParameterAddedForTopLevelFun extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInDefaultParameterAddedForTopLevelFun() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/defaultParameterAddedForTopLevelFun"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/defaultParameterRemoved") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class DefaultParameterRemoved extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInDefaultParameterRemoved() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/defaultParameterRemoved"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/defaultParameterRemovedForTopLevelFun") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class DefaultParameterRemovedForTopLevelFun extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInDefaultParameterRemovedForTopLevelFun() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/defaultParameterRemovedForTopLevelFun"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/defaultValueInConstructorRemoved") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class DefaultValueInConstructorRemoved extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInDefaultValueInConstructorRemoved() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/defaultValueInConstructorRemoved"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/duplicatedClass") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class DuplicatedClass extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInDuplicatedClass() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/duplicatedClass"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/exportedDependency") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ExportedDependency extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInExportedDependency() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/exportedDependency"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/functionFromDifferentPackageChanged") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class FunctionFromDifferentPackageChanged extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInFunctionFromDifferentPackageChanged() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/functionFromDifferentPackageChanged"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/inlineFunctionInlined") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class InlineFunctionInlined extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInInlineFunctionInlined() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/inlineFunctionInlined"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/inlineFunctionTwoPackageParts") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class InlineFunctionTwoPackageParts extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInInlineFunctionTwoPackageParts() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/inlineFunctionTwoPackageParts"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/moveFileToAnotherModule") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class MoveFileToAnotherModule extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInMoveFileToAnotherModule() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/moveFileToAnotherModule"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/simple") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Simple extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInSimple() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/simple"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/simpleDependency") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class SimpleDependency extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInSimpleDependency() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/simpleDependency"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/simpleDependencyErrorOnAccessToInternal1") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class SimpleDependencyErrorOnAccessToInternal1 extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInSimpleDependencyErrorOnAccessToInternal1() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/simpleDependencyErrorOnAccessToInternal1"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/simpleDependencyErrorOnAccessToInternal2") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class SimpleDependencyErrorOnAccessToInternal2 extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInSimpleDependencyErrorOnAccessToInternal2() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/simpleDependencyErrorOnAccessToInternal2"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/simpleDependencyUnchanged") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class SimpleDependencyUnchanged extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInSimpleDependencyUnchanged() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/simpleDependencyUnchanged"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/transitiveDependency") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class TransitiveDependency extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInTransitiveDependency() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/transitiveDependency"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/transitiveInlining") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class TransitiveInlining extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInTransitiveInlining() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/transitiveInlining"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } + + @TestMetadata("jps/jps-plugin/testData/incremental/multiModule/common/twoDependants") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class TwoDependants extends AbstractIncrementalMultiModuleJsFirKlibCompilerRunnerTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInTwoDependants() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("jps/jps-plugin/testData/incremental/multiModule/common/twoDependants"), Pattern.compile("^([^\\.]+)$"), null, true); + } + } +} diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index d0838684de8..10801d963c0 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -107,6 +107,10 @@ fun main(args: Array) { model("incremental/multiModule/common", extension = null, excludeParentDirs = true) } + testClass { + model("incremental/multiModule/common", extension = null, excludeParentDirs = true) + } + testClass { // IC of sealed interfaces are not supported in JS model("incremental/pureKotlin", extension = null, recursive = false, excludedPattern = "^sealed.*") diff --git a/js/js.tests/test/org/jetbrains/kotlin/incremental/FirAbstractInvalidationTest.kt b/js/js.tests/test/org/jetbrains/kotlin/incremental/FirAbstractInvalidationTest.kt index 11af9d5e322..138079842ba 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/incremental/FirAbstractInvalidationTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/incremental/FirAbstractInvalidationTest.kt @@ -91,6 +91,7 @@ abstract class FirAbstractInvalidationTest( firOutputs = analyzedOutput.output, fir2IrActualizedResult = fir2IrActualizedResult, outputKlibPath = outputKlibFile.absolutePath, + nopack = false, messageCollector = messageCollector, diagnosticsReporter = diagnosticsReporter, jsOutputName = moduleName,