Skip to content

Commit

Permalink
Allow building IceGridGUI without JavaFx dependencies
Browse files Browse the repository at this point in the history
Introduce `iceGridGuiUseJavaFX` Gradle setting to determine if IceGridGUI should utilize JavaFX.
  • Loading branch information
pepone committed Oct 4, 2023
1 parent 36d7a93 commit c352bda
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
5 changes: 5 additions & 0 deletions java/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ debug = true
jgoodiesLooksVersion = 2.7.0
jgoodiesFormsVersion = 1.9.0

//
// Enable this property to build IceGridGUI with JavaFX support. JavaFX is used for rendering the metrics graph.
//
iceGridGuiUseJavaFX = true

//
// The OpenJFX version to use with IceGridGUI builds
//
Expand Down
45 changes: 24 additions & 21 deletions java/src/IceGridGUI/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,32 @@ import org.gradle.util.GradleVersion
project.ext.displayName = "IceGridGUI"
project.ext.description = ""

if(GradleVersion.current() >= GradleVersion.version('4.1') && JavaVersion.current() > JavaVersion.VERSION_1_10) {
ext.os = System.properties['os.name']
if(os == "Mac OS X") {
ext.platform = "mac"
ext.hasJavaFx = true
} else if(os.toLowerCase().contains("windows")) {
ext.platform = "win"
ext.hasJavaFx = true
} else if(os.toLowerCase().contains("linux")) {
ext.platform = "linux"
ext.hasJavaFx = true
ext.hasJavaFx = false

if(iceGridGuiUseJavaFX.toBoolean()) {
if(GradleVersion.current() >= GradleVersion.version('4.1') && JavaVersion.current() > JavaVersion.VERSION_1_10) {
ext.os = System.properties['os.name']
if(os == "Mac OS X") {
ext.platform = "mac"
ext.hasJavaFx = true
} else if(os.toLowerCase().contains("windows")) {
ext.platform = "win"
ext.hasJavaFx = true
} else if(os.toLowerCase().contains("linux")) {
ext.platform = "linux"
ext.hasJavaFx = true
} else {
ext.hasJavaFx = false
}
} else {
ext.hasJavaFx = false
ext.javafxJar = ['jfxrt.jar',
'lib/jfxrt.jar',
'lib/ext/jfxrt.jar',
'jre/lib/jfxrt.jar',
'jre/lib/ext/jfxrt.jar',
'lib/javafx-swt.jar'].find{ new File("${System.properties['java.home']}/${it}").exists() }
ext.hasJavaFx = javafxJar != null
}
} else {
ext.javafxJar = ['jfxrt.jar',
'lib/jfxrt.jar',
'lib/ext/jfxrt.jar',
'jre/lib/jfxrt.jar',
'jre/lib/ext/jfxrt.jar',
'lib/javafx-swt.jar'].find{ new File("${System.properties['java.home']}/${it}").exists() }

ext.hasJavaFx = javafxJar != null
}

if(!hasJavaFx) {
Expand Down

0 comments on commit c352bda

Please sign in to comment.