You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by xa...@apache.org on 2008/06/25 14:25:25 UTC

svn commit: r671528 - in /ant/ivy/core/trunk: ./ src/java/org/apache/ivy/core/resolve/ test/java/org/apache/ivy/core/resolve/ test/repositories/1/org2/mod2.7/ test/repositories/1/org2/mod2.7/ivys/

Author: xavier
Date: Wed Jun 25 05:25:25 2008
New Revision: 671528

URL: http://svn.apache.org/viewvc?rev=671528&view=rev
Log:
FIX: transitive attribute set to false because of dependency (IVY-105)

Added:
    ant/ivy/core/trunk/test/repositories/1/org2/mod2.7/
    ant/ivy/core/trunk/test/repositories/1/org2/mod2.7/ivys/
    ant/ivy/core/trunk/test/repositories/1/org2/mod2.7/ivys/ivy-0.6.xml   (with props)
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.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=671528&r1=671527&r2=671528&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Wed Jun 25 05:25:25 2008
@@ -90,6 +90,7 @@
 - IMPROVEMENT: Change allownomd and skipbuildwithoutivy into a more semantically correct name (IVY-297)
 - IMPROVEMENT: Smarter determination if an expression is exact or not for RegexpPatternMatcher and GlobPatternMatcher
 
+- FIX: transitive attribute set to false because of dependency (IVY-105)
 - FIX: Wrong check for defaultCacheArtifactPattern (IVY-840)
 - FIX: NPE in ivy:install if ivy.settings.xml contains custom attribute for a module (IVY-838)
 - FIX: Ivy unit tests fail because 'classifier' attribute of 'artifacts' element is missing in ivy.xsd (IVY-837)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java?rev=671528&r1=671527&r2=671528&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java Wed Jun 25 05:25:25 2008
@@ -49,7 +49,6 @@
 import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
 import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
-import org.apache.ivy.core.module.id.ModuleId;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.core.report.ArtifactDownloadReport;
 import org.apache.ivy.core.report.ConfigurationResolveReport;
@@ -707,6 +706,7 @@
                     fetchDependencies(dep, confs[i], false);
                 }
             }
+            markDependenciesFetched(node.getNode(), conf);
         }
         // we have finiched with this configuration, if it was the original requested conf
         // we can clean it now
@@ -726,15 +726,20 @@
      * @return true if we've already fetched this dependency
      */
     private boolean isDependenciesFetched(IvyNode node, String conf) {
-        ModuleId moduleId = node.getModuleId();
+        String key = getDependenciesFetchedKey(node, conf);
+        return fetchedSet.contains(key);
+    }
+    
+    private void markDependenciesFetched(IvyNode node, String conf) {
+        String key = getDependenciesFetchedKey(node, conf);
+        fetchedSet.add(key);
+    }
+
+    private String getDependenciesFetchedKey(IvyNode node, String conf) {
         ModuleRevisionId moduleRevisionId = node.getResolvedId();
-        String key = moduleId.getOrganisation() + "|" + moduleId.getName() + "|"
+        String key = moduleRevisionId.getOrganisation() + "|" + moduleRevisionId.getName() + "|"
                 + moduleRevisionId.getRevision() + "|" + conf;
-        if (fetchedSet.contains(key)) {
-            return true;
-        }
-        fetchedSet.add(key);
-        return false;
+        return key;
     }
 
     private void resolveConflict(VisitNode node, String conf) {

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=671528&r1=671527&r2=671528&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 Wed Jun 25 05:25:25 2008
@@ -3002,6 +3002,26 @@
         assertTrue(!getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
     }
 
+    public void testTransitiveSetting2() throws Exception {
+        // test case for IVY-105
+        // mod2.7 depends on mod1.1 and mod2.4
+        // mod2.4 depends on mod1.1 with transitive set to false
+        // mod1.1 depends on mod1.2
+        ResolveReport report = ivy.resolve(new File(
+                "test/repositories/1/org2/mod2.7/ivys/ivy-0.6.xml").toURL(),
+            getResolveOptions(new String[] {"*"}));
+        assertFalse(report.hasError());
+
+        // dependencies
+        assertTrue(getIvyFileInCache(
+            ModuleRevisionId.newInstance("org1", "mod1.1", "1.0")).exists());
+        assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
+
+        assertTrue(getIvyFileInCache(
+            ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+        assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
+    }
+
     public void testResolverDirectlyUsingCache() throws Exception {
         Ivy ivy = new Ivy();
         ivy.configure(ResolveTest.class.getResource("badcacheconf.xml"));

Added: ant/ivy/core/trunk/test/repositories/1/org2/mod2.7/ivys/ivy-0.6.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/1/org2/mod2.7/ivys/ivy-0.6.xml?rev=671528&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/1/org2/mod2.7/ivys/ivy-0.6.xml (added)
+++ ant/ivy/core/trunk/test/repositories/1/org2/mod2.7/ivys/ivy-0.6.xml Wed Jun 25 05:25:25 2008
@@ -0,0 +1,29 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivy-module version="1.0">
+	<info organisation="org2"
+	       module="mod2.7"
+	       revision="0.6"
+	       status="integration"
+	/>
+	<dependencies>
+		<dependency name="mod2.4" rev="0.3"/>
+		<dependency org="org1" name="mod1.1" rev="1.0" />
+	</dependencies>
+</ivy-module>

Propchange: ant/ivy/core/trunk/test/repositories/1/org2/mod2.7/ivys/ivy-0.6.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/core/trunk/test/repositories/1/org2/mod2.7/ivys/ivy-0.6.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain