Author: xavier
Date: Fri Apr 4 08:41:36 2008
New Revision: 644736
URL: http://svn.apache.org/viewvc?rev=644736&view=rev
Log:
FIX: conflict manager scoping does not work as expected (IVY-465)
Added:
ant/ivy/core/trunk/test/repositories/1/IVY-465/
ant/ivy/core/trunk/test/repositories/1/IVY-465/M1/
ant/ivy/core/trunk/test/repositories/1/IVY-465/M1/ivys/
ant/ivy/core/trunk/test/repositories/1/IVY-465/M1/ivys/ivy-1.0.xml (with
props)
ant/ivy/core/trunk/test/repositories/1/IVY-465/M2/
ant/ivy/core/trunk/test/repositories/1/IVY-465/M2/ivys/
ant/ivy/core/trunk/test/repositories/1/IVY-465/M2/ivys/ivy-1.0.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=644736&r1=644735&r2=644736&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Fri Apr 4 08:41:36 2008
@@ -78,6 +78,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: conflict manager scoping does not work as expected (IVY-465)
- FIX: ivy.original.xml file using artifact pattern in cache and causing
problems (IVY-787)
- FIX: ivy:retrieve with sync="true" removes the .svn directory (IVY-763)
- FIX: Ivy silently fails XML errors in ivyrep (IVY-579)
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=644736&r1=644735&r2=644736&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
Fri Apr 4 08:41:36 2008
@@ -790,13 +790,9 @@
node.getModuleId()));
Collection conflicts = computeConflicts(node, ancestor, conf, toevict,
resolvedNodes);
- if (settings.debugConflictResolution()) {
- Message.debug("found conflicting revisions for " + node + " in " +
ancestor + ": "
- + conflicts);
- }
-
ConflictManager conflictManager =
ancestor.getNode().getConflictManager(node.getModuleId());
- Collection resolved =
conflictManager.resolveConflicts(ancestor.getNode(), conflicts);
+
+ Collection resolved = resolveConflicts(node, ancestor, conflicts,
conflictManager);
if (resolved == null) {
if (settings.debugConflictResolution()) {
@@ -893,6 +889,36 @@
}
}
+ private Collection resolveConflicts(VisitNode node, VisitNode ancestor,
Collection conflicts,
+ ConflictManager conflictManager) {
+ if (node.getParent() != ancestor
+ // we are not handling the direct parent
+
+ && conflictManager ==
settings.getConflictManager(node.getModuleId())
+ // the conflict manager is the default one
+
+ && node.getParent().getNode().getResolvedNodes(
+ node.getModuleId(),
node.getRootModuleConf()).equals(conflicts)
+ // there is no new conflict in this ancestor
+
+ ) {
+ // IVY-465 case
+ if (settings.debugConflictResolution()) {
+ Message.debug("no new conflicting revisions for " + node + "
in " + ancestor + ": "
+ + conflicts);
+ }
+
+ return conflicts;
+ } else {
+ if (settings.debugConflictResolution()) {
+ Message.debug("found conflicting revisions for " + node + " in
" + ancestor + ": "
+ + conflicts);
+ }
+
+ return conflictManager.resolveConflicts(ancestor.getNode(),
conflicts);
+ }
+ }
+
private Collection computeConflicts(VisitNode node, VisitNode ancestor,
String conf,
Collection toevict, Collection resolvedNodes) {
Collection conflicts = new LinkedHashSet();
@@ -910,15 +936,15 @@
conflicts
.addAll(dep.getResolvedNodes(node.getModuleId(),
node.getRootModuleConf()));
}
- } else if (resolvedNodes.isEmpty() && node.getParent() != ancestor) {
+ } else if (resolvedNodes.isEmpty()) {
//Conflict must only be computed per root configuration at this
step.
- Collection ancestorDepIvyNodes = node.getParent().getNode()
+ Collection parentDepIvyNodes = node.getParent().getNode()
.getDependencies(node.getRootModuleConf(),
new String[] {node.getParentConf()});
- for (Iterator it = ancestorDepIvyNodes.iterator(); it.hasNext();) {
- IvyNode ancestorDep = (IvyNode) it.next();
- if (ancestorDep.getModuleId().equals(node.getModuleId())) {
- conflicts.add(ancestorDep);
+ for (Iterator it = parentDepIvyNodes.iterator(); it.hasNext();) {
+ IvyNode parentDep = (IvyNode) it.next();
+ if (parentDep.getModuleId().equals(node.getModuleId())) {
+ conflicts.add(parentDep);
}
}
} else {
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=644736&r1=644735&r2=644736&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
Fri Apr 4 08:41:36 2008
@@ -312,6 +312,24 @@
.exists());
}
+ public void testResolveWithConflictManagerDefinedInModule() throws
Exception {
+ // test case for IVY-465
+ // #M1;1.0 -> #M2;1.0
+ // #M2;1.0 -> {org1#mod1.2;1.1 org1#mod1.2;2.0} with
+ // <conflict org="org1" module="mod1.2" rev="1.1,2.0" />
+
+ ResolveReport report = ivy.resolve(
+ new
File("test/repositories/1/IVY-465/M1/ivys/ivy-1.0.xml").toURL(),
+ getResolveOptions(new String[] {"*"}));
+ assertFalse(report.hasError());
+
+ ArtifactDownloadReport[] adrs =
+
report.getConfigurationReport("default").getDownloadedArtifactsReports();
+ assertEquals(2, adrs.length);
+ assertEquals("1.1", adrs[0].getArtifact().getId().getRevision());
+ assertEquals("2.0", adrs[1].getArtifact().getId().getRevision());
+ }
+
public void testResolveRequiresDescriptor() throws Exception {
// mod1.1 depends on mod1.2, mod1.2 has no ivy file
Ivy ivy = new Ivy();
Added: ant/ivy/core/trunk/test/repositories/1/IVY-465/M1/ivys/ivy-1.0.xml
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/1/IVY-465/M1/ivys/ivy-1.0.xml?rev=644736&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/1/IVY-465/M1/ivys/ivy-1.0.xml (added)
+++ ant/ivy/core/trunk/test/repositories/1/IVY-465/M1/ivys/ivy-1.0.xml Fri Apr
4 08:41:36 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="2.0">
+ <info organisation="IVY-465"
+ module="M1"
+ revision="1.0"
+ status="release"
+ />
+ <publications />
+ <dependencies>
+ <dependency name="M2" rev="1.0"/>
+ </dependencies>
+</ivy-module>
Propchange: ant/ivy/core/trunk/test/repositories/1/IVY-465/M1/ivys/ivy-1.0.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ant/ivy/core/trunk/test/repositories/1/IVY-465/M1/ivys/ivy-1.0.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: ant/ivy/core/trunk/test/repositories/1/IVY-465/M2/ivys/ivy-1.0.xml
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/1/IVY-465/M2/ivys/ivy-1.0.xml?rev=644736&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/1/IVY-465/M2/ivys/ivy-1.0.xml (added)
+++ ant/ivy/core/trunk/test/repositories/1/IVY-465/M2/ivys/ivy-1.0.xml Fri Apr
4 08:41:36 2008
@@ -0,0 +1,32 @@
+<!--
+ 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="2.0">
+ <info organisation="IVY-465"
+ module="M2"
+ revision="1.0"
+ status="release"
+ />
+ <publications />
+ <dependencies>
+ <dependency org="org1" name="mod1.2" rev="1.1"/>
+ <dependency org="org1" name="mod1.2" rev="2.0"/>
+
+ <conflict org="org1" module="mod1.2" rev="1.1,2.0" />
+ </dependencies>
+</ivy-module>
Propchange: ant/ivy/core/trunk/test/repositories/1/IVY-465/M2/ivys/ivy-1.0.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ant/ivy/core/trunk/test/repositories/1/IVY-465/M2/ivys/ivy-1.0.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain