diff options
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/IceGridGUI/build.gradle | 131 | ||||
-rw-r--r-- | java/src/IceGridGUI/plain-jar.gradle | 63 | ||||
-rw-r--r-- | java/src/IceGridGUI/proguard-jar.gradle | 44 |
3 files changed, 125 insertions, 113 deletions
diff --git a/java/src/IceGridGUI/build.gradle b/java/src/IceGridGUI/build.gradle index de44639da3d..2418697bb86 100644 --- a/java/src/IceGridGUI/build.gradle +++ b/java/src/IceGridGUI/build.gradle @@ -6,23 +6,22 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** - sourceCompatibility = iceSourceCompatibility targetCompatibility = iceTargetCompatibility project.ext.displayName = "IceGridGUI" project.ext.description = "" -def macosx = System.properties['os.name'] == "Mac OS X" +project.ext.macosx = System.properties['os.name'] == "Mac OS X" // Check for JavaFX support -def javafxJar = searchFile([{System.env['JFXRT_HOME']}, { System.env['JAVA_HOME']}, {System.properties['java.home']}], +project.ext.javafxJar = searchFile([{System.env['JFXRT_HOME']}, { System.env['JAVA_HOME']}, {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 != null +project.ext.hasJavaFx = javafxJar != null -if (hasJavaFx) { +if (project.ext.hasJavaFx) { apply plugin: 'application' apply from: 'javafx.gradle' } else { @@ -51,11 +50,11 @@ dependencies { bundleapp 'com.oracle:appbundler:1.0' } -def tmpJarName = "IceGridGUITEMP.jar" -def jarName = "icegridgui.jar" -def env = System.getenv() -def keystore = env['JARSIGNER_KEYSTORE'] -def keystore_password = env['JARSIGNER_KEYSTORE_PASSWORD'] +project.ext.tmpJarName = "IceGridGUITEMP.jar" +project.ext.jarName = "icegridgui.jar" +project.ext.env = System.getenv() +project.ext.keystore = env['JARSIGNER_KEYSTORE'] +project.ext.keystore_password = env['JARSIGNER_KEYSTORE_PASSWORD'] jar { archiveName = tmpJarName @@ -66,112 +65,23 @@ jar { } } -buildscript { - repositories { - mavenCentral() - maven { - url "https://${iceMavenRepo}/nexus/content/repositories/thirdparty" - } - } - dependencies { - if(icegridguiProguard.toBoolean()) { - classpath group: 'net.sourceforge', name: 'proguard', version: '5.0' - } - } -} - -def libJars = [] +project.ext.libJars = [] ['rt.jar', 'jsse.jar', 'i386/default/jclSC170/vm.jar', 'amd64/default/jclSC170/vm.jar', 'ibmcertpathfw.jar', 'math.jar'].each { def jfile = searchFile([{System.env['JAVA_HOME']}, {System.properties['java.home']}], ["${it}", "lib/${it}", "jre/lib/${it}"]) if (jfile) { - libJars << jfile + project.ext.libJars << jfile } } if (hasJavaFx) { - libJars << javafxJar + project.ext.libJars << javafxJar } -if(icegridguiProguard.toBoolean()) { - - task proguardJar(type: proguard.gradle.ProGuardTask, dependsOn: jar) { - injars configurations.compile.resolve(), filter: "!META-INF/**" - injars "${projectDir}/build/libs/${tmpJarName}" - outjars "${libDir}/${jarName}" - libraryjars libJars - configuration 'icegridgui.pro' - } - - task updateManifest(dependsOn: proguardJar) << { - if (hasJavaFx) { - ant.jar(update: true, destfile: "${libDir}/${jarName}") { - delegate.manifest { - attribute(name: 'Main-Class', value: 'IceGridGUI.MainProxy') - attribute(name: 'Built-By', value: 'Zeroc, Inc.') - } - } - } - } - - task copyJars(type: Copy, dependsOn: updateManifest) { - from new File("${libDir}/${jarName}") - into "${DESTDIR}${jarDir}" - } - -} else { - - task copyTmpJars(type: Copy, dependsOn: jar) { - from new File("${projectDir}/build/libs/${tmpJarName}") - into "${libDir}" - rename("${tmpJarName}", "${jarName}") - - } - - task updateManifest(dependsOn: copyTmpJars) << { - ant.jar(update: true, destfile: "${libDir}/${jarName}") { - delegate.manifest { - attribute(name: "Main-Class", value: "IceGridGUI.Main") - attribute(name: "Built-By", value: "ZeroC, Inc.") - attribute(name: "Class-Path", value: configurations.runtime.resolve().collect { "file://${it.absolutePath}" }.join(' ')) - } - } - } - - // - // Copy JARs to the install location - // - task copyJars(type: Copy, dependsOn: jar) { - from new File("${projectDir}/build/libs/${tmpJarName}") - into "${DESTDIR}${jarDir}" - rename("${tmpJarName}", "${jarName}") - } - - // - // We need to update the manifest of the installed IceGridGUI jar and fix the - // Class-Path to point to the installed JAR files. - // - task updateInstallManifest(dependsOn: copyJars) << { - ant.jar(update: true, destfile: "${DESTDIR}${jarDir}/${jarName}") { - delegate.manifest { - attribute(name: "Main-Class", value: "IceGridGUI.Main") - attribute(name: "Built-By", value: "ZeroC, Inc.") - attribute(name: "Class-Path", value: configurations.runtime.resolve().collect { "file://${it.absolutePath}" }.join(' ').replaceAll("${libDir}", "${jarDir}")) - } - } - } - - // - // We need to sign the install JARs after updating the manifest. - // - task signInstalJar(dependsOn: updateInstallManifest) << { - if(keystore != null && keystore.length() > 0) { - ant.signjar(jar: "${DESTDIR}${jarDir}/${jarName}", - alias: "zeroc.com", - keystore: "${keystore}", - storepass:"${keystore_password}") - } - } +if(icegridguiProguard.toBoolean()){ + apply from: "proguard-jar.gradle" +}else{ + apply from: "plain-jar.gradle" } task signjar(dependsOn: updateManifest) << { @@ -184,6 +94,7 @@ task signjar(dependsOn: updateManifest) << { } assemble.dependsOn(signjar) + if(macosx) { def appName = "IceGrid Admin" @@ -228,12 +139,6 @@ clean { delete("${libDir}/IceGrid Admin.app") } -if(icegridguiProguard.toBoolean()) { - task install(dependsOn: copyJars) -}else{ - task install(dependsOn: signInstalJar) -} - if(macosx) { install.dependsOn(copyBundle) -} +}
\ No newline at end of file diff --git a/java/src/IceGridGUI/plain-jar.gradle b/java/src/IceGridGUI/plain-jar.gradle new file mode 100644 index 00000000000..e4ec2f2cf06 --- /dev/null +++ b/java/src/IceGridGUI/plain-jar.gradle @@ -0,0 +1,63 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +task copyTmpJars(type: Copy, dependsOn: jar) { + from new File("${projectDir}/build/libs/${tmpJarName}") + into "${libDir}" + rename("${tmpJarName}", "${jarName}") + +} + +task updateManifest(dependsOn: copyTmpJars) << { + ant.jar(update: true, destfile: "${libDir}/${jarName}") { + delegate.manifest { + attribute(name: "Main-Class", value: "IceGridGUI.Main") + attribute(name: "Built-By", value: "ZeroC, Inc.") + attribute(name: "Class-Path", value: configurations.runtime.resolve().collect { "file://${it.absolutePath}" }.join(' ')) + } + } +} + +// +// Copy JARs to the install location +// +task copyJars(type: Copy, dependsOn: jar) { + from new File("${projectDir}/build/libs/${tmpJarName}") + into "${DESTDIR}${jarDir}" + rename("${tmpJarName}", "${jarName}") +} + +// +// We need to update the manifest of the installed IceGridGUI jar and fix the +// Class-Path to point to the installed JAR files. +// +task updateInstallManifest(dependsOn: copyJars) << { + ant.jar(update: true, destfile: "${DESTDIR}${jarDir}/${jarName}") { + delegate.manifest { + attribute(name: "Main-Class", value: "IceGridGUI.Main") + attribute(name: "Built-By", value: "ZeroC, Inc.") + attribute(name: "Class-Path", value: configurations.runtime.resolve().collect { "file://${it.absolutePath}" }.join(' ').replaceAll("${libDir}", "${jarDir}")) + } + } +} + +// +// We need to sign the install JARs after updating the manifest. +// +task signInstalJar(dependsOn: updateInstallManifest) << { + if(keystore != null && keystore.length() > 0) { + ant.signjar(jar: "${DESTDIR}${jarDir}/${jarName}", + alias: "zeroc.com", + keystore: "${keystore}", + storepass:"${keystore_password}") + } +} + +task install(dependsOn: signInstalJar) + diff --git a/java/src/IceGridGUI/proguard-jar.gradle b/java/src/IceGridGUI/proguard-jar.gradle new file mode 100644 index 00000000000..b9988538e0c --- /dev/null +++ b/java/src/IceGridGUI/proguard-jar.gradle @@ -0,0 +1,44 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +buildscript { + repositories { + mavenCentral() + } + + dependencies { + classpath "net.sf.proguard:proguard-gradle:5.2.1" + } +} + +task proguardJar(type: proguard.gradle.ProGuardTask, dependsOn: jar) { + injars configurations.compile.resolve(), filter: "!META-INF/**" + injars "${projectDir}/build/libs/${tmpJarName}" + outjars "${libDir}/${jarName}" + libraryjars project.ext.libJars + configuration 'icegridgui.pro' +} + +task updateManifest(dependsOn: proguardJar) << { + if (hasJavaFx) { + ant.jar(update: true, destfile: "${libDir}/${jarName}") { + delegate.manifest { + attribute(name: 'Main-Class', value: 'IceGridGUI.MainProxy') + attribute(name: 'Built-By', value: 'Zeroc, Inc.') + } + } + } +} + +task copyJars(type: Copy, dependsOn: updateManifest) { + from new File("${libDir}/${jarName}") + into "${DESTDIR}${jarDir}" +} + +task install(dependsOn: copyJars) |