From 43b07fc93662ac3d8adfa5b72f314951dd494543 Mon Sep 17 00:00:00 2001 From: "R. Tyler Croy" Date: Mon, 10 Aug 2015 15:56:48 -0700 Subject: [PATCH] Properly fail the gradleTest if the was no storm topology produced --- examples/word-count/build.gradle | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/examples/word-count/build.gradle b/examples/word-count/build.gradle index 27ab03a..198cd72 100644 --- a/examples/word-count/build.gradle +++ b/examples/word-count/build.gradle @@ -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") + } + } + } }