Ensure users of JRubyJar can provide a later jar-dependencies version than the bare minimum

Closes #271
This commit is contained in:
R. Tyler Croy 2016-07-03 13:27:39 -07:00
parent aba2ce38aa
commit e0ec117723
No known key found for this signature in database
GPG Key ID: 1426C7DC3F51E16F
2 changed files with 36 additions and 0 deletions

View File

@ -263,4 +263,39 @@ task validateJar(type: Exec) {
/* see: https://github.com/jruby-gradle/jruby-gradle-plugin/issues/191 */
result.standardOutput.contains('unexpected behavior')
}
@Issue('https://github.com/jruby-gradle/jruby-gradle-plugin/pull/271')
def 'using a more recent jar-dependencies should work'() {
given:
buildFile << """
repositories {
maven { url 'http://rubygems.lasagna.io/proxy/maven/releases' }
}
dependencies {
jrubyJar 'rubygems:jar-dependencies:0.2.3'
}
jrubyJar { initScript 'main.rb' }
task validateJar(type: Exec) {
dependsOn jrubyJar
environment [:]
workingDir "\${buildDir}/libs"
commandLine 'java', '-jar', jrubyJar.outputs.files.singleFile.absolutePath
}
"""
when:
BuildResult result = GradleRunner.create()
.withProjectDir(testProjectDir.root)
.withArguments('validateJar', '--info')
.build()
then:
builtArtifacts && builtArtifacts.size() == 1
and:
result.task(":validateJar").outcome == TaskOutcome.SUCCESS
result.standardOutput.contains("Hello from JRuby")
}
}

View File

@ -274,6 +274,7 @@ class JRubyJar extends Jar {
void addEmbeddedDependencies(Configuration config) {
/* To ensure that we can load our jars properly, we should always have
* jar-dependencies in our resolution graph */
project.dependencies.add(config.name, 'rubygems:jar-dependencies:[0.1.15,)')
}
/** Update the staging directory and tasks responsible for setting it up */