Add required builtins when building tests. Either as reference to kotlin-runtime, or resort to those from the compiler with the -Xadd-compiler-builtins argument.
This commit is contained in:
+1
-1
@@ -96,7 +96,7 @@ class AnnotationsRemoverTest {
|
||||
|
||||
val byteOut = ByteArrayOutputStream()
|
||||
val exitCode = PrintStream(byteOut).use { err ->
|
||||
K2JVMCompiler().exec(err, *ktFiles, "-d", outputDir.absolutePath)
|
||||
K2JVMCompiler().exec(err, *ktFiles, "-d", outputDir.absolutePath, "-Xadd-compiler-builtins")
|
||||
}
|
||||
|
||||
if (exitCode != ExitCode.OK) {
|
||||
|
||||
@@ -34,6 +34,12 @@
|
||||
<artifactId>kotlin-stdlib</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-test-junit</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-compiler</artifactId>
|
||||
@@ -103,7 +109,8 @@
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<jvm>${env.JDK_17}/bin/java</jvm>
|
||||
<kotlin.java.runtime.jar>${org.jetbrains.kotlin:kotlin-stdlib:jar}</kotlin.java.runtime.jar>
|
||||
<kotlin.java.runtime.jar>${org.jetbrains.kotlin:kotlin-runtime:jar}</kotlin.java.runtime.jar>
|
||||
<kotlin.java.stdlib.jar>${org.jetbrains.kotlin:kotlin-stdlib:jar}</kotlin.java.stdlib.jar>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
<executions>
|
||||
|
||||
+9
-3
@@ -41,6 +41,7 @@ import java.io.PrintStream
|
||||
import java.net.URI
|
||||
import java.util.jar.Manifest
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.test.*
|
||||
|
||||
class ScriptUtilIT {
|
||||
|
||||
@@ -121,9 +122,14 @@ done
|
||||
try {
|
||||
val configuration = CompilerConfiguration().apply {
|
||||
addJvmClasspathRoots(PathUtil.getJdkClassesRoots())
|
||||
val rtJar = System.getProperty("kotlin.java.runtime.jar")
|
||||
Assert.assertNotNull(rtJar)
|
||||
addJvmClasspathRoot(File(rtJar))
|
||||
fun addJarFromSystemProperty(key: String) {
|
||||
val jarFile = File(System.getProperty(key) ?: fail("'$key' property is not set"))
|
||||
assertTrue(jarFile.exists())
|
||||
addJvmClasspathRoot(jarFile)
|
||||
}
|
||||
addJarFromSystemProperty("kotlin.java.runtime.jar")
|
||||
addJarFromSystemProperty("kotlin.java.stdlib.jar")
|
||||
|
||||
put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, messageCollector)
|
||||
addKotlinSourceRoot(scriptPath)
|
||||
getResourcePathForClass(DependsOn::class.java).let {
|
||||
|
||||
Reference in New Issue
Block a user