summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2014-11-03 13:44:59 -0330
committerDwayne Boone <dwayne@zeroc.com>2014-11-03 13:44:59 -0330
commit36f1642a98952f44a1b1cc11f45eecd45d8d4b59 (patch)
treea8a4cf6f169fe463842f152946ae30f8b8054652 /java
parentMerge branch 'master' of ssh://git/home/git/ice (diff)
downloadice-36f1642a98952f44a1b1cc11f45eecd45d8d4b59.tar.bz2
ice-36f1642a98952f44a1b1cc11f45eecd45d8d4b59.tar.xz
ice-36f1642a98952f44a1b1cc11f45eecd45d8d4b59.zip
Some changes to javafx IceGridGUI build
Diffstat (limited to 'java')
-rw-r--r--java/gradle/ice.gradle26
-rw-r--r--java/gradle/javafx.plugin97
-rw-r--r--java/gradle/javafx7.gradle70
-rw-r--r--java/src/IceGridGUI/build.gradle32
-rw-r--r--java/src/IceGridGUI/javafx.gradle79
5 files changed, 118 insertions, 186 deletions
diff --git a/java/gradle/ice.gradle b/java/gradle/ice.gradle
index 6709cac28c8..adb3f95f413 100644
--- a/java/gradle/ice.gradle
+++ b/java/gradle/ice.gradle
@@ -188,3 +188,29 @@ ext.libDir = "$rootProject.projectDir/lib"
ext.iceSourceCompatibility = 1.7
ext.iceTargetCompatibility = 1.7
+
+ext.searchFile = { Map<String, Closure> places, List<String> searchPaths ->
+ File result = null;
+ places.each { k, v ->
+ if (result != null) {
+ return;
+ }
+ def dir = v()
+ if (dir != null) {
+ searchPaths.each { s ->
+ if (result != null) {
+ return;
+ }
+ File f = new File(dir, s);
+ if (f.exists() && f.file) {
+ result = f;
+ }
+ }
+ }
+ }
+ if (!result?.file) {
+ return ""
+ } else {
+ return result
+ }
+}
diff --git a/java/gradle/javafx.plugin b/java/gradle/javafx.plugin
deleted file mode 100644
index 43a4ec42482..00000000000
--- a/java/gradle/javafx.plugin
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Bootstrap script for the Gradle JavaFX Plugin.
- * (based on http://plugins.jasoft.fi/vaadin.plugin)
- *
- * The script will add the latest version of the plugin to the build script
- * dependencies and apply the plugin to the project. If you do not want
- * this behavior you can copy and paste the below configuration into your
- * own build script and define your own repository and version for the plugin.
- */
-
-import org.gradle.api.GradleException;
-
-
-
-buildscript {
- repositories {
- mavenLocal()
- maven {
- name = 'BinTray'
- url = 'http://dl.bintray.com/content/shemnon/javafx-gradle/'
- }
- maven {
- name = 'CloudBees Snapshot'
- url = 'http://repository-javafx-gradle-plugin.forge.cloudbees.com/snapshot'
- }
- ivy {
- url = 'http://repository-javafx-gradle-plugin.forge.cloudbees.com/snapshot'
- }
- mavenCentral()
- }
- dependencies {
- try {
- assert (jfxrtDir != null)
- } catch (RuntimeException re) {
- ext.jfxrtDir = "."
- }
-
- ext.searchFile = {Map<String, Closure> places, List<String> searchPaths, String searchID ->
- File result = null;
- places.each { k, v ->
- if (result != null) return;
- project.logger.debug("Looking for $searchID in $k")
- def dir = v()
- if (dir == null) {
- project.logger.debug("$k not set")
- } else {
- project.logger.debug("$k is $dir")
- searchPaths.each { s ->
- if (result != null) return;
- File f = new File(dir, s);
- project.logger.debug("Trying $f.path")
- if (f.exists() && f.file) {
- project.logger.debug("found $searchID as $result")
- result = f;
- }
- }
- }
- }
- if (!result?.file) {
- throw new GradleException("Could not find $searchID, please set one of ${places.keySet()}");
- } else {
- project.logger.info("$searchID: ${result}")
- return result
- }
- }
- ext.findJFXJar = {
- return searchFile([
- 'jfxrtDir in Gradle Properties': {jfxrtDir},
- 'JFXRT_HOME in System Environment': {System.env['JFXRT_HOME']},
- 'JAVA_HOME in System Environment': {System.env['JAVA_HOME']},
- 'java.home in JVM properties': {System.properties['java.home']}
- ],
- ['jfxrt.jar', 'lib/jfxrt.jar', 'lib/ext/jfxrt.jar', 'jre/lib/jfxrt.jar', 'jre/lib/ext/jfxrt.jar'],
- 'JavaFX Runtime Jar')
- }
-
- ext.findAntJavaFXJar = {
- return searchFile([
- 'jfxrtDir in Gradle Properties': {jfxrtDir},
- 'JFXRT_HOME in System Environment': {System.env['JFXRT_HOME']},
- 'JAVA_HOME in System Environment': {System.env['JAVA_HOME']},
- 'java.home in JVM properties': {System.properties['java.home']}
- ],
- ['ant-javafx.jar', 'lib/ant-javafx.jar', '../lib/ant-javafx.jar'],
- 'JavaFX Packager Tools')
- }
-
-
- classpath 'org.bitbucket.shemnon.javafxplugin:gradle-javafx-plugin:0.4.0'
- classpath project.files(findAntJavaFXJar())
- classpath project.files(findJFXJar())
- }
-}
-
-if (!project.plugins.findPlugin(org.bitbucket.shemnon.javafxplugin.JavaFXPlugin)) {
- project.apply(plugin: org.bitbucket.shemnon.javafxplugin.JavaFXPlugin)
-}
diff --git a/java/gradle/javafx7.gradle b/java/gradle/javafx7.gradle
deleted file mode 100644
index 3f7b03e767f..00000000000
--- a/java/gradle/javafx7.gradle
+++ /dev/null
@@ -1,70 +0,0 @@
-import groovy.xml.NamespaceBuilder
-
-assert project.plugins.findPlugin(JavaPlugin):
- "The Java plugin must be applied before using javafx7.gradle."
-
-assert project.plugins.findPlugin(ApplicationPlugin):
- "The Application plugin must be applied before using javafx7.gradle."
-
-def javaHome = System.properties['java.home']
-
-//logger.warn("Project '$project.name' is using fx:jar. " + "Disabling startScripts, installApp.")
-
-configurations {
- jfxrt
- jfxant
-
- sourceSets {
- main {
- compileClasspath += configurations.jfxrt
- }
- }
-}
-
-dependencies {
- jfxrt files("$javaHome" + "/lib/jfxrt.jar")
- jfxant files("$javaHome" + "/../lib/ant-javafx.jar")
-}
-
-run.classpath.add(configurations.jfxrt)
-
-jar {
- actions = []
-
- def appId = project.name
- def fallbackClassName = 'com.javafx.main.NoJavaFXFallback'
-
- def antfx = NamespaceBuilder.newInstance(
- ant,
- 'javafx:com.sun.javafx.tools.ant')
-
-
- ant.taskdef(
- resource: 'com/sun/javafx/tools/ant/antlib.xml',
- uri: 'javafx:com.sun.javafx.tools.ant',
- classpath: configurations.jfxant.asPath)
-
-
-
- doLast {
- antfx.application(
- id: appId,
- name: project.name,
- mainClass: mainClassName,
- fallbackClass: fallbackClassName)
-
- antfx.jar(destfile: archivePath) {
- application(refid: appId)
- fileset(dir: sourceSets.main.output.classesDir)
- fileset(dir: sourceSets.main.output.resourcesDir)
- }
- }
-}
-
-startScripts {
- enabled = false
-}
-
-installApp {
- enabled = false
-}
diff --git a/java/src/IceGridGUI/build.gradle b/java/src/IceGridGUI/build.gradle
index 28c65e562b4..bf7901e2f94 100644
--- a/java/src/IceGridGUI/build.gradle
+++ b/java/src/IceGridGUI/build.gradle
@@ -12,23 +12,17 @@ targetCompatibility = iceTargetCompatibility
def macosx = System.properties['os.name'] == "Mac OS X"
-def hasJavaFx = false
-def javaHome = System.getProperty('java.home')
-def javafxJar = new File(javaHome + "/lib/jfxrt.jar")
-if (javafxJar.exists()) {
- hasJavaFx = true
-} else {
- javafxJar = new File(javaHome + "/lib/ext/jfxrt.jar")
- if (javafxJar.exists()) {
- hasJavaFx = true
- }
-}
+// Check for JavaFX support
+def javafxJar = searchFile(['JFXRT_HOME in System Environment': {System.env['JFXRT_HOME']},
+ 'JAVA_HOME in System Environment': {System.env['JAVA_HOME']},
+ 'java.home in JVM properties': {System.properties['java.home']}],
+ ['jfxrt.jar', 'lib/jfxrt.jar', 'lib/ext/jfxrt.jar', 'jre/lib/jfxrt.jar',
+ 'jre/lib/ext/jfxrt.jar'])
+def hasJavaFx = javafxJar != ""
if (hasJavaFx) {
apply plugin: 'application'
- apply from: "../../gradle/javafx7.gradle"
-
- mainClassName = "IceGridGUI.Main"
+ apply from: 'javafx.gradle'
} else {
sourceSets {
main {
@@ -78,13 +72,13 @@ buildscript {
def libJars = []
['rt.jar', 'jsse.jar'].each {
- libJars << "${javaHome}/lib/${it}"
+ libJars << searchFile(['JAVA_HOME in System Environment': {System.env['JAVA_HOME']},
+ 'java.home in JVM properties': {System.properties['java.home']}],
+ ["${it}", "lib/${it}", "jre/lib/${it}"])
}
if (hasJavaFx) {
- ['jfxrt.jar', 'ext/jfxrt.jar'].each {
- libJars << "${javaHome}/lib/${it}"
- }
+ libJars << javafxJar
}
task proguardJar(type: proguard.gradle.ProGuardTask, dependsOn: jar) {
@@ -111,7 +105,7 @@ if(macosx)
icon: "${projectDir}/src/main/resources/icons/icegrid.icns",
shortversion: "${iceVersion}",
applicationCategory: "public.app-category.utilities",
- mainclassname: "com/javafx/main/Main",
+ mainclassname: "IceGridGUI/MainProxy",
copyright: "Copyright © 2005-2014 ZeroC, Inc. All rights reserved.") {
classpath(file: "${libDir}/${jarName}") {
}
diff --git a/java/src/IceGridGUI/javafx.gradle b/java/src/IceGridGUI/javafx.gradle
new file mode 100644
index 00000000000..13692fd6d85
--- /dev/null
+++ b/java/src/IceGridGUI/javafx.gradle
@@ -0,0 +1,79 @@
+import groovy.xml.NamespaceBuilder
+
+assert project.plugins.findPlugin(JavaPlugin):
+ "The Java plugin must be applied before using javafx7.gradle."
+
+assert project.plugins.findPlugin(ApplicationPlugin):
+ "The Application plugin must be applied before using javafx7.gradle."
+
+def javafxJar = searchFile([
+ 'JFXRT_HOME in System Environment': {System.env['JFXRT_HOME']},
+ 'JAVA_HOME in System Environment': {System.env['JAVA_HOME']},
+ 'java.home in JVM properties': {System.properties['java.home']}],
+ ['jfxrt.jar', 'lib/jfxrt.jar', 'lib/ext/jfxrt.jar', 'jre/lib/jfxrt.jar', 'jre/lib/ext/jfxrt.jar'])
+
+def antJavafxJar = searchFile([
+ 'JFXRT_HOME in System Environment': {System.env['JFXRT_HOME']},
+ 'JAVA_HOME in System Environment': {System.env['JAVA_HOME']},
+ 'java.home in JVM properties': {System.properties['java.home']}],
+ ['ant-javafx.jar', 'lib/ant-javafx.jar', '../lib/ant-javafx.jar'])
+
+configurations {
+ jfxrt
+ jfxant
+
+ sourceSets {
+ main {
+ compileClasspath += configurations.jfxrt
+ }
+ }
+}
+
+dependencies {
+ jfxrt files(javafxJar)
+ jfxant files(antJavafxJar)
+}
+
+run.classpath.add(configurations.jfxrt)
+
+jar {
+ actions = []
+
+ def antfx = NamespaceBuilder.newInstance(
+ ant,
+ 'javafx:com.sun.javafx.tools.ant')
+
+
+ ant.taskdef(
+ resource: 'com/sun/javafx/tools/ant/antlib.xml',
+ uri: 'javafx:com.sun.javafx.tools.ant',
+ classpath: configurations.jfxant.asPath)
+
+ doLast {
+ antfx.application(
+ id: 'IceGridGUI',
+ name: 'IceGrid Admin',
+ mainClass: 'IceGridGUI.Main',
+ fallbackClass: 'IceGridGUI.Fallback',
+ toolkit: 'swing')
+
+ antfx.resources(id: 'IceGridGUI.resources') {
+ }
+
+ antfx.jar(destfile: archivePath) {
+ application(refid: 'IceGridGUI')
+ resources(refid: 'IceGridGUI.resources')
+
+ fileset(dir: sourceSets.main.output.classesDir)
+ fileset(dir: sourceSets.main.output.resourcesDir)
+ }
+ }
+}
+
+startScripts {
+ enabled = false
+}
+
+installApp {
+ enabled = false
+}