Proposed JRuby version can be optional

This commit is contained in:
Schalk Cronje 2019-12-24 16:14:31 +01:00
parent b308fd2b0d
commit 7e130116f1
6 changed files with 11 additions and 9 deletions

View File

@ -184,12 +184,12 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec {
/** 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.
*
* @deprecated Use{@code jruby.getJrubyVersion( )} instead.
* @deprecated Use{@code jruby.getProposedJRubyVersion( )} instead.
*
*/
@Deprecated
String getJrubyVersion() {
deprecated('Use jruby.getJrubyVersion() rather getJrubyVersion()')
deprecated('Use jruby.getProposedJRubyVersion() rather getProposedJRubyVersion()')
jruby.jrubyVersion
}

View File

@ -111,7 +111,7 @@ class JRubyPluginExtension extends AbstractCombinedProjectTaskExtension {
*/
@Deprecated
String getDefaultVersion() {
deprecated('Use getJrubyVersion() rather than getDefaultVersion()')
deprecated('Use getProposedJRubyVersion() rather than getDefaultVersion()')
getJrubyVersion()
}

View File

@ -62,7 +62,7 @@ class JRubyPrepare extends AbstractJRubyPrepare {
* @return Intended version of JRuby.
*/
@Override
protected String getJrubyVersion() {
protected String getProposedJRubyVersion() {
jruby.jrubyVersion
}

View File

@ -72,12 +72,12 @@ class JRubyExecTaskSpec extends Specification {
when:
project.configure(execTask) {
jruby.gemConfiguration configurationName
jruby.jrubyVersion newVersion
jruby.getProposedJRubyVersion newVersion
}
project.evaluate()
then:
execTask.jruby.jrubyVersion != project.jruby.jrubyVersion
execTask.jruby.jrubyVersion != project.jruby.getProposedJRubyVersion
and: "jrubyConfigurationName must point to this new configuration"
execTask.jruby.getGemConfiguration().name == configurationName

View File

@ -110,10 +110,12 @@ abstract class AbstractJRubyPrepare extends DefaultTask implements JRubyAwareTas
*
* This method should not resolve any files to obtain the version.
*
* @return Intended version of JRuby.
* @return Intended version of JRuby. Can be {@code null} if the version
* is indirectly inferred via configuration.
*/
@Input
abstract protected String getJrubyVersion()
@Optional
abstract protected String getProposedJRubyVersion()
@TaskAction
void exec() {

View File

@ -1,4 +1,4 @@
version=2.0.0-alpha.5
version=2.0.0-alpha.6
group=com.github.jruby-gradle
copyrightYear=2014-2019