Skip to content

Fix compatibility with OpenJDK 21 #71

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# SPDX-License-Identifier: Apache-2.0
#
# Copyright 2011-2021 the original author or authors.
# Copyright 2011-2024 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
135 changes: 26 additions & 109 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
//import org.javamodularity.moduleplugin.tasks.ModularJavaExec

/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2011-2021 the original author or authors.
* Copyright 2011-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,13 +20,8 @@
plugins {
id 'groovy'
id 'idea'
id 'org.kordamp.gradle.groovy-project'
id 'org.kordamp.gradle.bintray'
id 'org.kordamp.gradle.coveralls'
id 'org.openjfx.javafxplugin'
id 'org.asciidoctor.jvm.convert'
id 'org.jonnyzzz.java9c'
id 'org.javamodularity.moduleplugin'
id 'com.google.osdetector'
}

Expand All @@ -33,92 +30,15 @@ if (!project.hasProperty('bintrayApiKey')) project.ext.bintrayApiKey = ''
if (!project.hasProperty('sonatypeUsername')) project.ext.sonatypeUsername = ''
if (!project.hasProperty('sonatypePassword')) project.ext.sonatypePassword = ''

config {
release = (rootProject.findProperty('release') ?: false).toBoolean()

info {
name = 'Groovyfx'
vendor = 'Groovyfx'
description = 'A library for writing JavaFX applications in the Groovy language'
inceptionYear = '2011'
tags = ['Groovy', 'JavaFX', 'GroovyFX']

links {
website = 'http://groovyfx.org'
issueTracker = 'https://github.com/groovyfx-project/groovyfx/issues'
scm = 'https://github.com/groovyfx-project/groovyfx.git'
}

people {
[
JimClarke5 : 'Jim Clarke',
deanriverson : 'Dean Iverson',
russel : 'Russel Winder',
aalmiray : 'Andres Almiray',
Dierk : 'Dierk König'
].each { devId, devName ->
person {
id = devId
name = devName
roles = ['developer']
}
}
}

implementation { enabled = false }

credentials {
sonatype {
username = project.sonatypeUsername
password = project.sonatypePassword
}
}
}

licensing {
licenses {
license {
id = 'Apache-2.0'
}
}
}

bintray {
credentials {
username = project.bintrayUsername
password = project.bintrayApiKey
}
userOrg = 'groovyfx'
name = 'groovyfx'
githubRepo = 'groovyfx-project/groovyfx'
}

docs {
groovydoc {
replaceJavadoc = true
options {
link 'http://junit.org/javadoc/latest/', 'org.junit.', 'junit.'
link 'http://docs.oracle.com/javase/8/docs/api/', 'java.', 'org.xml.', 'javax.', 'org.w3c.'
link 'http://docs.oracle.com/javase/8/javafx/api/', 'javafx.'
link 'http://docs.groovy-lang.org/latest/html/api/', 'groovy.', 'org.codehaus.groovy'
}
}
}

coverage {
jacoco {
toolVersion = '0.8.6'
}
}
}

repositories {
if (project.hasProperty('groovyfx_useMavenLocal') && Boolean.valueOf(project.groovyfx_useMavenLocal)) { mavenLocal() }
jcenter()
mavenCentral()
}

configurations {
jansi.extendsFrom(runtime)
demo.extendsFrom(ast)
}

javafx {
Expand All @@ -134,25 +54,14 @@ javafx {
}

dependencies {
compile "org.codehaus.groovy:groovy-all:${groovyfx_groovyVersion}"
testCompile "junit:junit:${groovyfx_junitVersion}"
implementation "org.apache.groovy:groovy-all:${groovyfx_groovyVersion}"
testImplementation "junit:junit:${groovyfx_junitVersion}"
jansi "org.fusesource.jansi:jansi:${groovyfx_jansiVersion}"
testCompile("org.spockframework:spock-core:${groovyfx_spockVersion}") {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
testImplementation("org.spockframework:spock-core:${groovyfx_spockVersion}") {
exclude group: 'org.apache.groovy', module: 'groovy-all'
}
}

license {
mapping {
java = 'SLASHSTAR_STYLE'
groovy = 'SLASHSTAR_STYLE'
gdsl = 'SLASHSTAR_STYLE'
dsld = 'SLASHSTAR_STYLE'
fxml = 'XML_STYLE'
}
exclude '**/*.png'
exclude '**/*.jpg'
}

idea {
module {
Expand Down Expand Up @@ -194,6 +103,7 @@ asciidoctor {
}

processResources {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(sourceSets.main.resources.srcDirs) {
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [
'groovyfx.version': project.version
Expand All @@ -204,23 +114,30 @@ processResources {
// ------------- compiling demo source ---------------

sourceSets {
ast {
compileClasspath += configurations.runtimeClasspath
}
main {
compileClasspath += sourceSets.ast.output + configurations.runtimeClasspath
runtimeClasspath += sourceSets.ast.output + configurations.runtimeClasspath
}
demo {
compileClasspath += sourceSets.main.output + configurations.compile
runtimeClasspath += sourceSets.main.output
groovy {
srcDir 'src/demo/groovy'
}
resources {
srcDir 'src/demo/resources'
}
compileClasspath += sourceSets.main.output + sourceSets.ast.output + configurations.runtimeClasspath
runtimeClasspath += sourceSets.main.output + sourceSets.ast.output + configurations.runtimeClasspath
}
}

task createJar(type: Jar) {
archiveBaseName.set('groovyfx')
from sourceSets.ast.output, sourceSets.main.output
exclude( "idesupport")
}

// ---------------- dynamic tasks to run demos ------------------

new File('src/demo/groovy/demo').eachFileMatch(~/.*Demo.groovy/) { file ->
def demoClassName = file.name - '.groovy'
task "run$demoClassName"(type: org.javamodularity.moduleplugin.tasks.ModularJavaExec) {
task "run$demoClassName"(type: JavaExec) {
group = "Demo"
description = "Run the $demoClassName program"
main = "groovyfx.demo/demo.$demoClassName"
Expand Down
10 changes: 4 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# SPDX-License-Identifier: Apache-2.0
#
# Copyright 2011-2021 the original author or authors.
# Copyright 2011-2024 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,15 +18,13 @@

group = org.groovyfx
archivesBaseName = groovyfx
version = 11.0.0-SNAPSHOT
version = 12.1
groovyfx_javafxVersion = 11
groovyfx_groovyVersion = 3.0.7
groovyfx_groovyVersion = 4.0.22
groovyfx_junitVersion = 4.13.2
groovyfx_spockVersion = 2.0-M3-groovy-3.0
groovyfx_spockVersion = 2.4-M4-groovy-4.0
groovyfx_jansiVersion = 1.18

kordampPluginVersion = 0.44.0

org.gradle.daemon = true
org.gradle.caching = true
org.gradle.parallel = false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
10 changes: 2 additions & 8 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2011-2021 the original author or authors.
* Copyright 2011-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,17 +17,11 @@
*/
pluginManagement {
repositories {
jcenter()
gradlePluginPortal()
}
plugins {
id 'org.kordamp.gradle.groovy-project' version kordampPluginVersion
id 'org.kordamp.gradle.bintray' version kordampPluginVersion
id 'org.kordamp.gradle.coveralls' version kordampPluginVersion
id 'org.openjfx.javafxplugin' version '0.0.9'
id 'org.openjfx.javafxplugin' version '0.1.0'
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id 'org.jonnyzzz.java9c' version '0.2.3'
id 'org.javamodularity.moduleplugin' version '1.7.0'
id 'com.google.osdetector' version '1.6.2'
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2011-2021 the original author or authors.
* Copyright 2011-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -86,7 +86,7 @@
*/
@GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION)
public class FXBindableASTTransformation implements ASTTransformation {
private static final ClassNode FXBINDABLE_CNODE = makeClassSafe(FXBindable.class);
//private static final ClassNode FXBINDABLE_CNODE = makeClassSafe(FXBindable.class);

private static final ClassNode OBJECT_PROPERTY_CNODE = makeClassSafe(ObjectProperty.class);
private static final ClassNode BOOLEAN_PROPERTY_CNODE = makeClassSafe(BooleanProperty.class);
Expand Down Expand Up @@ -161,7 +161,7 @@ public class FXBindableASTTransformation implements ASTTransformation {
*/
public static boolean hasFXBindableAnnotation(AnnotatedNode node) {
for (AnnotationNode annotation : node.getAnnotations()) {
if (FXBINDABLE_CNODE.equals(annotation.getClassNode())) {
if (annotation.getClassNode().getName().contains("FxBindable")) {
return true;
}
}
Expand Down Expand Up @@ -271,7 +271,7 @@ private void createPropertyGetterSetter(ClassNode classNode, PropertyNode origin
List<AnnotationNode> methodAnnotations = new ArrayList<>();
List<AnnotationNode> fieldAnnotations = new ArrayList<>();
for (AnnotationNode annotation : originalProp.getField().getAnnotations()) {
if (FXBINDABLE_CNODE.equals(annotation.getClassNode())) continue;
if (annotation.getClassNode().getName().contains("FXBindable")) continue;
Class annotationClass = annotation.getClassNode().getTypeClass();
Target target = (Target) annotationClass.getAnnotation(Target.class);
if (isTargetAllowed(target, ElementType.METHOD)) {
Expand Down
4 changes: 2 additions & 2 deletions src/demo/groovy/demo/AccordionDemo.groovy
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2011-2021 the original author or authors.
* Copyright 2011-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,7 @@ import static groovyx.javafx.GroovyFX.start
*/
start {
stage(title: "GroovyFX Accordion Demo", x: 100, y: 100, visible: true, style: "decorated", primary: true) {
scene(fill: GROOVYBLUE, width: 400, height: 400) {
scene(fill: ALICEBLUE, width: 400, height: 400) {
accordion {
titledPane(id: "t1", text: "Label 1") {
content {
Expand Down
4 changes: 2 additions & 2 deletions src/demo/groovy/demo/ActionMenuDemo.groovy
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2011-2021 the original author or authors.
* Copyright 2011-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -55,7 +55,7 @@ start {
}

stage(title: "GroovyFX Menu Demo", width: 650, height: 450, visible: true) {
scene(fill: GROOVYBLUE) {
scene(fill: ALICEBLUE) {
borderPane {
top {
menuBar {
Expand Down
14 changes: 5 additions & 9 deletions src/demo/groovy/demo/AnalogClockDemo.groovy
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2011-2021 the original author or authors.
* Copyright 2011-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -80,31 +80,27 @@ start {
hourDots << circle(fill: BLACK, layoutX: x, layoutY: y, radius: r)
}

scene(fill: GROOVYBLUE) {
scene(fill: ALICEBLUE) {
group(layoutX: centerX, layoutY: centerY) {
// outer rim
circle(radius: radius + 20) {
fill(radialGradient(radius: 1.0, center: [0.0, 0.0], focusDistance: 0.5, focusAngle: 0,
stops: [[0.9, SILVER], [1.0, BLACK]]))
}
// clock face
circle(radius: radius + 10, stroke: BLACK) {
fill(radialGradient(radius: 1.0, center: [0.0, 0.0], focusDistance: 4.0, focusAngle: 90,
stops: [[0.0, WHITE], [1.0, CADETBLUE]]))
circle(radius: radius + 10, fill: WHITE, stroke: BLACK) {
}
// dots around the clock for the hours
nodes(hourDots)
// center
circle(radius: 5, fill: BLACK)
// hour hand
path(fill: BLACK) {
path(fill: YELLOW) {
rotate(angle: bind(time.hourAngle()))
moveTo(x: 4, y: -4)
arcTo(radiusX: -1, radiusY: -1, x: -4, y: -4)
lineTo(x: 0, y: -radius / 4 * 3)
}
// minute hand
path(fill: BLACK) {
path(fill: YELLOW) {
rotate(angle: bind(time.minuteAngle()))
moveTo(x: 4, y: -4)
arcTo(radiusX: -1, radiusY: -1, x: -4, y: -4)
Expand Down
Loading