1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 16:28:12 -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 zipFilePath = KFiles.joinDir("kobaltBuild", "libs", "kobalt-$KOBALT_VERSION.zip")
if (File(zipFilePath).exists()) {
val zipFile = JarFile(zipFilePath)
val stream = JarInputStream(FileInputStream(zipFilePath))
var entry = stream.nextEntry
@ -57,16 +58,19 @@ class VerifyKobaltZipTest : KobaltTest() {
}
entry = stream.nextEntry
}
if (! foundKobaltw) {
if (!foundKobaltw) {
throw KobaltException("Couldn't find kobaltw in $zipFilePath")
}
if (! foundJar) {
if (!foundJar) {
throw KobaltException("Couldn't find jar in $zipFilePath")
}
if (! foundWrapperJar) {
if (!foundWrapperJar) {
throw KobaltException("Couldn't find wrapper jar in $zipFilePath")
}
log(1, "$zipFilePath looks correct")
} else {
log(1, "Couldn't find $zipFilePath, skipping test")
}
}
private fun assertExistsInJarInputStream(ins: JarInputStream, vararg fileNames: String) {
@ -79,7 +83,12 @@ class VerifyKobaltZipTest : KobaltTest() {
private fun assertExistsInJar(jarName: String, vararg fileNames: String) {
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> {