1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
// **********************************************************************
//
// 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(':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)
}
|