@@ -147,7 +148,7 @@ dependencies {
jrubyExec 'rubygems:credit_card_validator:1.2.0'
}
-task runMyScript( type: JRubyExec ) {
+task runMyScript(type: JRubyExec) {
script 'scripts/runme.rb'
scriptArgs '-x', '-y'
}
@@ -198,8 +199,10 @@ uses it’s own work directory. Use this to set a common work directory for
-
(*) If jRubyVersion has not been set, jrubyExec will used as
-configuration. However, if jRubyVersion has been set, no gems will be used unless an explicit configuration has been provided
+
(*) If jrubyVersion has not been set, jrubyExec will used as configuration.
+However, if jrubyVersion has been set, a configuration must also be provded
+to maintain dependency isolation, see
+this page for more details.
Additional JRubyExec methods for controlling the JVM instance
@@ -244,7 +247,11 @@ configuration. However, if jRubyVersion has been set, no gems will
jrubyexec extension
-
Similar to javaexec and exec it is possible to add the execution of a jruby script within another task
+
Similar to
+javaexec
+and
+exec
+it is possible to add the execution of a JRuby script to another task:
build.gradle
@@ -294,8 +301,7 @@ All other methods should work.
@@ -335,7 +341,7 @@ All other methods should work.
import com.github.jrubygradle.JRubyPrepare
-task unpackMyGems( type : JRubyPrepare ) {
+task unpackMyGems(type : JRubyPrepare) {
// Parent directory for unpacking GEMs.
// Gems will end up in a subdirectory 'gems/GemName-GemVersion'
diff --git a/community.html b/community/index.html
similarity index 89%
rename from community.html
rename to community/index.html
index 8179a72..fd60fb2 100644
--- a/community.html
+++ b/community/index.html
@@ -1,7 +1,7 @@
-
-
+
+
JRuby/Gradle Community
@@ -14,27 +14,27 @@ JRuby/Gradle Community
The
+JRubyExec
+task allows the user to define a specific version of
+JRuby via the jrubyVersion property. This requires the
+requested version of JRuby to be added to a dependency graph. In order to
+prevent unintentional conflicts in the dependency graph, the base
+plugin will prevent a JRubyExec task from adding a different JRuby version to
+the defaultjrubyExec
+configuration.
+
+
+
+
+
How to fix it
+
+
+
Fixing this behavior is relatively easy, the JRubyExec task which requires
+its own custom version of JRuby to be installed should also use a custom,
+user-defined, configuration. E.g.
If that work-around didn’t help fix the issue, then you may have encountered an
+unknown bug!. Please
+file an issue
+so we can correct the broken behavior!
+
+
+
+
+
+
Links
+
+
+
+
+
issue #157
+captures the first reported side-effect of the previous behavior which
+led to the restriction behind defined in the base plugin
jrubyVersion If it is required that a JRubyExec task needs to be executed with a different version of JRuby that the
- globally configured one, it can be done by setting it here.
getJrubyVersion() If it is required that a JRubyExec task needs to be executed with a different version of JRuby that the
+ globally configured one, it can be done by setting it here.
updateJRubyDependencies(Project project) Ensure that our JRuby depedencies are updated properly for the default jrubyExec configuration
+ and all other JRubyExec tasks
static final java.lang.String JAR_DEPENDENCIES_VERSION
-
-
-
-
-
-
-
-
static final java.lang.String JRUBYEXEC_CONFIG
-
-
-
-
-
-
-
-
@Optional
-@Input
-java.lang.String configuration
-
Configuration to copy gems from. If jRubyVersion has not been set, jRubyExec will used as
- configuration. However, if jRubyVersion has been set, not gems will be used unless an explicit
- configuration has been provided
-
-
-
-
-
-
-
-
-
@Input
-java.lang.String jrubyVersion
-
If it is required that a JRubyExec task needs to be executed with a different version of JRuby that the
- globally configured one, it can be done by setting it here.
-
Returns a list of jruby arguments
@@ -485,27 +339,21 @@ java.util.List<java.lang.String> getJrubyArgs()
-
+
-
java.lang.String getJrubyConfigurationName()
-
Returns the Configuration object this task is tied to
+
@Input
+java.lang.String getJrubyVersion()
+
If it is required that a JRubyExec task needs to be executed with a different version of JRuby that the
+ globally configured one, it can be done by setting it here.
Ensure that our JRuby depedencies are updated properly for the default jrubyExec configuration
+ and all other JRubyExec tasks
+
+ This function also ensures that we have a proper version of jar-dependencies
+ on older versions of JRuby so jar requires work properly on those version
+
Parameters:
project
Since:
1.0.0
+
+
+
+
+
+
+
void validateTaskConfiguration()
+
Verify that we are in a good configuration for execution
@java.util.Optional
+ /** Adds dependencies from the given configuration to be prepared
+ *
+ * @param f A file, directory, configuration or list of gems
+ */
+void dependencies(java.lang.Object f)
diff --git a/groovydoc/jruby-gradle-base-plugin/com/github/jrubygradle/JRubyPrepareGems.html b/groovydoc/jruby-gradle-base-plugin/com/github/jrubygradle/JRubyPrepareGems.html
index 81f4b9e..ea3cd81 100644
--- a/groovydoc/jruby-gradle-base-plugin/com/github/jrubygradle/JRubyPrepareGems.html
+++ b/groovydoc/jruby-gradle-base-plugin/com/github/jrubygradle/JRubyPrepareGems.html
@@ -6,9 +6,9 @@
-
- JRubyPrepareGems (jruby-gradle-base-plugin 0.4.1 API)
-
+
+ JRubyPrepareGems (jruby-gradle-base-plugin 1.0.0 API)
+
@@ -17,7 +17,7 @@
diff --git a/groovydoc/jruby-gradle-base-plugin/com/github/jrubygradle/JRubyPrepareJars.html b/groovydoc/jruby-gradle-base-plugin/com/github/jrubygradle/JRubyPrepareJars.html
index aa4338e..df2f477 100644
--- a/groovydoc/jruby-gradle-base-plugin/com/github/jrubygradle/JRubyPrepareJars.html
+++ b/groovydoc/jruby-gradle-base-plugin/com/github/jrubygradle/JRubyPrepareJars.html
@@ -6,9 +6,9 @@
-
- JRubyPrepareJars (jruby-gradle-base-plugin 0.4.1 API)
-
+
+ JRubyPrepareJars (jruby-gradle-base-plugin 1.0.0 API)
+
@@ -17,7 +17,7 @@
diff --git a/groovydoc/jruby-gradle-base-plugin/com/github/jrubygradle/internal/GemVersion.html b/groovydoc/jruby-gradle-base-plugin/com/github/jrubygradle/internal/GemVersion.html
index 3c4d45f..d99aecc 100644
--- a/groovydoc/jruby-gradle-base-plugin/com/github/jrubygradle/internal/GemVersion.html
+++ b/groovydoc/jruby-gradle-base-plugin/com/github/jrubygradle/internal/GemVersion.html
@@ -6,9 +6,9 @@
-
- GemVersion (jruby-gradle-base-plugin 0.4.1 API)
-
+
+ GemVersion (jruby-gradle-base-plugin 1.0.0 API)
+
@@ -17,7 +17,7 @@
@@ -271,7 +271,7 @@ if (location.href.indexOf('is-external=true') == -1) {
this method just calculates the intersection of this version range
with the given other version range. it also honors whether the boundary
itself is included or excluded by the respective ranges.
-
Parameters:
String - the other version range to be intersected with this version range
Returns:
GemVersion the intersected version range
+
Returns:
GemVersion the intersected version range
Parameters:
String - the other version range to be intersected with this version range
Directory to use for unpacking GEMs.
- This is optional. If not set, then an internal generated folder will be used. In general the latter behaviour
- is preferred as it allows for isolating different JRubyExec tasks. However, this functionality is made
- available for script authors for would like to control this behaviour and potentially share GEMs between
- various JRubyExec tasks.
-
Provides common traits for JRuby script execution across the JRubyExec
task and {@project.jrubyexec} extension.
+
+ This trait is primarily meant as a plugin-internal interface/implementation which allows
+ for the asy set up and invocation of a JRuby environment unlike JRubyExec
+ it is not meant to directly set up or execute a Ruby script.
+
+ It's functions are primarily:
+ * Prepare Ruby gem dependencies
+ * Prepare JVm (jar) dependencies
+ * Set up the execution environment
+
+ After that, it is up to the actual subclass extending JRubyExecAbstractTask to
+ decide how it wants to execute JRuby
Prepare the Ruby and Java dependencies for the configured configuration
+
+ This method will determine the appropriate dependency overwrite behavior
+ from the Gradle invocation. In effect, if the --refresh-dependencies flag
+ is used, already installed gems will be overwritten.
+
buildArgs(java.util.List<java.lang.Object> extra, java.util.List<java.lang.Object> jrubyArgs, java.io.File script, java.util.List<java.lang.Object> scriptArgs) Construct the correct set of arguments based on the parameters to invoke jruby-complete.jar with
@@ -186,8 +191,9 @@ if (location.href.indexOf('is-external=true') == -1) {
preparedEnvironment(java.util.Map<java.lang.String, java.lang.Object> env, boolean inheritRubyEnv) Prepare a basic environment for usage with an external JRuby environment
+
static void
+
updateJRubyDependenciesForConfiguration(Project project, java.lang.String configuration, java.lang.String version) Update the given configuration on the project with the appropriate versions
+ of JRuby and supplemental dependencies to execute JRuby successfully
@@ -233,10 +239,18 @@ if (location.href.indexOf('is-external=true') == -1) {
Property Detail
-
+
-
static final java.util.List FILTER_ENV_KEYS
+
static final java.lang.String DEFAULT_JRUBYEXEC_CONFIG
+
+
+
+
+
+
+
+
static final java.lang.String JAR_DEPENDENCIES_VERSION
@@ -270,7 +284,8 @@ if (location.href.indexOf('is-external=true') == -1) {
If it is required that a JRubyExec task needs to be executed with a different version of JRuby that the
+ globally configured one, it can be done by setting it here.
Properties - that affect how the GEM is packaged in the JAR. Currently only fullGem is
- supported. If set the full GEM content will be packed, otherwise only a subset will be packed.
dir - Source folder. Will be handled by project.files(dir)
@@ -147,19 +147,17 @@ puts "apply plugin: "com.github.jruby-gradle.jar"
dependencies {
- /* Using the built-in `gems` configuration to describe the
+ /* Using the built-in `jrubyJar` configuration to describe the
* dependencies our jrubyJar task will need, so the gem is properly
* included in the resulting .jar file
*/
- gems "rubygems:colorize:0.7.7+"
+ jrubyJar "rubygems:colorize:0.7.7+"
}
jrubyJar {
/* We want to use this Ruby script as our start point when the jar executes
*/
initScript "${projectDir}/entrypoint.rb"
- /* make sure we use our gems from the default "gems" configuration! */
- defaultGems()
}
Currently, the jar plugin only depends on the base plugin of the
+same version as the jar plugin and the java-base plugin included with your
+version of Gradle.
+
+
+
+
+
+
+
Tasks
+
+
+
JRubyJar
+
+
build.gradle
+
+
jrubyJar {
+ // Use the default GEM installation directory
+ defaultGems()
+
+ // Add this GEM installation directory to the JAR.
+ // Can be called more than once for additional directories
+ gemDir '/path/to/my/gemDir'
+
+ // Equivalent to calling defaultGems()
+ defaults 'gem'
+
+ // All methods and properties from `Jar`
+}
jrubyJar {
+ // tell the plugin to pack a runnable jar
+ initScript runnable()
+
+ // Use the default bootstrap class (can be omitted)
+ defaultMainClass()
+
+ // Includes the default gems to the jar (can be omitted)
+ defaultGems()
+
+ // Make the JAR executable by supplying your own main class
+ mainClass 'my.own.main'
+
+ // Equivalent to calling defaultMainClass() and defaultGems()
+ defaults 'gems', 'mainClass'
+}
+
+
+
+
+
+
Library Jars
+
+
+
A library jar isn’t really much more than a container which includes the
+configured gems and jar dependencies inside of the packaged .jar file.
+
+
+
build.gradle
+
+
jrubyJar {
+ // tell the plugin to pack a runnable jar (no bootstrap script)
+ initScript library()
+
+ // Includes the default gems to the jar (can be omitted)
+ defaultGems()
+
+ // Equivalent to calling defaultGems()
+ defaults 'gems'
+}
+
+
+
+
+
+
+
+
diff --git a/news.atom b/news.atom
index 2e6ae87..8c1937b 100644
--- a/news.atom
+++ b/news.atom
@@ -5,11 +5,11 @@
-http://jruby-gradle.org/news/2015/07/09/jrubyjar-improvements.html
+http://jruby-gradle.org/news/2015/07/09/jrubyjar-improvements/2015-07-20T16:21:55-07:002015-07-09T00:00:00+00:00
-
+
Improvements to jar packaging
@@ -32,11 +32,11 @@ Hello
-http://jruby-gradle.org/news/2015/07/08/new-jruby-default.html
+http://jruby-gradle.org/news/2015/07/08/new-jruby-default/2015-07-20T16:21:55-07:002015-07-08T00:00:00+00:00
-
+
JRuby 1.7.21 now defaulted
diff --git a/news/2015/07/08/new-jruby-default.html b/news/2015/07/08/new-jruby-default/index.html
similarity index 100%
rename from news/2015/07/08/new-jruby-default.html
rename to news/2015/07/08/new-jruby-default/index.html
diff --git a/news/2015/07/09/jrubyjar-improvements.html b/news/2015/07/09/jrubyjar-improvements/index.html
similarity index 100%
rename from news/2015/07/09/jrubyjar-improvements.html
rename to news/2015/07/09/jrubyjar-improvements/index.html
diff --git a/news.html b/news/index.html
similarity index 82%
rename from news.html
rename to news/index.html
index 4d5b5f5..b785892 100644
--- a/news.html
+++ b/news/index.html
@@ -1,7 +1,7 @@
-
-
+
+
JRuby/Gradle News
@@ -14,27 +14,27 @@ JRuby/Gradle News