Skip to content

Commit

Permalink
deprecated support for older versions of the Groovy plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
daspilker committed Oct 18, 2017
1 parent ad8a750 commit 099b8f8
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Browse the Jenkins issue tracker to see any [open issues](https://issues.jenkins
* 1.67 (unreleased)
* Enhanced support for the [Groovy Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Groovy+plugin)
([JENKINS-44256](https://issues.jenkins-ci.org/browse/JENKINS-44256))
* Support for the older versions of the [Groovy Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Groovy+plugin) is
deprecated, see [Migration](Migration#migrating-to-167)
* 1.66 (October 14 2017)
* Enhanced support for the [Notification Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Notification+Plugin)
([#1067](https://github.com/jenkinsci/job-dsl-plugin/pull/1067))
Expand Down
7 changes: 7 additions & 0 deletions docs/Migration.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## Migrating to 1.67

### Groovy Plugin

Support for versions older than 2.0 of the [Groovy Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Groovy+plugin) is
[[deprecated|Deprecation-Policy]] and will be removed.

## Migrating to 1.66

### Notification
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ class StepContext extends AbstractExtensibleContext {
}

protected groovy(String commandOrFileName, boolean isCommand, String groovyInstallation, Closure groovyClosure) {
jobManagement.logPluginDeprecationWarning('groovy', '2.0')

GroovyContext groovyContext = new GroovyContext()
ContextHelper.executeInContext(groovyClosure, groovyContext)

Expand All @@ -380,6 +382,8 @@ class StepContext extends AbstractExtensibleContext {
*/
@RequiresPlugin(id = 'groovy')
void systemGroovyCommand(String command, @DslContext(SystemGroovyCommandContext) Closure closure = null) {
jobManagement.logPluginDeprecationWarning('groovy', '2.0')

SystemGroovyCommandContext systemGroovyContext = new SystemGroovyCommandContext(jobManagement)
ContextHelper.executeInContext(closure, systemGroovyContext)

Expand Down Expand Up @@ -417,6 +421,8 @@ class StepContext extends AbstractExtensibleContext {
*/
@RequiresPlugin(id = 'groovy')
void systemGroovyScriptFile(String fileName, @DslContext(SystemGroovyContext) Closure systemGroovyClosure = null) {
jobManagement.logPluginDeprecationWarning('groovy', '2.0')

SystemGroovyContext systemGroovyContext = new SystemGroovyContext()
ContextHelper.executeInContext(systemGroovyClosure, systemGroovyContext)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,7 @@ class StepContextSpec extends Specification {
scriptSourceNode.command.size() == 1
scriptSourceNode.command[0].value() == "println 'Hello World!'"
1 * jobManagement.requirePlugin('groovy')
1 * jobManagement.logPluginDeprecationWarning('groovy', '2.0')

when:
context.groovyCommand('acme.Acme.doSomething()', 'Groovy 2.0') {
Expand Down Expand Up @@ -817,6 +818,7 @@ class StepContextSpec extends Specification {
acmeScriptSourceNode.command.size() == 1
acmeScriptSourceNode.command[0].value() == 'acme.Acme.doSomething()'
1 * jobManagement.requirePlugin('groovy')
1 * jobManagement.logPluginDeprecationWarning('groovy', '2.0')
}

def 'call groovyScriptFile methods'() {
Expand Down Expand Up @@ -845,6 +847,7 @@ class StepContextSpec extends Specification {
scriptSourceNode.scriptFile.size() == 1
scriptSourceNode.scriptFile[0].value() == 'scripts/hello.groovy'
1 * jobManagement.requirePlugin('groovy')
1 * jobManagement.logPluginDeprecationWarning('groovy', '2.0')

when:
context.groovyScriptFile('acme.groovy', 'Groovy 2.0') {
Expand Down Expand Up @@ -894,6 +897,7 @@ class StepContextSpec extends Specification {
groovy21Node.groovyName.size() == 1
groovy21Node.groovyName[0].value() == 'Groovy 2.1'
1 * jobManagement.requirePlugin('groovy')
1 * jobManagement.logPluginDeprecationWarning('groovy', '2.0')
}

def 'call systemGroovyCommand methods'() {
Expand All @@ -914,6 +918,7 @@ class StepContextSpec extends Specification {
scriptSourceNode.command.size() == 1
scriptSourceNode.command[0].value() == "println 'Hello World!'"
1 * jobManagement.requirePlugin('groovy')
1 * jobManagement.logPluginDeprecationWarning('groovy', '2.0')

when:
context.systemGroovyCommand('acme.Acme.doSomething()') {
Expand All @@ -937,6 +942,7 @@ class StepContextSpec extends Specification {
acmeScriptSourceNode.command.size() == 1
acmeScriptSourceNode.command[0].value() == 'acme.Acme.doSomething()'
1 * jobManagement.requirePlugin('groovy')
1 * jobManagement.logPluginDeprecationWarning('groovy', '2.0')
}

def 'call systemGroovyScriptFile methods'() {
Expand All @@ -957,6 +963,7 @@ class StepContextSpec extends Specification {
scriptSourceNode.scriptFile.size() == 1
scriptSourceNode.scriptFile[0].value() == 'scripts/hello.groovy'
1 * jobManagement.requirePlugin('groovy')
1 * jobManagement.logPluginDeprecationWarning('groovy', '2.0')

when:
context.systemGroovyScriptFile('acme.groovy') {
Expand All @@ -980,6 +987,7 @@ class StepContextSpec extends Specification {
acmeScriptSourceNode.scriptFile.size() == 1
acmeScriptSourceNode.scriptFile[0].value() == 'acme.groovy'
1 * jobManagement.requirePlugin('groovy')
1 * jobManagement.logPluginDeprecationWarning('groovy', '2.0')
}

def 'call systemGroovyCommand methods with plugin version 2.0'() {
Expand All @@ -1006,6 +1014,7 @@ class StepContextSpec extends Specification {
}
}
1 * jobManagement.requirePlugin('groovy')
1 * jobManagement.logPluginDeprecationWarning('groovy', '2.0')

when:
context.systemGroovyCommand('acme.Acme.doSomething()') {
Expand Down Expand Up @@ -1037,6 +1046,7 @@ class StepContextSpec extends Specification {
}
1 * jobManagement.requirePlugin('groovy')
1 * jobManagement.requireMinimumPluginVersion('groovy', '2.0')
1 * jobManagement.logPluginDeprecationWarning('groovy', '2.0')
}

def 'call systemGroovyCommand with invalid classpath and plugin version 2.0'() {
Expand Down Expand Up @@ -1073,6 +1083,7 @@ class StepContextSpec extends Specification {
}
}
1 * jobManagement.requirePlugin('groovy')
1 * jobManagement.logPluginDeprecationWarning('groovy', '2.0')

when:
context.systemGroovyScriptFile('acme.groovy') {
Expand All @@ -1096,6 +1107,7 @@ class StepContextSpec extends Specification {
}
}
1 * jobManagement.requirePlugin('groovy')
1 * jobManagement.logPluginDeprecationWarning('groovy', '2.0')
}

def 'call copyArtifacts selector variants'() {
Expand Down

0 comments on commit 099b8f8

Please sign in to comment.