Analysis API FIR: introduce library resolve tests
This commit is contained in:
+7
-1
@@ -158,7 +158,12 @@ abstract class AbstractFrontendApiTest : TestWithDisposable() {
|
||||
testConfiguration.directives,
|
||||
)
|
||||
val singleModule = moduleStructure.modules.single()
|
||||
val project = testServices.compilerConfigurationProvider.getProject(singleModule)
|
||||
val project = try {
|
||||
testServices.compilerConfigurationProvider.getProject(singleModule)
|
||||
} catch (_: SkipTestException) {
|
||||
return
|
||||
}
|
||||
|
||||
val moduleInfoProvider = testServices.projectModuleProvider
|
||||
with(project as MockProject) {
|
||||
configurator.registerProjectServices(this)
|
||||
@@ -183,6 +188,7 @@ abstract class AbstractFrontendApiTest : TestWithDisposable() {
|
||||
val ktFiles = when (moduleInfo) {
|
||||
is TestKtSourceModule -> moduleInfo.testFilesToKtFiles.filterKeys { testFile -> !testFile.isAdditional }.values.toList()
|
||||
is TestKtLibraryModule -> moduleInfo.ktFiles.toList()
|
||||
is TestKtLibrarySourceModule -> moduleInfo.ktFiles.toList()
|
||||
else -> error("Unexpected $moduleInfo")
|
||||
}
|
||||
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* Copyright 2010-2022 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.analysis.api.impl.barebone.test
|
||||
|
||||
abstract class SkipTestException : RuntimeException()
|
||||
+13
@@ -119,6 +119,19 @@ class TestKtLibraryModule(
|
||||
GlobalSearchScope.filesScope(project, ktFiles.map { it.virtualFile })
|
||||
}
|
||||
|
||||
class TestKtLibrarySourceModule(
|
||||
project: Project,
|
||||
testModule: TestModule,
|
||||
ktFilesFromSourceJar: Set<KtFile>,
|
||||
testServices: TestServices,
|
||||
override val binaryLibrary: KtLibraryModule,
|
||||
) : TestKtModule(project, testModule, ktFilesFromSourceJar, testServices), KtLibrarySourceModule {
|
||||
override val ktModule: KtModule get() = this
|
||||
override val contentScope: GlobalSearchScope get() = GlobalSearchScope.filesScope(project, ktFiles.map { it.virtualFile })
|
||||
|
||||
override val libraryName: String get() = testModule.name
|
||||
}
|
||||
|
||||
private class LibraryByRoots(
|
||||
private val roots: List<Path>,
|
||||
private val module: KtModule,
|
||||
|
||||
Reference in New Issue
Block a user