Skip to content

Commit 099b8f8

Browse files
committed
deprecated support for older versions of the Groovy plugin
1 parent ad8a750 commit 099b8f8

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

docs/Home.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Browse the Jenkins issue tracker to see any [open issues](https://issues.jenkins
3131
* 1.67 (unreleased)
3232
* Enhanced support for the [Groovy Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Groovy+plugin)
3333
([JENKINS-44256](https://issues.jenkins-ci.org/browse/JENKINS-44256))
34+
* Support for the older versions of the [Groovy Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Groovy+plugin) is
35+
deprecated, see [Migration](Migration#migrating-to-167)
3436
* 1.66 (October 14 2017)
3537
* Enhanced support for the [Notification Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Notification+Plugin)
3638
([#1067](https://github.com/jenkinsci/job-dsl-plugin/pull/1067))

docs/Migration.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## Migrating to 1.67
2+
3+
### Groovy Plugin
4+
5+
Support for versions older than 2.0 of the [Groovy Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Groovy+plugin) is
6+
[[deprecated|Deprecation-Policy]] and will be removed.
7+
18
## Migrating to 1.66
29

310
### Notification

job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/step/StepContext.groovy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,8 @@ class StepContext extends AbstractExtensibleContext {
359359
}
360360

361361
protected groovy(String commandOrFileName, boolean isCommand, String groovyInstallation, Closure groovyClosure) {
362+
jobManagement.logPluginDeprecationWarning('groovy', '2.0')
363+
362364
GroovyContext groovyContext = new GroovyContext()
363365
ContextHelper.executeInContext(groovyClosure, groovyContext)
364366

@@ -380,6 +382,8 @@ class StepContext extends AbstractExtensibleContext {
380382
*/
381383
@RequiresPlugin(id = 'groovy')
382384
void systemGroovyCommand(String command, @DslContext(SystemGroovyCommandContext) Closure closure = null) {
385+
jobManagement.logPluginDeprecationWarning('groovy', '2.0')
386+
383387
SystemGroovyCommandContext systemGroovyContext = new SystemGroovyCommandContext(jobManagement)
384388
ContextHelper.executeInContext(closure, systemGroovyContext)
385389

@@ -417,6 +421,8 @@ class StepContext extends AbstractExtensibleContext {
417421
*/
418422
@RequiresPlugin(id = 'groovy')
419423
void systemGroovyScriptFile(String fileName, @DslContext(SystemGroovyContext) Closure systemGroovyClosure = null) {
424+
jobManagement.logPluginDeprecationWarning('groovy', '2.0')
425+
420426
SystemGroovyContext systemGroovyContext = new SystemGroovyContext()
421427
ContextHelper.executeInContext(systemGroovyClosure, systemGroovyContext)
422428

job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/step/StepContextSpec.groovy

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,7 @@ class StepContextSpec extends Specification {
780780
scriptSourceNode.command.size() == 1
781781
scriptSourceNode.command[0].value() == "println 'Hello World!'"
782782
1 * jobManagement.requirePlugin('groovy')
783+
1 * jobManagement.logPluginDeprecationWarning('groovy', '2.0')
783784

784785
when:
785786
context.groovyCommand('acme.Acme.doSomething()', 'Groovy 2.0') {
@@ -817,6 +818,7 @@ class StepContextSpec extends Specification {
817818
acmeScriptSourceNode.command.size() == 1
818819
acmeScriptSourceNode.command[0].value() == 'acme.Acme.doSomething()'
819820
1 * jobManagement.requirePlugin('groovy')
821+
1 * jobManagement.logPluginDeprecationWarning('groovy', '2.0')
820822
}
821823

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

849852
when:
850853
context.groovyScriptFile('acme.groovy', 'Groovy 2.0') {
@@ -894,6 +897,7 @@ class StepContextSpec extends Specification {
894897
groovy21Node.groovyName.size() == 1
895898
groovy21Node.groovyName[0].value() == 'Groovy 2.1'
896899
1 * jobManagement.requirePlugin('groovy')
900+
1 * jobManagement.logPluginDeprecationWarning('groovy', '2.0')
897901
}
898902

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

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

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

961968
when:
962969
context.systemGroovyScriptFile('acme.groovy') {
@@ -980,6 +987,7 @@ class StepContextSpec extends Specification {
980987
acmeScriptSourceNode.scriptFile.size() == 1
981988
acmeScriptSourceNode.scriptFile[0].value() == 'acme.groovy'
982989
1 * jobManagement.requirePlugin('groovy')
990+
1 * jobManagement.logPluginDeprecationWarning('groovy', '2.0')
983991
}
984992

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

10101019
when:
10111020
context.systemGroovyCommand('acme.Acme.doSomething()') {
@@ -1037,6 +1046,7 @@ class StepContextSpec extends Specification {
10371046
}
10381047
1 * jobManagement.requirePlugin('groovy')
10391048
1 * jobManagement.requireMinimumPluginVersion('groovy', '2.0')
1049+
1 * jobManagement.logPluginDeprecationWarning('groovy', '2.0')
10401050
}
10411051

10421052
def 'call systemGroovyCommand with invalid classpath and plugin version 2.0'() {
@@ -1073,6 +1083,7 @@ class StepContextSpec extends Specification {
10731083
}
10741084
}
10751085
1 * jobManagement.requirePlugin('groovy')
1086+
1 * jobManagement.logPluginDeprecationWarning('groovy', '2.0')
10761087

10771088
when:
10781089
context.systemGroovyScriptFile('acme.groovy') {
@@ -1096,6 +1107,7 @@ class StepContextSpec extends Specification {
10961107
}
10971108
}
10981109
1 * jobManagement.requirePlugin('groovy')
1110+
1 * jobManagement.logPluginDeprecationWarning('groovy', '2.0')
10991111
}
11001112

11011113
def 'call copyArtifacts selector variants'() {

0 commit comments

Comments
 (0)