Add annotations-jar to compiler tests via KotlinStandardLibrariesPathProvider
to customize it outside kotlin repo
This commit is contained in:
+8
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.jvm.configureStandardLibs
|
||||
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||
import java.io.File
|
||||
import java.lang.ref.SoftReference
|
||||
import java.net.URL
|
||||
@@ -66,6 +67,11 @@ abstract class KotlinStandardLibrariesPathProvider : TestService {
|
||||
*/
|
||||
abstract fun jvmAnnotationsForTests(): File
|
||||
|
||||
/**
|
||||
* compiler/testData/mockJDK/jre/lib/annotations.jar
|
||||
*/
|
||||
abstract fun getAnnotationsJar(): File
|
||||
|
||||
fun getRuntimeJarClassLoader(): ClassLoader = synchronized(this) {
|
||||
var loader = runtimeJarClassLoader.get()
|
||||
if (loader == null) {
|
||||
@@ -101,6 +107,7 @@ object StandardLibrariesPathProviderForKotlinProject : KotlinStandardLibrariesPa
|
||||
override fun kotlinTestJarForTests(): File = ForTestCompileRuntime.kotlinTestJarForTests()
|
||||
override fun scriptRuntimeJarForTests(): File = ForTestCompileRuntime.scriptRuntimeJarForTests()
|
||||
override fun jvmAnnotationsForTests(): File = ForTestCompileRuntime.jvmAnnotationsForTests()
|
||||
override fun getAnnotationsJar(): File = KtTestUtil.getAnnotationsJar()
|
||||
}
|
||||
|
||||
object EnvironmentBasedStandardLibrariesPathProvider : KotlinStandardLibrariesPathProvider() {
|
||||
@@ -125,6 +132,7 @@ object EnvironmentBasedStandardLibrariesPathProvider : KotlinStandardLibrariesPa
|
||||
override fun kotlinTestJarForTests(): File = getFile(KOTLIN_TEST_PROP)
|
||||
override fun scriptRuntimeJarForTests(): File = getFile(KOTLIN_SCRIPT_RUNTIME_PROP)
|
||||
override fun jvmAnnotationsForTests(): File = getFile(KOTLIN_ANNOTATIONS_JVM_PROP)
|
||||
override fun getAnnotationsJar(): File = getFile(KOTLIN_ANNOTATIONS_JVM_PROP)
|
||||
}
|
||||
|
||||
val TestServices.standardLibrariesPathProvider: KotlinStandardLibrariesPathProvider by TestServices.testServiceAccessor()
|
||||
|
||||
+1
-2
@@ -122,12 +122,11 @@ class JvmEnvironmentConfigurator(testServices: TestServices) : EnvironmentConfig
|
||||
if (configurationKind.withReflection) {
|
||||
files.add(provider.reflectJarForTests())
|
||||
}
|
||||
files.add(KtTestUtil.getAnnotationsJar())
|
||||
files.add(provider.getAnnotationsJar())
|
||||
|
||||
if (JvmEnvironmentConfigurationDirectives.STDLIB_JDK8 in directives) {
|
||||
files.add(provider.runtimeJarForTestsWithJdk8())
|
||||
}
|
||||
files.add(KtTestUtil.getAnnotationsJar())
|
||||
return files
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user