summaryrefslogtreecommitdiff
path: root/java/src/IceGridGUI/plain-jar.gradle
blob: b135529467ce80de61af9d7fcd5946bc1d44636a (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
// **********************************************************************
//
// Copyright (c) 2003-2017 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: "com.zeroc.IceGridGUI.Main")
            attribute(name: "Built-By", value: "ZeroC, Inc.")
            attribute(name: "Class-Path", value: configurations.runtime.resolve().collect { "file://${it.absolutePath}" }.join(' '))
        }
    }
}

updateManifest.outputs.files("${libDir}/${jarName}")

//
// 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: "com.zeroc.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}"))
        }
    }
}
updateInstallManifest.outputs.files("${DESTDIR}${jarDir}/${jarName}")

//
// We need to sign the install JARs after updating the manifest.
//
task signInstallJar(dependsOn: updateInstallManifest) << {
    if(keystore != null && keystore.length() > 0) {
        ant.signjar(jar: "${DESTDIR}${jarDir}/${jarName}",
                    alias: "zeroc.com",
                    keystore: "${keystore}",
                    storepass:"${keystore_password}")
    }
}
signInstallJar.outputs.files("${DESTDIR}${jarDir}/${jarName}")

task install(dependsOn: signInstallJar)