summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjose <jose@zeroc.com>2016-06-08 20:02:49 +0200
committerjose <jose@zeroc.com>2016-06-08 20:02:49 +0200
commitcc07d2439914c670bf9dc7d1886709eb69899a45 (patch)
treec343bdf7c047a1bcf143702207c7b83ef62642e8
parentRemove ../resources from Class-Path (diff)
downloadice-cc07d2439914c670bf9dc7d1886709eb69899a45.tar.bz2
ice-cc07d2439914c670bf9dc7d1886709eb69899a45.tar.xz
ice-cc07d2439914c670bf9dc7d1886709eb69899a45.zip
Allow to build JAR files with Class-Path entries
When setting jarsClassPath to true Class-Path entries are added to JAR files during install, we don't want to do that while buidling so the JARs Class-Path reflect the install location.
-rw-r--r--java/gradle.properties7
-rw-r--r--java/gradle/library.gradle33
2 files changed, 35 insertions, 5 deletions
diff --git a/java/gradle.properties b/java/gradle.properties
index 509318595e1..b5e805e062d 100644
--- a/java/gradle.properties
+++ b/java/gradle.properties
@@ -27,6 +27,13 @@ dbHome =
//
prefix =
+//
+// Set to true if you want to add Class-Path entries to Ice JAR files
+// when installing the JARs. That is mostly usefull when building JAR
+// files to be used in system packages.
+//
+jarsClassPath = false
+
//
// The Jgoodies third party package versions to use with IceGridGUI builds.
diff --git a/java/gradle/library.gradle b/java/gradle/library.gradle
index 95fabf9d096..ee97f60a628 100644
--- a/java/gradle/library.gradle
+++ b/java/gradle/library.gradle
@@ -125,9 +125,32 @@ clean {
delete(pomName)
}
-task install(type: Copy, dependsOn: jarSources, overwrite: true) {
- from "${pomName}"
- from "${libDir}/${jar.archiveName}"
- from "${libDir}/${project.name}-${project.version}-sources.jar"
- into "${DESTDIR}${jarDir}"
+//
+// Check if we need to update the JARs class-path
+//
+if(jarsClassPath.toBoolean()){
+ task copyJars(type: Copy, dependsOn: jarSources, overwrite: true) {
+ from "${pomName}"
+ from "${libDir}/${jar.archiveName}"
+ from "${libDir}/${project.name}-${project.version}-sources.jar"
+ into "${DESTDIR}${jarDir}"
+ }
+
+ task updateInstallManifest(dependsOn: copyJars) << {
+ ant.jar(update: true, destfile: "${DESTDIR}${jarDir}/${jar.archiveName}") {
+ delegate.manifest {
+ attribute(name: "Built-By", value: "ZeroC, Inc.")
+ attribute(name: "Class-Path", value: configurations.runtime.resolve().collect { it.toURI() }.join(' ').replaceAll("${libDir}", "${jarDir}"))
+ }
+ }
+ }
+
+ install.dependsOn(updateInstallManifest)
+} else {
+ task install(type: Copy, dependsOn: jarSources, overwrite: true) {
+ from "${pomName}"
+ from "${libDir}/${jar.archiveName}"
+ from "${libDir}/${project.name}-${project.version}-sources.jar"
+ into "${DESTDIR}${jarDir}"
+ }
}