ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xav...@apache.org
Subject svn commit: r778742 - in /ant/ivy/core/trunk: ./ src/java/org/apache/ivy/core/resolve/ test/java/org/apache/ivy/core/resolve/
Date Tue, 26 May 2009 15:17:05 GMT
Author: xavier
Date: Tue May 26 15:17:04 2009
New Revision: 778742

URL: http://svn.apache.org/viewvc?rev=778742&view=rev
Log:
FIX: transitive dependencies and conflict management (IVY-1083)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeUsage.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/VisitNode.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=778742&r1=778741&r2=778742&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Tue May 26 15:17:04 2009
@@ -91,6 +91,7 @@
 - FIX: Wrong BuildException messages (findmodules) (IVY-1056)
 - FIX: PomModuleDescriptorBuilder does not resolve ejb type dependencies to jar extension
(IVY-1058) (thanks to Andrey Lomakin)
 - FIX: Ivy doesn't handle maven dependencies with type 'test-jar' correctly (IVY-1066)
+- FIX: transitive dependencies and conflict management (IVY-1083)
 	
    2.1.0-rc1
 =====================================

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java?rev=778742&r1=778741&r2=778742&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java Tue May 26 15:17:04
2009
@@ -1265,4 +1265,30 @@
         return usage;
     }
 
+    /**
+     * Indicates if there is any of the merged usages of this node which has a depender with
+     * transitive dependency descriptor.
+     * <p>
+     * If at there is at least one usage from the merged usages for which there is a depender
in the
+     * given root module conf which has a dependency descriptor with transitive == true,
then it
+     * returns true. Otherwise it returns false.
+     * </p>
+     * 
+     * @param rootModuleConf
+     *            the root module configuration to consider
+     * @return true if there is any merged usage with transitive dd, false otherwise.
+     */
+    public boolean hasAnyMergedUsageWithTransitiveDependency(String rootModuleConf) {
+        if (mergedUsages == null) {
+            return false;
+        }
+        for (Iterator iterator = mergedUsages.values().iterator(); iterator.hasNext();) {
+            IvyNodeUsage usage = (IvyNodeUsage) iterator.next();
+            if (usage.hasTransitiveDepender(rootModuleConf)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
 }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeUsage.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeUsage.java?rev=778742&r1=778741&r2=778742&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeUsage.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeUsage.java Tue May 26 15:17:04
2009
@@ -299,5 +299,25 @@
     protected IvyNode getNode() {
         return node;
     }
+
+    /**
+     * Indicates if at least one depender has a transitive dependency descriptor for the
given root
+     * module conf.
+     * 
+     * @param rootModuleConf
+     *            the root module conf to consider
+     * @return <code>true</code> if at least one depender has a transitive dependency
descriptor for
+     *         the given root module conf, <code>false</code> otherwise.
+     */
+    public boolean hasTransitiveDepender(String rootModuleConf) {
+        Set/*<Depender>*/ dependersSet = (Set) dependers.get(rootModuleConf);
+        for (Iterator iterator = dependersSet.iterator(); iterator.hasNext();) {
+            Depender depender = (Depender) iterator.next();
+            if (depender.dd.isTransitive()) {
+                return true;
+            }
+        }
+        return false;
+    }
     
 }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/VisitNode.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/VisitNode.java?rev=778742&r1=778741&r2=778742&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/VisitNode.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/VisitNode.java Tue May 26 15:17:04
2009
@@ -216,7 +216,9 @@
      */
     public boolean isTransitive() {
         return (data.isTransitive() 
-                && node.getDependencyDescriptor(getParentNode()).isTransitive() 
+                && (
+                        node.getDependencyDescriptor(getParentNode()).isTransitive() 
+                     || node.hasAnyMergedUsageWithTransitiveDependency(rootModuleConf))
                 && isParentConfTransitive());
     }
 

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=778742&r1=778741&r2=778742&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java Tue May 26 15:17:04
2009
@@ -1992,6 +1992,26 @@
             "commons-lang", "jar", "jar").exists());
     }
 
+    public void testResolveMergeTransitiveAfterConflict() throws Exception {
+        // mod20.4 ->  mod20.3;1.0 mod20.2;1.0
+        // mod20.3;1.0 -> mod20.1;1.0
+        // mod20.2;1.0 -> mod20.1;1.1 (transitive false)
+        // mod20.1;1.0 -> mod1.2;1.0
+        // mod20.1;1.1 -> mod1.2;1.0
+        ResolveReport report = ivy.resolve(new File("test/repositories/1/org20/mod20.4/ivys/ivy-1.0.xml")
+                .toURL(), getResolveOptions(new String[] {"*"}));
+
+        // dependencies
+        ConfigurationResolveReport crr = report.getConfigurationReport("default");
+        assertNotNull(crr);
+        assertEquals(1, crr.getDownloadReports(ModuleRevisionId
+                .newInstance("org1", "mod1.2", "1.0")).length);
+
+        assertTrue(getIvyFileInCache(
+            ModuleRevisionId.newInstance("org1", "mod1.2", "1.0")).exists());
+        assertTrue(getArchiveFileInCache("org1", "mod1.2", "1.0", "mod1.2", "jar", "jar").exists());
+    }
+
     /**
      * Test IVY-618. 
      */



Mime
View raw message