Files
kotlin-fork/compiler/testData/integration/ant/jvm/doNotIncludeRuntimeByDefault/test.kt
T
Alexander Udalov e17153fab9 Minor, improve Ant test on includeRuntime
Also check that we _do_ include runtime if includeRuntime is true.
2021-01-21 18:29:19 +01:00

16 lines
629 B
Kotlin
Vendored

import java.io.File
import java.util.jar.JarFile
fun main(args: Array<String>) {
val jar = File(args[0])
// if "includeRuntime" is specified to be true
var shouldIncludeRuntime = args[1].toBoolean()
val hasKotlinPackage = JarFile(jar).entries().toList().any { it.name.startsWith("kotlin/") }
if (shouldIncludeRuntime != hasKotlinPackage) {
println(
"Error: Kotlin runtime is expected to be included only if the attribute \"includeRuntime\" is specified to be true\n" +
"includeRuntime = ${shouldIncludeRuntime}; hasKotlinPackage = $hasKotlinPackage"
)
}
}