1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-27 00:38:11 -07:00

Fix local tests.

This commit is contained in:
Cedric Beust 2016-04-18 18:53:57 -07:00
parent 7d6ac61876
commit f7912f40e7

View file

@ -39,6 +39,7 @@ class VerifyKobaltZipTest : KobaltTest() {
val mainJarFilePath = "kobalt-$KOBALT_VERSION.jar" val mainJarFilePath = "kobalt-$KOBALT_VERSION.jar"
val zipFilePath = KFiles.joinDir("kobaltBuild", "libs", "kobalt-$KOBALT_VERSION.zip") val zipFilePath = KFiles.joinDir("kobaltBuild", "libs", "kobalt-$KOBALT_VERSION.zip")
if (File(zipFilePath).exists()) {
val zipFile = JarFile(zipFilePath) val zipFile = JarFile(zipFilePath)
val stream = JarInputStream(FileInputStream(zipFilePath)) val stream = JarInputStream(FileInputStream(zipFilePath))
var entry = stream.nextEntry var entry = stream.nextEntry
@ -67,6 +68,9 @@ class VerifyKobaltZipTest : KobaltTest() {
throw KobaltException("Couldn't find wrapper jar in $zipFilePath") throw KobaltException("Couldn't find wrapper jar in $zipFilePath")
} }
log(1, "$zipFilePath looks correct") log(1, "$zipFilePath looks correct")
} else {
log(1, "Couldn't find $zipFilePath, skipping test")
}
} }
private fun assertExistsInJarInputStream(ins: JarInputStream, vararg fileNames: String) { private fun assertExistsInJarInputStream(ins: JarInputStream, vararg fileNames: String) {
@ -79,7 +83,12 @@ class VerifyKobaltZipTest : KobaltTest() {
private fun assertExistsInJar(jarName: String, vararg fileNames: String) { private fun assertExistsInJar(jarName: String, vararg fileNames: String) {
val sourceJarPath = KFiles.joinDir("kobaltBuild", "libs", jarName) val sourceJarPath = KFiles.joinDir("kobaltBuild", "libs", jarName)
assertExistsInJarInputStream(JarInputStream(FileInputStream(File(sourceJarPath))), *fileNames) val file = File(sourceJarPath)
if (file.exists()) {
assertExistsInJarInputStream(JarInputStream(FileInputStream(file)), *fileNames)
} else {
log(1, "Couldn't find $file, skipping test")
}
} }
private fun jarContents(stream: JarInputStream) : Set<String> { private fun jarContents(stream: JarInputStream) : Set<String> {