jruby-gradle-storm-plugin/examples/word-count/build.gradle

46 lines
1.4 KiB
Groovy

import java.util.zip.ZipFile
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.jruby-gradle:jruby-gradle-jar-plugin:1.0.2'
/* Replace "%%VERSION%%" with the version of JRuby/Gradle Storm you wish to
* use if you want to use this build.gradle outside of gradleTest
*/
classpath 'com.github.jruby-gradle:jruby-gradle-storm-plugin:%%VERSION%%'
//classpath 'com.github.jruby-gradle:jruby-gradle-storm-plugin:0.2.0'
}
}
apply plugin: 'com.github.jruby-gradle.storm'
jrubyStorm {
topology 'hello-topology.rb'
}
/*
* This task is only here for the execution of the gradleTest
*/
task runGradleTest {
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")
}
}
}
}