// ********************************************************************** // // 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. // // ********************************************************************** sourceCompatibility = iceSourceCompatibility targetCompatibility = iceTargetCompatibility def 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']}], ['jfxrt.jar', 'lib/jfxrt.jar', 'lib/ext/jfxrt.jar', 'jre/lib/jfxrt.jar', 'jre/lib/ext/jfxrt.jar']) def hasJavaFx = javafxJar != null if (hasJavaFx) { apply plugin: 'application' apply from: 'javafx.gradle' } else { sourceSets { main { java { exclude '**/LiveDeployment/GraphView.java' } } } } configurations { bundleapp } dependencies { compile project(':ice') compile project(':icelocatordiscovery') compile project(':icebox') compile project(':icestorm') compile project(':glacier2') compile project(':icegrid') compile 'com.jgoodies:jgoodies-common:1.8.0' compile 'com.jgoodies:jgoodies-looks:2.6.0' compile 'com.jgoodies:jgoodies-forms:1.8.0' bundleapp 'com.oracle:appbundler:1.0' } def tmpJarName = "IceGridGUITEMP.jar" def jarName = "icegridgui.jar" jar { archiveName = tmpJarName if (!hasJavaFx) { manifest { attributes 'Main-Class': "IceGridGUI.Main" } } } buildscript { repositories { maven { url "https://${iceMavenRepo}/nexus/content/repositories/thirdparty" } } dependencies { classpath group: 'net.sourceforge', name: 'proguard', version: '5.0' } } def 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 } } if (hasJavaFx) { libJars << javafxJar } 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.') attribute(name: 'Class-Path', value: '../resources/') } } } } def env = System.getenv() def keystore = env['JARSIGNER_KEYSTORE'] def keystore_password = env['JARSIGNER_KEYSTORE_PASSWORD'] task signjar(dependsOn: updateManifest) << { if(keystore != null && keystore.length() > 0) { ant.signjar(jar: "${libDir}/${jarName}", alias: 'zeroc.com', keystore:"${keystore}", storepass:"${keystore_password}") } } assemble.dependsOn(signjar) if(macosx) { def appName = "IceGrid Admin" task bundleapp(dependsOn: updateManifest) << { ant.taskdef(name: 'bundleapp', classname: 'com.oracle.appbundler.AppBundlerTask', classpath: configurations.bundleapp.asPath) ant.bundleapp(outputdirectory: "${libDir}", name: appName, displayname: appName, identifier: "com.zeroc.IceGridGUI", icon: "${projectDir}/src/main/resources/icons/icegrid.icns", shortversion: "${project.version}", applicationCategory: "public.app-category.utilities", mainclassname: "IceGridGUI/MainProxy", copyright: "Copyright © 2005-2016 ZeroC, Inc. All rights reserved.") { classpath(file: "${libDir}/${jarName}") { } option(value: "-Dapple.laf.useScreenMenuBar=true") { } option(value: "-Dcom.apple.macos.use-file-dialog-packages=true") { } option(value: "-Dcom.apple.macos.useScreenMenuBar=true") { } option(value: "-Xdock:name=IceGrid Admin") { } option(value: "-Dcom.apple.mrj.application.apple.menu.about.name=${appName}") { } } } assemble.dependsOn(bundleapp) task copyBundle(type: Copy, dependsOn: bundleapp) { from "${libDir}/${appName}.app" into "${DESTDIR}/${prefix}/${appName}.app" } } clean { delete("${libDir}/${jarName}") delete("${libDir}/IceGrid Admin.app") } task copyJars(type: Copy, dependsOn: updateManifest) { from new File("${libDir}/${jarName}") into "${DESTDIR}${jarDir}" } task install(dependsOn: copyJars) if(macosx) { install.dependsOn(copyBundle) }