Skip to content

Commit ed72160

Browse files
committed
Create jrubyJar configuration if it does not exist
1 parent 01a5c34 commit ed72160

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

jar-plugin/src/main/groovy/com/github/jrubygradle/jar/JRubyJar.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import com.github.jengelman.gradle.plugins.shadow.internal.ZipCompressor
1919
import com.github.jengelman.gradle.plugins.shadow.internal.DefaultZipCompressor
2020

2121
/**
22-
* JRubyJar creates a Java ARchive with Ruby code packed inside of it.
22+
* JRubyJar creates a Java Archive with Ruby code packed inside of it.
2323
*
2424
* The most common use-case is when packing a self-contained executable jar
2525
* which would contain your application code, the JRuby runtime and a launcher
@@ -67,7 +67,7 @@ class JRubyJar extends Jar {
6767
void jrubyVersion(String version) {
6868
logger.info("setting jrubyVersion to ${version} from ${embeddedJRubyVersion}")
6969
embeddedJRubyVersion = version
70-
addEmbeddedDependencies(project.configurations.maybeCreate(configuration))
70+
addEmbeddedDependencies(project.configurations.maybeCreate(configuration)) // TODO <-- Should not be creating a configuration at this stage
7171
}
7272

7373
/**

jar-plugin/src/main/groovy/com/github/jrubygradle/jar/JRubyJarPlugin.groovy

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import org.gradle.api.Project
66
import org.gradle.api.Task
77
import org.gradle.api.tasks.testing.Test
88

9+
import static com.github.jrubygradle.jar.JRubyJar.DEFAULT_JRUBYJAR_CONFIG
10+
911
/**
1012
* @author Schalk W. Cronjé
1113
* @author Christian Meier
@@ -16,6 +18,7 @@ class JRubyJarPlugin implements Plugin<Project> {
1618
void apply(Project project) {
1719
project.apply plugin: 'com.github.jruby-gradle.base'
1820
project.apply plugin: 'java-base'
21+
project.configurations.maybeCreate(DEFAULT_JRUBYJAR_CONFIG)
1922
project.tasks.create('jrubyJar', JRubyJar)
2023

2124
updateTestTask(project)
@@ -35,7 +38,7 @@ class JRubyJarPlugin implements Plugin<Project> {
3538
if ((task instanceof JRubyJar) && (task.scriptName != JRubyJar.Type.LIBRARY)) {
3639
if (isJRubyVersionDeprecated(task.jrubyVersion)) {
3740
project.logger.warn('The task `{}` is using JRuby {} which may cause unexpected behavior, see <http://jruby-gradle.org/errors/jar-deprecated-jrubyversion> for more',
38-
task.name, task.jrubyVersion)
41+
task.name, task.jrubyVersion)
3942
}
4043
}
4144
}
@@ -60,8 +63,8 @@ class JRubyJarPlugin implements Plugin<Project> {
6063
// will be writing tests that includes jruby and that they might need some
6164
// GEMs as part of the tests.
6265
Closure testConfiguration = { Task t ->
63-
environment GEM_HOME : project.jruby.gemInstallDir
64-
environment JARS_HOME : project.jruby.jarInstallDir
66+
environment GEM_HOME: project.jruby.gemInstallDir
67+
environment JARS_HOME: project.jruby.jarInstallDir
6568
dependsOn 'jrubyPrepare'
6669
}
6770

0 commit comments

Comments
 (0)