Skip to content

Commit 4d6ec52

Browse files
authored
Merge pull request #1282 from grails/groovy3
Upgrade to Groovy 3.0.x
2 parents 80cca6b + fff33d8 commit 4d6ec52

File tree

18 files changed

+101
-79
lines changed

18 files changed

+101
-79
lines changed

build.gradle

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ project.ext {
1717
isTravisBuild = System.getenv().get("TRAVIS") == 'true'
1818

1919
projectMajorVersion = "7"
20-
projectMinorVersion = "0"
21-
projectPatchVersion = "4"
20+
projectMinorVersion = "1"
21+
projectPatchVersion = "0"
2222
// releaseType = "RELEASE"
2323
// releaseType = "M2"
2424
// releaseType = "RC1"
@@ -34,7 +34,7 @@ project.ext {
3434
nexusPassword = System.getenv("SONATYPE_PASSWORD") ?: project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : ''
3535
}
3636

37-
def spockDependency = "org.spockframework:spock-core:1.2-groovy-2.5"
37+
def spockDependency = "org.spockframework:spock-core:2.0-M2-groovy-3.0"
3838

3939
def isGroovyProject(project) {
4040
!project.name.contains("grails-plugins")
@@ -62,6 +62,12 @@ allprojects {
6262
if(isBuildSnapshot) {
6363
maven { url "https://repo.grails.org/grails/libs-snapshots-local" }
6464
}
65+
if(groovyVersion && groovyVersion.endsWith('-SNAPSHOT')) {
66+
maven {
67+
name 'JFrog OSS snapshot repo'
68+
url 'https://oss.jfrog.org/oss-snapshot-local/'
69+
}
70+
}
6571
}
6672

6773
configurations {
@@ -125,26 +131,29 @@ subprojects {
125131
documentation "org.fusesource.jansi:jansi:1.11"
126132
documentation "org.codehaus.groovy:groovy-dateutil:$groovyVersion"
127133
documentation 'info.picocli:picocli:3.8.0'
128-
compile group: 'org.codehaus.groovy', name: 'groovy', version: groovyVersion
129134

130-
testCompile group: 'org.codehaus.groovy', name: 'groovy-test', version: groovyVersion
131-
132-
testCompile "junit:junit:$junitVersion"
133-
testCompile (spockDependency) {
134-
exclude group:'junit',module:'junit-dep'
135-
exclude group:'org.codehaus.groovy',module:'groovy-all'
136-
exclude group:'org.hamcrest',module:'hamcrest-core'
135+
compile group: 'org.codehaus.groovy', name: 'groovy', version: groovyVersion
136+
testCompile group: 'org.codehaus.groovy', name: 'groovy-test-junit5', version: groovyVersion
137+
testCompile "org.junit.jupiter:junit-jupiter-api:5.6.0"
138+
testCompile "org.junit.platform:junit-platform-runner:1.6.0"
139+
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.6.0"
140+
141+
testCompile(spockDependency) {
142+
exclude group: 'junit', module: 'junit-dep'
143+
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
144+
exclude group: 'org.hamcrest', module: 'hamcrest-core'
137145
transitive = false
138146
}
139147
}
140148

141149
if (project.name == "grails-datastore-gorm-tck") {
142-
compile spockDependency, {
143-
exclude group:'junit',module:'junit-dep'
144-
exclude group:'org.codehaus.groovy',module:'groovy-all'
145-
exclude group:'org.hamcrest',module:'hamcrest-core'
150+
compile(spockDependency, {
151+
exclude group: 'junit', module: 'junit-dep'
152+
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
153+
exclude group: 'org.hamcrest', module: 'hamcrest-core'
146154
transitive = false
147-
}
155+
})
156+
compile "org.junit.platform:junit-platform-runner:1.6.0"
148157
}
149158
}
150159

@@ -179,6 +188,7 @@ subprojects {
179188
}
180189

181190
test {
191+
useJUnitPlatform()
182192
testLogging {
183193
exceptionFormat ='full'
184194
}
@@ -226,6 +236,10 @@ subprojects {
226236
}
227237
}
228238
}
239+
// Only enable to force update dependencies
240+
// configurations.all {
241+
// resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
242+
// }
229243
}
230244

231245
if (isStandardGroovyMavenProject) {
@@ -250,7 +264,7 @@ configurations {
250264

251265
dependencies {
252266
build "com.cenqua.clover:clover:3.0.2"
253-
build "org.apache.ant:ant-junit:1.8.1"
267+
// build "org.apache.ant:ant-junit:1.8.1"
254268
build "org.apache.ant:ant-nodeps:1.8.1"
255269
}
256270

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ grailsAsyncVersion=3.3.2
1818
slf4jVersion=1.7.29
1919
junitVersion=4.12
2020
javassistVersion=3.21.0-GA
21-
groovyVersion=2.5.6
21+
groovyVersion=3.0.3-SNAPSHOT

grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/config/Entity.groovy

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ class Entity<P extends Property> {
172172
* @param identityConfig The id config
173173
* @return This mapping
174174
*/
175-
Entity<P> id(@DelegatesTo(P) Closure identityConfig) {
175+
Entity<P> id(@DelegatesTo(Property) Closure identityConfig) {
176176
Property.configureExisting(
177177
getOrInitializePropertyConfig(GormProperties.IDENTITY),
178178
identityConfig
@@ -185,7 +185,7 @@ class Entity<P extends Property> {
185185
*
186186
* @param isVersioned True if a version property should be configured
187187
*/
188-
Entity version(@DelegatesTo(P) Closure versionConfig) {
188+
Entity version(@DelegatesTo(Property) Closure versionConfig) {
189189
P pc = getOrInitializePropertyConfig(GormProperties.VERSION)
190190
Property.configureExisting(pc, versionConfig)
191191
return this
@@ -218,7 +218,7 @@ class Entity<P extends Property> {
218218
* @param propertyConfig The property config
219219
* @return This mapping
220220
*/
221-
Entity property(String name, @DelegatesTo(P) Closure propertyConfig) {
221+
Entity property(String name, @DelegatesTo(Property) Closure propertyConfig) {
222222
P pc = getOrInitializePropertyConfig(name)
223223
Property.configureExisting(pc, propertyConfig)
224224
return this
@@ -242,7 +242,7 @@ class Entity<P extends Property> {
242242
* @param propertyConfig The property config
243243
* @return This mapping
244244
*/
245-
P property(@DelegatesTo(P) Closure propertyConfig) {
245+
P property(@DelegatesTo(Property) Closure propertyConfig) {
246246
if(propertyConfigs.containsKey('*')) {
247247
P cloned = cloneGlobalConstraint()
248248
return Property.configureExisting(cloned, propertyConfig)
@@ -277,7 +277,7 @@ class Entity<P extends Property> {
277277
* @param config The configuration
278278
* @return The new instance
279279
*/
280-
static <T extends Entity> T configureExisting(T mapping, @DelegatesTo(T) Closure config) {
280+
static <T extends Entity> T configureExisting(T mapping, @DelegatesTo(Entity) Closure config) {
281281
config.setDelegate(mapping)
282282
config.setResolveStrategy(Closure.DELEGATE_ONLY)
283283
config.call()
@@ -288,7 +288,7 @@ class Entity<P extends Property> {
288288
if(val instanceof Closure) {
289289
property(name, (Closure)val)
290290
}
291-
else if(val instanceof P) {
291+
else if(val instanceof Property) {
292292
propertyConfigs[name] =((P)val)
293293
}
294294
else {
@@ -302,7 +302,7 @@ class Entity<P extends Property> {
302302
if(args[0] instanceof Closure) {
303303
property(name, (Closure)args[0])
304304
}
305-
else if(args[0] instanceof P) {
305+
else if(args[0] instanceof Property) {
306306
propertyConfigs[name] = (P)args[0]
307307
}
308308
else if(args[0] instanceof Map) {

grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/reflect/AstAnnotationUtils.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import java.lang.annotation.Annotation
2020
*/
2121
@CompileStatic
2222
class AstAnnotationUtils {
23-
private static final Set<String> JUNIT_ANNOTATION_NAMES = new HashSet<String>(Arrays.asList("org.junit.Before", "org.junit.After"))
23+
private static final Set<String> JUNIT_ANNOTATION_NAMES = new HashSet<String>(Arrays.asList("org.junit.jupiter.api.BeforeEach", "org.junit.jupiter.api.AfterEach"))
2424

2525
static AnnotationNode findAnnotation(AnnotatedNode classNode, Class<?> type) {
2626
List<AnnotationNode> annotations = classNode.getAnnotations()

grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/reflect/ClassPropertyFetcher.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,14 +418,14 @@ public Field getDeclaredField(String name) {
418418
if(metaProperty instanceof MetaBeanProperty) {
419419
CachedField field = ((MetaBeanProperty) metaProperty).getField();
420420
if(field != null) {
421-
return field.field;
421+
return field.getCachedField();
422422
}
423423
}
424424
else if(metaProperty instanceof MultipleSetterProperty) {
425425
MultipleSetterProperty msp = (MultipleSetterProperty) metaProperty;
426426
CachedField field = msp.getField();
427427
if(field != null) {
428-
return field.field;
428+
return field.getCachedField();
429429
}
430430
}
431431
return null;

grails-datastore-core/src/test/groovy/org/grails/datastore/mapping/keyvalue/mapping/KeyValueMappingFactoryTests.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import org.grails.datastore.mapping.keyvalue.mapping.config.KeyValue
55
import org.grails.datastore.mapping.keyvalue.mapping.config.KeyValueMappingContext
66
import org.grails.datastore.mapping.keyvalue.mapping.config.KeyValuePersistentEntity
77
import org.grails.datastore.mapping.model.PersistentProperty
8-
import org.junit.Before
9-
import org.junit.Test
8+
import org.junit.jupiter.api.BeforeEach
9+
import org.junit.jupiter.api.Test
1010

1111
/**
1212
* @author Graeme Rocher
@@ -15,7 +15,7 @@ import org.junit.Test
1515
class KeyValueMappingFactoryTests {
1616
def context
1717

18-
@Before
18+
@BeforeEach
1919
void setUp() {
2020
context = new KeyValueMappingContext("myspace")
2121
context.addPersistentEntity(TestEntity)

grails-datastore-core/src/test/groovy/org/grails/datastore/mapping/model/GormMappingInheritanceTests.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package org.grails.datastore.mapping.model
22

33
import grails.gorm.annotation.Entity
4-
import org.junit.Test
54
import org.grails.datastore.mapping.model.types.*
5+
import org.junit.jupiter.api.Test
66

7-
import static org.junit.Assert.*
7+
import static org.junit.jupiter.api.Assertions.*
88

99
/**
1010
* Tests for correct mapping of entities with inheritance.
@@ -188,4 +188,4 @@ class DerivedEntityChildB extends DerivedEntity {
188188

189189
@Entity
190190
class DerivedEntityChildC extends DerivedEntity {
191-
}
191+
}

grails-datastore-core/src/test/groovy/org/grails/datastore/mapping/model/GormMappingSyntaxTests.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package org.grails.datastore.mapping.model
33
import grails.gorm.annotation.Entity
44
import org.grails.datastore.mapping.model.config.JpaMappingConfigurationStrategy
55

6-
import static org.junit.Assert.*
6+
import static org.junit.jupiter.api.Assertions.*
77

88

9-
import org.junit.Test
9+
import org.junit.jupiter.api.Test
1010
import org.grails.datastore.mapping.model.types.Association
1111
import org.grails.datastore.mapping.model.types.ManyToOne
1212
import org.grails.datastore.mapping.model.types.OneToMany

grails-datastore-core/src/test/groovy/org/grails/datastore/mapping/reflect/ClassPropertyFetcherTests.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package org.grails.datastore.mapping.reflect
22

33
import org.grails.datastore.mapping.keyvalue.mapping.config.KeyValueMappingFactory
44
import org.grails.datastore.mapping.model.config.GormProperties
5-
import org.junit.Test
5+
import org.junit.jupiter.api.Test
66

77
import java.beans.PropertyDescriptor
88

@@ -142,4 +142,4 @@ class DomainWithMultipleSetter {
142142
void setId(Long id) {
143143
this.id = id
144144
}
145-
}
145+
}

grails-datastore-gorm-tck/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ dependencies {
33
compile 'commons-lang:commons-lang:2.6'
44
compile project(":grails-datastore-gorm-async")
55
compile project(":grails-datastore-gorm-support")
6-
compile "junit:junit:$junitVersion"
6+
// compile "junit:junit:$junitVersion"
77
compile("javax.servlet:javax.servlet-api:$servletApiVersion")
88

99
runtime "org.codehaus.groovy:groovy-dateutil:$groovyVersion"
1010
}
1111

1212
//compileGroovy.groovyOptions.fork = false
13-
//compileGroovy.groovyOptions.forkOptions.jvmArgs = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005']
13+
//compileGroovy.groovyOptions.forkOptions.jvmArgs = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005']

0 commit comments

Comments
 (0)