You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/03/18 22:43:32 UTC

[07/14] incubator-geode git commit: GEODE-27: Marking jars as optional in the generated pom

GEODE-27: Marking jars as optional in the generated pom

Adding support to mark jars as optional by setting an ext.optional
property in the dependency declaration.

Adding the optional property to jars in the geode-core project that are
not required for geode to work.

Some of these optional dependencies will go away if we can move things
like the REST API, gfsh, and management classes into another subproject.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/02b95b42
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/02b95b42
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/02b95b42

Branch: refs/heads/feature/GEODE-1050
Commit: 02b95b42986e3816d436494e7e488db6a9e26565
Parents: dc94a89
Author: Dan Smith <up...@apache.org>
Authored: Thu Mar 10 14:25:12 2016 -0800
Committer: Dan Smith <up...@apache.org>
Committed: Fri Mar 18 13:43:55 2016 -0700

----------------------------------------------------------------------
 geode-core/build.gradle | 48 ++++++++++++++++++++++++++++++++++----------
 gradle/publish.gradle   | 15 ++++++++++++++
 2 files changed, 52 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/02b95b42/geode-core/build.gradle
----------------------------------------------------------------------
diff --git a/geode-core/build.gradle b/geode-core/build.gradle
index fe5ab7e..9aa008e 100755
--- a/geode-core/build.gradle
+++ b/geode-core/build.gradle
@@ -41,15 +41,28 @@ dependencies {
     exclude module: 'commons-logging-api'
     exclude module: 'mx4j-jmx'
     exclude module: 'xml-apis'
+    ext.optional = true
+  }
+  compile ('io.netty:netty-all:' + project.'netty-all.version') {
+    ext.optional = true
   }
-  compile 'io.netty:netty-all:' + project.'netty-all.version'
   compile 'it.unimi.dsi:fastutil:' + project.'fastutil.version'
-  compile 'javax.mail:javax.mail-api:' + project.'javax.mail-api.version'
+  compile ('javax.mail:javax.mail-api:' + project.'javax.mail-api.version') {
+    ext.optional = true;
+  }
   compile 'javax.resource:javax.resource-api:' + project.'javax.resource-api.version'
-  compile 'mx4j:mx4j:' + project.'mx4j.version'
-  compile 'mx4j:mx4j-remote:' + project.'mx4j.version'
-  compile 'mx4j:mx4j-tools:' + project.'mx4j.version'
-  compile 'net.java.dev.jna:jna:' + project.'jna.version'
+  compile ('mx4j:mx4j:' + project.'mx4j.version') {
+    ext.optional = true;
+  }
+  compile ('mx4j:mx4j-remote:' + project.'mx4j.version') {
+    ext.optional = true;
+  }
+  compile ('mx4j:mx4j-tools:' + project.'mx4j.version') { 
+    ext.optional = true;
+  }
+  compile ('net.java.dev.jna:jna:' + project.'jna.version') {
+    ext.optional = true
+  }
   provided ('org.apache.hadoop:hadoop-common:' + project.'hadoop.version') {
     transitive=false
   }
@@ -71,16 +84,26 @@ dependencies {
   compile 'org.apache.logging.log4j:log4j-api:' + project.'log4j.version'
   compile 'org.apache.logging.log4j:log4j-core:' + project.'log4j.version'
   runtime 'org.fusesource.jansi:jansi:' + project.'jansi.version'
-  runtime 'org.apache.logging.log4j:log4j-slf4j-impl:' + project.'log4j.version'
-  runtime 'org.apache.logging.log4j:log4j-jcl:' + project.'log4j.version'
-  runtime 'org.apache.logging.log4j:log4j-jul:' + project.'log4j.version'
-  compile 'org.eclipse.jetty:jetty-webapp:' + project.'jetty.version'
+  runtime ('org.apache.logging.log4j:log4j-slf4j-impl:' + project.'log4j.version') {
+    ext.optional = true
+  }
+  runtime ('org.apache.logging.log4j:log4j-jcl:' + project.'log4j.version') {
+    ext.optional = true
+  }
+  runtime ('org.apache.logging.log4j:log4j-jul:' + project.'log4j.version') {
+    ext.optional = true
+  }
+  compile ('org.eclipse.jetty:jetty-webapp:' + project.'jetty.version') {
+    ext.optional = true
+  }
   runtime ('org.springframework:spring-aop:' + project.'springframework.version') {
     exclude module: 'aopalliance'
+    ext.optional = true
   }
   compile ('org.springframework:spring-webmvc:' + project.'springframework.version') {
     exclude module: 'aopalliance'
     exclude module: 'spring-aop'
+    ext.optional = true
   }
   compile ('org.springframework.shell:spring-shell:' + project.'spring-shell.version') {
     exclude module: 'aopalliance'
@@ -88,8 +111,11 @@ dependencies {
     exclude module: 'cglib'
     exclude module: 'guava'
     exclude module: 'spring-aop'
+    ext.optional = true
+  }
+  compile ('org.xerial.snappy:snappy-java:' + project.'snappy-java.version') {
+    ext.optional = true
   }
-  compile 'org.xerial.snappy:snappy-java:' + project.'snappy-java.version'
  
   compile project(':geode-common')
   compile project(':geode-joptsimple')

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/02b95b42/gradle/publish.gradle
----------------------------------------------------------------------
diff --git a/gradle/publish.gradle b/gradle/publish.gradle
index 73e4cd3..02b0e3c 100644
--- a/gradle/publish.gradle
+++ b/gradle/publish.gradle
@@ -51,6 +51,21 @@ subprojects {
   ''')
 
       elem.insertBefore(hdr, elem.getFirstChild())
+
+  
+      //This black magic checks to see if a dependency has the flag ext.optional=true
+      //set on it, and if so marks the dependency as optional in the maven pom
+      def depMap = project.configurations.compile.dependencies.collectEntries { [it.name, it] }
+      asNode().dependencies.dependency.findAll {
+        def dep = depMap.get(it.artifactId.text())
+        return dep?.hasProperty('optional') && dep.optional
+      }.each {
+        if (it.optional) {
+            it.optional.value = 'true'
+        } else {
+            it.appendNode('optional', 'true')
+        }
+      }
     }
 
     project {