Make it possible to run hmpp tests with ENABLE_MULTIPLATFORM_COMPOSITE_ANALYSIS_MODE

In scope of KT-40904 KT-55177
Review: https://jetbrains.team/p/kt/reviews/8731

In order to make it possible to run hmpp tests with
`ENABLE_MULTIPLATFORM_COMPOSITE_ANALYSIS_MODE`, a dependency manager
must be implemented. This commit implements some basic dependency
manager. I'm not sure in its correctness because
`CommonDependenciesContainer` is an awkward API, but this dependency
manager works for my cases.

Why: I need hmpp + `ENABLE_MULTIPLATFORM_COMPOSITE_ANALYSIS_MODE`
infrastructure to cover `ExpectActualInTheSameModuleChecker` (I will add
the checker in the next commit) with tests. The checker couldn't be
covered with regular hmpp tests because regular hmpp tests and
`K2MetadataCompiler` run the compiler in a different way.
Contrary, `ENABLE_MULTIPLATFORM_COMPOSITE_ANALYSIS_MODE` runs the compiler in a
way `K2MetadataCompiler` does it.

I moved some tests from hmpp to `hmpp/multiplatformCompositeAnalysis`
because otherwise the tests would fail after I implement
`ExpectActualInTheSameModuleChecker` in the next commit.

Also the descriptor dumps were changed
(intermediateWithActualAndExpect.txt and
sealedInheritorsInComplexModuleStructure.txt). It happened because now
common source sets are no longer "squashed" into a single source set but
rather correct dependencies between source sets are established. And
each source set is analyzed separately (exactly like in
K2MetadataCompiler)
This commit is contained in:
Nikita Bobko
2023-02-15 17:50:40 +01:00
parent 14ca12b50b
commit 456605542c
11 changed files with 147 additions and 103 deletions
@@ -21981,29 +21981,39 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform/hmpp"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("intermediateWithActualAndExpect.kt")
public void testIntermediateWithActualAndExpect() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/intermediateWithActualAndExpect.kt");
}
@Test
@TestMetadata("kt-55570.kt")
public void testKt_55570() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/kt-55570.kt");
}
@Test
@TestMetadata("sealedInheritorsInComplexModuleStructure.kt")
public void testSealedInheritorsInComplexModuleStructure() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/sealedInheritorsInComplexModuleStructure.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/simple.kt");
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis")
@TestDataPath("$PROJECT_ROOT")
public class MultiplatformCompositeAnalysis {
@Test
public void testAllFilesPresentInMultiplatformCompositeAnalysis() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("intermediateWithActualAndExpect.kt")
public void testIntermediateWithActualAndExpect() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/intermediateWithActualAndExpect.kt");
}
@Test
@TestMetadata("sealedInheritorsInComplexModuleStructure.kt")
public void testSealedInheritorsInComplexModuleStructure() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/sealedInheritorsInComplexModuleStructure.kt");
}
}
}
@Nested