Adjust tests for JSR305 annotations being extracted

See the previous commits
This commit is contained in:
Denis.Zharkov
2023-02-24 18:45:54 +01:00
committed by Space Team
parent c86c96f5e5
commit 13febaf978
4 changed files with 66 additions and 11 deletions
@@ -60,8 +60,18 @@ abstract class AbstractFirTypeEnhancementTest : KtUsefulTestCase() {
super.tearDown()
}
private fun createJarWithForeignAnnotations(): File =
MockLibraryUtilExt.compileJavaFilesLibraryToJar(FOREIGN_ANNOTATIONS_SOURCES_PATH, "foreign-annotations")
private fun createJarWithForeignAnnotations(): List<File> {
val jsr305Jar =
MockLibraryUtilExt.compileJavaFilesLibraryToJar(JSR_305_SOURCES_PATH, "jsr305")
return listOf(
MockLibraryUtilExt.compileJavaFilesLibraryToJar(
FOREIGN_ANNOTATIONS_SOURCES_PATH, "foreign-annotations",
extraClasspath = listOf(jsr305Jar.absolutePath),
),
jsr305Jar,
)
}
private fun createEnvironment(content: String): KotlinCoreEnvironment {
val classpath = mutableListOf(getAnnotationsJar(), ForTestCompileRuntime.runtimeJarForTests())
@@ -69,7 +79,7 @@ abstract class AbstractFirTypeEnhancementTest : KtUsefulTestCase() {
classpath.add(ForTestCompileRuntime.jvmAnnotationsForTests())
}
if (InTextDirectivesUtils.isDirectiveDefined(content, "FOREIGN_ANNOTATIONS")) {
classpath.add(createJarWithForeignAnnotations())
classpath.addAll(createJarWithForeignAnnotations())
}
return KotlinCoreEnvironment.createForTests(
testRootDisposable,
@@ -176,6 +186,7 @@ abstract class AbstractFirTypeEnhancementTest : KtUsefulTestCase() {
companion object {
private const val FOREIGN_ANNOTATIONS_SOURCES_PATH = "third-party/annotations"
private const val JSR_305_SOURCES_PATH = "third-party/jsr305"
}
}