Skip to content

Groovy 5 compatibility #14737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: 7.0.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ ext {
'bootstrap.version' : '5.3.3',
'commons-codec.version' : '1.17.1',
'geb-spock.version' : '7.0',
'groovy.version' : '4.0.26',
'groovy.version' : '5.0.0-SNAPSHOT',
'h2.version' : '2.3.232',
'jackson.version' : '2.18.2',
'jquery.version' : '3.7.1',
Expand All @@ -94,7 +94,7 @@ ext {
'rxjava2.version' : '2.2.21',
'rxjava3.version' : '3.1.10',
'selenium.version' : '4.25.0',
'spock.version' : '2.3-groovy-4.0',
'spock.version' : '2.4-M6-groovy-4.0',
]

// Note: the name of the dependency must be the prefix of the property name so properties in the pom are resolved correctly
Expand Down
10 changes: 10 additions & 0 deletions gradle/functional-test-config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,21 @@ if ('assetCompile' in tasks.names) {
}
}

tasks.named('compileTestGroovy') {
options.forkOptions.jvmArgs += ['-Dspock.iKnowWhatImDoing.disableGroovyVersionCheck=true']
}

tasks.named('compileGroovy') {
options.forkOptions.jvmArgs += ['-Dspock.iKnowWhatImDoing.disableGroovyVersionCheck=true']
}
List<String> debugArguments = [
'-Xmx2g', '-Xdebug', '-Xnoagent', '-Djava.compiler=NONE',
'-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005'
]
tasks.withType(Test).configureEach { Test task ->

systemProperty('spock.iKnowWhatImDoing.disableGroovyVersionCheck', 'true')

boolean isHibernate5 = !project.name.startsWith('grails-test-examples-hibernate5')
boolean isMongo = !project.name.startsWith('grails-test-examples-mongodb')

Expand Down
9 changes: 9 additions & 0 deletions gradle/test-config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@ dependencies {
add('testRuntimeOnly', 'org.junit.platform:junit-platform-launcher')
}

tasks.named('compileTestGroovy') {
options.forkOptions.jvmArgs += ['-Dspock.iKnowWhatImDoing.disableGroovyVersionCheck=true']
}

tasks.named('compileGroovy') {
options.forkOptions.jvmArgs += ['-Dspock.iKnowWhatImDoing.disableGroovyVersionCheck=true']
}

tasks.withType(Test).configureEach {
systemProperty('spock.iKnowWhatImDoing.disableGroovyVersionCheck', 'true')
onlyIf {
![
'onlyFunctionalTests',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package grails.async
import grails.async.decorator.PromiseDecorator
import org.grails.async.factory.future.CachedThreadPoolPromiseFactory
import spock.lang.Issue
import spock.lang.PendingFeatureIf
import spock.lang.Specification
import spock.util.concurrent.PollingConditions

Expand Down Expand Up @@ -99,6 +100,10 @@ class FutureTaskPromiseFactorySpec extends Specification {
hasError == false
}

@PendingFeatureIf({
// thrown() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test promise onError handling'() {

when: 'a promise is executed with an onComplete handler'
Expand Down Expand Up @@ -133,6 +138,10 @@ class FutureTaskPromiseFactorySpec extends Specification {
val == 10
}

@PendingFeatureIf({
// thrown() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test promise chaining with exception'() {

when: 'a promise is chained'
Expand All @@ -146,6 +155,10 @@ class FutureTaskPromiseFactorySpec extends Specification {
}

@Issue('GRAILS-10152')
@PendingFeatureIf({
// Mock() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test promise closure is not executed multiple times if it returns null'() {

given: 'a closure that returns null'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package grails.async

import spock.lang.PendingFeatureIf
import spock.lang.Specification
import spock.util.concurrent.PollingConditions

Expand Down Expand Up @@ -73,6 +74,10 @@ class PromiseListSpec extends Specification {

}

@PendingFeatureIf({
// thrown() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test promise list with an exception'() {

when: 'a promise list with a promise that throws an exception is used'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package grails.async

import grails.async.decorator.PromiseDecorator
import spock.lang.PendingFeatureIf
import spock.lang.Specification
import spock.util.concurrent.PollingConditions

Expand All @@ -42,7 +43,11 @@ class PromiseSpec extends Specification {
result == '*10*'

}


@PendingFeatureIf({
// thrown() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test promise timeout handling'() {

when: 'a promise that takes a while is created'
Expand Down Expand Up @@ -145,6 +150,10 @@ class PromiseSpec extends Specification {
}
}

@PendingFeatureIf({
// Cannot cast object '4' with class 'java.lang.Integer' to class 'java.lang.Throwable'
GroovySystem.version.startsWith('5')
})
void 'Test promise chaining'() {

when: 'a promise is chained'
Expand All @@ -156,6 +165,10 @@ class PromiseSpec extends Specification {
result == 10
}

@PendingFeatureIf({
// thrown() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test promise chaining with exception'() {

when: 'a promise is chained'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package grails.async
import grails.async.decorator.PromiseDecorator
import org.grails.async.factory.SynchronousPromiseFactory
import spock.lang.Issue
import spock.lang.PendingFeatureIf
import spock.lang.Specification
import spock.util.concurrent.PollingConditions

Expand Down Expand Up @@ -127,6 +128,10 @@ class SynchronousPromiseFactorySpec extends Specification {
result == 10
}

@PendingFeatureIf({
// thrown() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test promise chaining with exception'() {

when: 'a promise is chained'
Expand All @@ -140,6 +145,10 @@ class SynchronousPromiseFactorySpec extends Specification {
}

@Issue('GRAILS-9229')
@PendingFeatureIf({
// Mock() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test promise is executed without calling get'() {

given: 'a closure'
Expand All @@ -153,6 +162,10 @@ class SynchronousPromiseFactorySpec extends Specification {
}

@Issue('GRAILS-10152')
@PendingFeatureIf({
// Mock() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test promise closure is not executed multiple times if it returns null'() {

given: 'a closure that returns null'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package grails.async

import grails.async.decorator.PromiseDecorator
import org.grails.async.factory.gpars.GparsPromiseFactory
import spock.lang.PendingFeatureIf
import spock.lang.Specification
import spock.util.concurrent.PollingConditions

Expand Down Expand Up @@ -47,7 +48,11 @@ class GparsPromiseSpec extends Specification {
then: 'the result is decorated'
result == '*10*'
}


@PendingFeatureIf({
// thrown() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test promise timeout handling'() {

when: 'a promise that takes longer than the timeout'
Expand Down Expand Up @@ -142,6 +147,10 @@ class GparsPromiseSpec extends Specification {
value == 10
}

@PendingFeatureIf({
// thrown() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test promise chaining with exception'() {

when: 'a promise with an exception is chained'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,18 @@ import grails.async.Promises
import grails.async.web.WebPromises
import grails.util.GrailsWebMockUtil
import org.springframework.web.context.request.RequestContextHolder
import spock.lang.PendingFeatureIf
import spock.lang.Specification

/**
* Created by graemerocher on 20/02/2017.
*/
class WebPromisesSpec extends Specification {

@PendingFeatureIf({
// thrown() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test web promises handling'() {

setup:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.grails.async.factory.rxjava

import grails.async.PromiseList
import spock.lang.PendingFeatureIf
import spock.lang.Specification
import spock.util.concurrent.PollingConditions

Expand Down Expand Up @@ -77,6 +78,10 @@ class RxJavaPromiseListSpec extends Specification{
result == [1,2,3]
}

@PendingFeatureIf({
// thrown() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test promise list with an exception'() {

given: 'a promise list with a promise that throws an exception'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package org.grails.async.factory.rxjava

import grails.async.Promises
import grails.async.decorator.PromiseDecorator
import spock.lang.PendingFeatureIf
import spock.lang.Specification
import spock.util.concurrent.PollingConditions

Expand Down Expand Up @@ -47,6 +48,11 @@ class RxJavaPromiseSpec extends Specification {
result == '*10*'

}

@PendingFeatureIf({
// thrown() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test promise timeout handling'() {

when: 'a promise that takes a while is created'
Expand Down Expand Up @@ -140,6 +146,10 @@ class RxJavaPromiseSpec extends Specification {
val == 10
}

@PendingFeatureIf({
// thrown() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test promise chaining with exception'() {

when: 'a promise is chained'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.grails.async.factory.rxjava2

import grails.async.PromiseList
import spock.lang.PendingFeatureIf
import spock.lang.Specification
import spock.util.concurrent.PollingConditions

Expand Down Expand Up @@ -77,6 +78,10 @@ class RxPromiseListSpec extends Specification {

}

@PendingFeatureIf({
// thrown() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test promise list with an exception'() {

given: 'a promise list with a promise that throws an exception'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package org.grails.async.factory.rxjava2

import grails.async.Promises
import grails.async.decorator.PromiseDecorator
import spock.lang.PendingFeatureIf
import spock.lang.Specification
import spock.util.concurrent.PollingConditions

Expand Down Expand Up @@ -48,6 +49,10 @@ class RxPromiseSpec extends Specification {

}

@PendingFeatureIf({
// thrown() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test promise timeout handling'() {

when: 'a promise that takes a while is created'
Expand Down Expand Up @@ -154,6 +159,10 @@ class RxPromiseSpec extends Specification {
value == 10
}

@PendingFeatureIf({
// thrown() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test promise chaining with exception'() {

when: 'a promise is chained'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.grails.async.factory.rxjava3

import grails.async.PromiseList
import spock.lang.PendingFeatureIf
import spock.lang.Specification
import spock.util.concurrent.PollingConditions

Expand Down Expand Up @@ -74,6 +75,10 @@ class RxPromiseListSpec extends Specification {

}

@PendingFeatureIf({
// thrown() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test promise list with an exception'() {

given: 'a promise list with a promise that throws an exception'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package org.grails.async.factory.rxjava3

import grails.async.Promises
import grails.async.decorator.PromiseDecorator
import spock.lang.PendingFeatureIf
import spock.lang.Specification
import spock.util.concurrent.PollingConditions

Expand All @@ -45,6 +46,10 @@ class RxPromiseSpec extends Specification {

}

@PendingFeatureIf({
// thrown() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test promise timeout handling'() {

when: 'a promise that takes a while is created'
Expand Down Expand Up @@ -151,6 +156,10 @@ class RxPromiseSpec extends Specification {
value == 10
}

@PendingFeatureIf({
// thrown() does currently not work with Groovy 5
GroovySystem.version.startsWith('5')
})
void 'Test promise chaining with exception'() {

when: 'a promise is chained'
Expand Down
Loading
Loading