Properly fail the gradleTest if the was no storm topology produced

This commit is contained in:
R. Tyler Croy 2015-08-10 15:56:48 -07:00
parent 4d1dc25e59
commit 43b07fc936
No known key found for this signature in database
GPG Key ID: 1426C7DC3F51E16F
1 changed files with 19 additions and 1 deletions

View File

@ -1,3 +1,5 @@
import java.util.zip.ZipFile
buildscript {
repositories {
jcenter()
@ -24,5 +26,21 @@ jrubyStorm {
* This task is only here for the execution of the gradleTest
*/
task runGradleTest {
dependsOn jrubyStorm
dependsOn assembleJRubyStorm
doLast {
Task assemble = project.tasks.findByName('assembleJRubyStorm')
logger.info("${assemble.outputs.files.files}")
/* Verify we have some outputs, otherwise what's the point */
if (!assemble.outputs.files.files) {
throw new GradleException("The task ${assemble} doesn't declare outputs")
}
/* ensure our outputs contain a valid jar file (aka Zip) */
assemble.outputs.files.files.each { File jar ->
logger.info("Looking at ${jar}")
ZipFile f = new ZipFile(jar)
if ((new ZipFile(jar)).size() <= 0) {
throw new GradleException("The file ${jar} does not appear to be valid")
}
}
}
}