K2: Support binary library dependencies between test modules
The test infrastructure for analysis supports binary module tests, but the binary build does not use another binary module as a dependency when it passes the class path. As a result, each binary module build does not work when they have dependency on each other. This commit fixes the issue by 1. Topological sort in the order of dependency graph for test modules. 2. Pass module paths as extra class paths when they have dependency on each other. ^KT-64994
This commit is contained in:
+2
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.test.getAnalyzerServices
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
import org.jetbrains.kotlin.test.services.TestModuleStructure
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import java.nio.file.Path
|
||||
|
||||
object AnalysisApiFirOutOfContentRootTestConfigurator : AnalysisApiFirSourceLikeTestConfigurator(false) {
|
||||
override val testPrefix: String
|
||||
@@ -68,6 +69,7 @@ private object KtOutOfContentRootModuleFactory : KtModuleFactory {
|
||||
contextModule: KtModuleWithFiles?,
|
||||
testServices: TestServices,
|
||||
project: Project,
|
||||
dependencyPaths: Collection<Path>,
|
||||
): KtModuleWithFiles {
|
||||
val psiFiles = TestModuleStructureFactory.createSourcePsiFiles(testModule, testServices, project)
|
||||
val platform = testModule.targetPlatform
|
||||
|
||||
+2
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import java.nio.file.Path
|
||||
|
||||
object AnalysisApiFirStdlibSourceTestConfigurator : AnalysisApiFirSourceLikeTestConfigurator(false) {
|
||||
override fun configureTest(builder: TestConfigurationBuilder, disposable: Disposable) {
|
||||
@@ -30,6 +31,7 @@ private object KtStdlibSourceModuleFactory : KtModuleFactory {
|
||||
contextModule: KtModuleWithFiles?,
|
||||
testServices: TestServices,
|
||||
project: Project,
|
||||
dependencyPaths: Collection<Path>,
|
||||
): KtModuleWithFiles {
|
||||
val libraryJar = ForTestCompileRuntime.runtimeJarForTests().toPath()
|
||||
val librarySourcesJar = ForTestCompileRuntime.runtimeSourcesJarForTests().toPath()
|
||||
|
||||
Reference in New Issue
Block a user