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 byteOut = ByteArrayOutputStream()
|
||||||
val exitCode = PrintStream(byteOut).use { err ->
|
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) {
|
if (exitCode != ExitCode.OK) {
|
||||||
|
|||||||
@@ -34,6 +34,12 @@
|
|||||||
<artifactId>kotlin-stdlib</artifactId>
|
<artifactId>kotlin-stdlib</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<artifactId>kotlin-test-junit</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>kotlin-compiler</artifactId>
|
<artifactId>kotlin-compiler</artifactId>
|
||||||
@@ -103,7 +109,8 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<systemPropertyVariables>
|
<systemPropertyVariables>
|
||||||
<jvm>${env.JDK_17}/bin/java</jvm>
|
<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>
|
</systemPropertyVariables>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
|
|||||||
+9
-3
@@ -41,6 +41,7 @@ import java.io.PrintStream
|
|||||||
import java.net.URI
|
import java.net.URI
|
||||||
import java.util.jar.Manifest
|
import java.util.jar.Manifest
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
import kotlin.test.*
|
||||||
|
|
||||||
class ScriptUtilIT {
|
class ScriptUtilIT {
|
||||||
|
|
||||||
@@ -121,9 +122,14 @@ done
|
|||||||
try {
|
try {
|
||||||
val configuration = CompilerConfiguration().apply {
|
val configuration = CompilerConfiguration().apply {
|
||||||
addJvmClasspathRoots(PathUtil.getJdkClassesRoots())
|
addJvmClasspathRoots(PathUtil.getJdkClassesRoots())
|
||||||
val rtJar = System.getProperty("kotlin.java.runtime.jar")
|
fun addJarFromSystemProperty(key: String) {
|
||||||
Assert.assertNotNull(rtJar)
|
val jarFile = File(System.getProperty(key) ?: fail("'$key' property is not set"))
|
||||||
addJvmClasspathRoot(File(rtJar))
|
assertTrue(jarFile.exists())
|
||||||
|
addJvmClasspathRoot(jarFile)
|
||||||
|
}
|
||||||
|
addJarFromSystemProperty("kotlin.java.runtime.jar")
|
||||||
|
addJarFromSystemProperty("kotlin.java.stdlib.jar")
|
||||||
|
|
||||||
put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, messageCollector)
|
put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, messageCollector)
|
||||||
addKotlinSourceRoot(scriptPath)
|
addKotlinSourceRoot(scriptPath)
|
||||||
getResourcePathForClass(DependsOn::class.java).let {
|
getResourcePathForClass(DependsOn::class.java).let {
|
||||||
|
|||||||
Reference in New Issue
Block a user