You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2013/12/03 18:08:11 UTC

svn commit: r1547479 - /lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/dependencies/GetMavenDependenciesTask.java

Author: sarowe
Date: Tue Dec  3 17:08:11 2013
New Revision: 1547479

URL: http://svn.apache.org/r1547479
Log:
When dependency/@conf contains BOTH 'test' and 'compile', and dependency/artifact/@type != 'test', the artifact is NOT a test dependency, to handle solr-morphlines-core's compile-scope cdk-morphlines-core and test-scope cdk-morphlines-core-tests dependencies

Modified:
    lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/dependencies/GetMavenDependenciesTask.java

Modified: lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/dependencies/GetMavenDependenciesTask.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/dependencies/GetMavenDependenciesTask.java?rev=1547479&r1=1547478&r2=1547479&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/dependencies/GetMavenDependenciesTask.java (original)
+++ lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/dependencies/GetMavenDependenciesTask.java Tue Dec  3 17:08:11 2013
@@ -667,7 +667,7 @@ public class GetMavenDependenciesTask ex
         dependencyClassifiers.put(dependencyCoordinate, classifiers);
       }
       String conf = dependency.getAttribute("conf");
-      boolean isTestDependency = conf.contains("test");
+      boolean confContainsTest = conf.contains("test");
       boolean isOptional = optionalExternalDependencies.contains(dependencyCoordinate);
       SortedSet<ExternalDependency> deps = allExternalDependencies.get(module);
       if (null == deps) {
@@ -683,6 +683,8 @@ public class GetMavenDependenciesTask ex
           Element artifact = (Element)artifacts.item(artifactNum);
           String type = artifact.getAttribute("type");
           String ext = artifact.getAttribute("ext");
+          // When conf contains BOTH "test" and "compile", and type != "test", this is NOT a test dependency
+          boolean isTestDependency = confContainsTest && (type.equals("test") || ! conf.contains("compile"));
           if ((type.isEmpty() && ext.isEmpty()) || type.equals("jar") || ext.equals("jar")) {
             String classifier = artifact.getAttribute("maven:classifier");
             if (classifier.isEmpty()) {
@@ -696,7 +698,7 @@ public class GetMavenDependenciesTask ex
         }
       } else {
         classifiers.add(null);
-        deps.add(new ExternalDependency(groupId, artifactId, null, isTestDependency, isOptional));
+        deps.add(new ExternalDependency(groupId, artifactId, null, confContainsTest, isOptional));
       }
     }
   }