You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ud...@apache.org on 2020/07/02 18:10:37 UTC
[geode] 01/29: GEODE-8239 - Add gradle config to add 'Class-Path'
and 'Dependent-Modules' attirbutes to manifest file.
This is an automated email from the ASF dual-hosted git repository.
udo pushed a commit to branch feature/GEODE-8294
in repository https://gitbox.apache.org/repos/asf/geode.git
commit 449ee49e8dfea31866dba7b3bd7644dc508a7e36
Author: Patrick Johnson <pj...@pivotal.io>
AuthorDate: Wed Jun 24 10:20:58 2020 -0700
GEODE-8239 - Add gradle config to add 'Class-Path' and 'Dependent-Modules' attirbutes to manifest file.
---
gradle/java.gradle | 16 +++++++---------
gradle/publish-java.gradle | 45 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 9 deletions(-)
diff --git a/gradle/java.gradle b/gradle/java.gradle
index c43d01a..c6d98ec 100644
--- a/gradle/java.gradle
+++ b/gradle/java.gradle
@@ -62,16 +62,14 @@ gradle.taskGraph.whenReady({ graph ->
gradle.taskGraph.whenReady({ graph ->
tasks.withType(Jar).each { jar ->
jar.doFirst {
- manifest {
- attributes(
- "Manifest-Version": "1.0",
- "Created-By": System.getProperty("user.name"),
- "Title": rootProject.name,
- "Version": version,
- "Organization": productOrg
- )
+ manifest {
+ attributes.put("Manifest-Version", "1.0")
+ attributes.put("Created-By", System.getProperty("user.name"))
+ attributes.put("Title", rootProject.name)
+ attributes.put("Version", version)
+ attributes.put("Organization", productOrg)
+ }
}
- }
jar.metaInf {
from("$rootDir/geode-assembly/src/main/dist/LICENSE")
if (jar.source.filter({ it.name.contains('NOTICE') }).empty) {
diff --git a/gradle/publish-java.gradle b/gradle/publish-java.gradle
index 3a47b6a..7c33802 100644
--- a/gradle/publish-java.gradle
+++ b/gradle/publish-java.gradle
@@ -28,3 +28,48 @@ publishing {
}
}
}
+
+gradle.taskGraph.whenReady({ graph ->
+ tasks.withType(Jar).each { jar ->
+ jar.doFirst {
+ def projectDependencies = []
+ def runtimeList = []
+
+ // Iterate over runtime classpath dependencies and separate project dependencies from library
+ // dependencies.
+ configurations.runtimeClasspath
+ .collect { it.name - ".jar" }
+ .each { dependency ->
+ if (dependency.startsWith("geode-")) {
+ projectDependencies.add(dependency)
+ } else {
+ runtimeList.add(dependency+".jar")
+ }
+ }
+
+ // Iterate over project (parent) dependencies and remove its runtime library dependencies from
+ // the current project's runtime library dependencies.
+ // Also removes all parent project's runtime project dependencies from the current project.
+ // This returns a unique set of parent project and library dependencies that are not found
+ // within it's parent's project dependencies.
+ projectDependencies.clone().each { projectDependency ->
+ def geodeProject = projectDependency - "-${version}.jar"
+ if (projectDependencies.contains(geodeProject)) {
+ def parentProject = project(":$geodeProject" - "-$version")
+ if (parentProject != null) {
+ def collect = parentProject.configurations.runtimeClasspath.collect { it.name }
+ runtimeList.removeAll(collect)
+ projectDependencies.removeAll(collect.collect {it-".jar"})
+ }
+ }
+ }
+
+ manifest {
+ attributes.put("Class-Path", runtimeList.join(' '))
+ attributes.put("Dependent-Modules", projectDependencies.join(' '))
+ attributes.put("Module-Name", project.name)
+ }
+ }
+ }
+})
+