-
Notifications
You must be signed in to change notification settings - Fork 25
Closed
Labels
bugSomething isn't workingSomething isn't workingopen to contributionsContributions from the community are welcomeContributions from the community are welcome
Description
Otherwise, testData files might reference functions from the annotation lib, but then fail at runtime during testing.
Here's how I've done it (I'll open a PR soon enough):
import org.jetbrains.kotlin.cli.jvm.config.addJvmClasspathRoots
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.EnvironmentConfigurator
import org.jetbrains.kotlin.test.services.RuntimeClasspathProvider
import org.jetbrains.kotlin.test.services.TestServices
import java.io.File
class PluginAnnotationsProvider(testServices: TestServices) : EnvironmentConfigurator(testServices) {
companion object {
val annotationsRuntimeClasspath =
System.getProperty("annotationsRuntime.classpath")?.split(File.pathSeparator)?.map(::File)
?: error("Unable to get a valid classpath from 'annotationsRuntime.classpath' property")
}
override fun configureCompilerConfiguration(configuration: CompilerConfiguration, module: TestModule) {
configuration.addJvmClasspathRoots(annotationsRuntimeClasspath)
}
}
class PluginRuntimeAnnotationsProvider(testServices: TestServices) : RuntimeClasspathProvider(testServices) {
override fun runtimeClassPaths(module: TestModule) = PluginAnnotationsProvider.annotationsRuntimeClasspath
}then in AbstractJvmBoxTest.configure, I added:
useCustomRuntimeClasspathProviders(::PluginRuntimeAnnotationsProvider)Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingopen to contributionsContributions from the community are welcomeContributions from the community are welcome