summaryrefslogtreecommitdiff
path: root/java/src/IceGridGUI/build.gradle
blob: 2418697bb86c4151259872438ec8b490a8d5d6da (plain)
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
// **********************************************************************
//
// 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

project.ext.displayName = "IceGridGUI"
project.ext.description = ""

project.ext.macosx = System.properties['os.name'] == "Mac OS X"

// Check for JavaFX support
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'])

project.ext.hasJavaFx = javafxJar != null

if (project.ext.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-looks:${jgoodiesLooksVersion}"
      compile "com.jgoodies:jgoodies-forms:${jgoodiesFormsVersion}"
      bundleapp 'com.oracle:appbundler:1.0'
}

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
    if (!hasJavaFx) {
        manifest {
            attributes 'Main-Class': "IceGridGUI.Main"
        }
    }
}

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) {
      project.ext.libJars << jfile
    }
}

if (hasJavaFx) {
    project.ext.libJars << javafxJar
}

if(icegridguiProguard.toBoolean()){
    apply from: "proguard-jar.gradle"
}else{
    apply from: "plain-jar.gradle"
}

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")
}

if(macosx) {
    install.dependsOn(copyBundle)
}