45 lines
1.4 KiB
Groovy
45 lines
1.4 KiB
Groovy
import java.util.zip.ZipEntry
|
|
import java.util.zip.ZipFile
|
|
|
|
buildscript {
|
|
repositories {
|
|
jcenter()
|
|
}
|
|
|
|
dependencies {
|
|
/* 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-jar-plugin:1.1.4+'
|
|
}
|
|
}
|
|
|
|
apply plugin: 'com.github.jruby-gradle.storm'
|
|
|
|
jrubyStorm {
|
|
topology "${rootDir}/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 ->
|
|
ZipFile f = new ZipFile(jar)
|
|
if (!f.entries().find { ZipEntry ze -> ze.name.matches(/hello-topology.rb/) }) {
|
|
throw new GradleException("The file ${jar} does not appear to be valid")
|
|
}
|
|
}
|
|
}
|
|
}
|