update to Java 17, Groovy 4

This commit is contained in:
Jörg Prante 2021-12-18 20:30:31 +01:00
parent 3301dbddec
commit 806b1722fa
14 changed files with 22 additions and 30 deletions

View file

@ -1,9 +1,9 @@
group = org.xbib.groovy group = org.xbib.groovy
name = groovy-extensions name = groovy-extensions
version = 0.0.2 version = 4.0.0
org.gradle.warning.mode = ALL org.gradle.warning.mode = ALL
groovy.version = 2.5.12 groovy.version = 4.0.0-rc-1
gradle.wrapper.version = 7.3 gradle.wrapper.version = 7.3
files.version = 3.0.0 files.version = 3.0.0
ftp.version = 2.6.0 ftp.version = 2.6.0
@ -11,4 +11,4 @@ mail.version = 1.6.2
sshd.version = 2.6.0.0 sshd.version = 2.6.0.0
junit4.version = 4.13.2 junit4.version = 4.13.2
jgit.version = 5.13.0.202109080827-r jgit.version = 5.13.0.202109080827-r
spock.version = 2.0-groovy-2.5 spock.version = 2.0-groovy-3.0

View file

@ -1,17 +1,17 @@
apply plugin: 'groovy' apply plugin: 'groovy'
dependencies { dependencies {
implementation "org.codehaus.groovy:groovy:${project.property('groovy.version')}" implementation "org.apache.groovy:groovy:${project.property('groovy.version')}"
} }
compileGroovy { compileGroovy {
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_17
} }
compileTestGroovy { compileTestGroovy {
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_17
} }
tasks.withType(GroovyCompile) { tasks.withType(GroovyCompile) {

View file

@ -6,13 +6,13 @@ java {
} }
compileJava { compileJava {
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_17
} }
compileTestJava { compileTestJava {
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_17
} }
jar { jar {

View file

@ -6,8 +6,3 @@ idea {
testOutputDir file('build/classes/java/test') testOutputDir file('build/classes/java/test')
} }
} }
if (project.convention.findPlugin(JavaPluginConvention)) {
//sourceSets.main.output.classesDirs = file("build/classes/java/main")
//sourceSets.test.output.classesDirs = file("build/classes/java/test")
}

View file

@ -1 +0,0 @@
version = 2.2.0

View file

@ -1 +0,0 @@
version = 2.6.0

View file

@ -1 +0,0 @@
version = 2.6.0

View file

@ -2,7 +2,7 @@ apply from: rootProject.file('gradle/compile/groovy.gradle')
dependencies { dependencies {
api "org.eclipse.jgit:org.eclipse.jgit:${project.property('jgit.version')}" api "org.eclipse.jgit:org.eclipse.jgit:${project.property('jgit.version')}"
testImplementation "org.codehaus.groovy:groovy:${project.property('groovy.version')}" testImplementation "org.apache.groovy:groovy:${project.property('groovy.version')}"
testImplementation "org.spockframework:spock-core:${project.property('spock.version')}" testImplementation "org.spockframework:spock-core:${project.property('spock.version')}"
testImplementation "org.spockframework:spock-junit4:${project.property('spock.version')}" testImplementation "org.spockframework:spock-junit4:${project.property('spock.version')}"
} }

View file

@ -1 +0,0 @@
version = 2.1.0

View file

@ -18,7 +18,7 @@ public final class AnnotateAtRuntimeASTTransformation extends AbstractASTTransfo
AnnotatedNode parent = (AnnotatedNode) nodes[1]; AnnotatedNode parent = (AnnotatedNode) nodes[1];
ClassNode clazz = (ClassNode) parent; ClassNode clazz = (ClassNode) parent;
List<String> annotations = getMemberList(annotation, "annotations"); List<String> annotations = getMemberStringList(annotation, "annotations");
for (String name : annotations) { for (String name : annotations) {
// !!! UGLY HACK !!! // !!! UGLY HACK !!!
// Groovy won't think the class is an annotation when creating a ClassNode just based on the name. // Groovy won't think the class is an annotation when creating a ClassNode just based on the name.

View file

@ -42,11 +42,15 @@ public class WithOperationsASTTransformation extends AbstractASTTransformation {
if (parent instanceof ClassNode) { if (parent instanceof ClassNode) {
ClassNode clazz = (ClassNode) parent; ClassNode clazz = (ClassNode) parent;
List<ClassNode> staticOps = getClassList(annotation, "staticOperations"); List<ClassNode> staticOps = getMemberClassList(annotation, "staticOperations");
List<ClassNode> instanceOps = getClassList(annotation, "instanceOperations"); List<ClassNode> instanceOps = getMemberClassList(annotation, "instanceOperations");
staticOps.forEach(op -> makeMethods(clazz, op, true)); if (staticOps != null) {
instanceOps.forEach(op -> makeMethods(clazz, op, false)); staticOps.forEach(op -> makeMethods(clazz, op, true));
}
if (instanceOps != null) {
instanceOps.forEach(op -> makeMethods(clazz, op, false));
}
} }
} }

View file

@ -1 +0,0 @@
version = 2.2.0

View file

@ -1 +0,0 @@
version = 2.2.0

View file

@ -1 +0,0 @@
version = 3.0.0.0