ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maart...@apache.org
Subject [1/2] ant-ivy git commit: FIX: Local conflict manager didn't handle deeper conflicts in transitive dependencies (IVY-1404)
Date Wed, 12 Jul 2017 08:06:01 GMT
Repository: ant-ivy
Updated Branches:
  refs/heads/master dcaacf4ca -> 1a36ae09d


FIX: Local conflict manager didn't handle deeper conflicts in transitive dependencies (IVY-1404)


Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/585a7021
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/585a7021
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/585a7021

Branch: refs/heads/master
Commit: 585a702138f1cc87df3b41509cc42ad34b6acd62
Parents: d0f7f36
Author: Maarten Coene <maartenc@apache.org>
Authored: Wed Jul 12 10:05:15 2017 +0200
Committer: Maarten Coene <maartenc@apache.org>
Committed: Wed Jul 12 10:05:15 2017 +0200

----------------------------------------------------------------------
 asciidoc/release-notes.adoc                     |  1 +
 .../apache/ivy/core/resolve/ResolveEngine.java  | 19 ++++++++++++-
 .../apache/ivy/core/resolve/ResolveTest.java    | 21 ++++++++++++++
 .../repositories/1/IVY-1404/M1/ivys/ivy-1.0.xml | 30 ++++++++++++++++++++
 .../repositories/1/IVY-1404/M2/ivys/ivy-1.0.xml | 30 ++++++++++++++++++++
 .../repositories/1/IVY-1404/M3/ivys/ivy-1.0.xml | 29 +++++++++++++++++++
 .../repositories/1/IVY-1404/M4/ivys/ivy-1.0.xml | 29 +++++++++++++++++++
 7 files changed, 158 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/585a7021/asciidoc/release-notes.adoc
----------------------------------------------------------------------
diff --git a/asciidoc/release-notes.adoc b/asciidoc/release-notes.adoc
index a3a52ab..c2b7962 100644
--- a/asciidoc/release-notes.adoc
+++ b/asciidoc/release-notes.adoc
@@ -50,6 +50,7 @@ http://issues.apache.org/jira/browse/ivy
 
 List of changes since Ivy 2.4.0:
 
+- FIX: Local conflict manager didn't handle deeper conflicts in transitive dependencies (link:https://issues.apache.org/jira/browse/IVY-1404[IVY-1404])
 - FIX: Made the maven 'test' configuration public so we can use the test-jar as dependency
(link:https://issues.apache.org/jira/browse/IVY-1444[IVY-1444])
 - FIX: NullPointerException in dependencytree with no dependencies (link:https://issues.apache.org/jira/browse/IVY-1539[IVY-1539])
 - FIX: checkIfChanged is not settable attribute for checkdepsupdate ant task (link:https://issues.apache.org/jira/browse/IVY-1549[IVY-1549])

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/585a7021/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/resolve/ResolveEngine.java b/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
index 8356f16..4258424 100644
--- a/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
+++ b/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
@@ -923,7 +923,24 @@ public class ResolveEngine {
         Collection<IvyNode> conflicts = computeConflicts(node, ancestor, conf, toevict,
             resolvedNodes);
 
-        ConflictManager conflictManager = ancestor.getNode().getConflictManager(node.getModuleId());
+        ConflictManager conflictManager = null;
+        for (VisitNode current : ancestor.getPath()) {
+            ModuleDescriptor descriptor = current.getNode().getDescriptor();
+            if (descriptor == null) {
+                throw new IllegalStateException(
+                        "impossible to get conflict manager when data has not been loaded.
IvyNode = "
+                                + current.getNode());
+            }
+
+            conflictManager = descriptor.getConflictManager(node.getModuleId());
+            if (conflictManager != null) {
+                break;
+            }
+        }
+
+        if (conflictManager == null) {
+            conflictManager = settings.getConflictManager(node.getModuleId());
+        }
 
         Collection<IvyNode> resolved = resolveConflicts(node, ancestor, conflicts,
conflictManager);
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/585a7021/test/java/org/apache/ivy/core/resolve/ResolveTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/resolve/ResolveTest.java b/test/java/org/apache/ivy/core/resolve/ResolveTest.java
index 1bddd54..43d3cf4 100644
--- a/test/java/org/apache/ivy/core/resolve/ResolveTest.java
+++ b/test/java/org/apache/ivy/core/resolve/ResolveTest.java
@@ -410,6 +410,27 @@ public class ResolveTest {
     }
 
     @Test
+    public void testResolveWithConflictManagerDefinedAtHigherLevel() throws Exception {
+        // test case for IVY-1404
+        // #M1;1.0 -> #M2;1.0
+        // #M1;2.0 -> {#M2;1.0 #M3;1.0}
+        // #M2;1.0 -> org1#mod1.2;1.1
+        // #M3;1.0 -> org1#mod1.2;2.0
+        // #M1;1.0 has conflict manager: <conflict org="org1" module="mod1.2" rev="1.1,2.0"
/>
+
+        ResolveReport report = ivy.resolve(new File(
+                        "test/repositories/1/IVY-1404/M1/ivys/ivy-1.0.xml"),
+                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());
+    }
+
+    @Test
     public void testResolveRequiresDescriptor() throws Exception {
         // mod1.1 depends on mod1.2, mod1.2 has no ivy file
         Ivy ivy = new Ivy();

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/585a7021/test/repositories/1/IVY-1404/M1/ivys/ivy-1.0.xml
----------------------------------------------------------------------
diff --git a/test/repositories/1/IVY-1404/M1/ivys/ivy-1.0.xml b/test/repositories/1/IVY-1404/M1/ivys/ivy-1.0.xml
new file mode 100644
index 0000000..b4202c6
--- /dev/null
+++ b/test/repositories/1/IVY-1404/M1/ivys/ivy-1.0.xml
@@ -0,0 +1,30 @@
+<!--
+   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-1404"
+	       module="M1"
+	       revision="1.0"
+	       status="release"
+	/>
+	<publications />
+	<dependencies>
+		<dependency name="M2" rev="1.0"/>
+		<conflict org="org1" module="mod1.2" rev="1.1,2.0" />
+	</dependencies>
+</ivy-module>

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/585a7021/test/repositories/1/IVY-1404/M2/ivys/ivy-1.0.xml
----------------------------------------------------------------------
diff --git a/test/repositories/1/IVY-1404/M2/ivys/ivy-1.0.xml b/test/repositories/1/IVY-1404/M2/ivys/ivy-1.0.xml
new file mode 100644
index 0000000..eae28e6
--- /dev/null
+++ b/test/repositories/1/IVY-1404/M2/ivys/ivy-1.0.xml
@@ -0,0 +1,30 @@
+<!--
+   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-1404"
+	       module="M2"
+	       revision="1.0"
+	       status="release"
+	/>
+	<publications />
+	<dependencies>
+		<dependency name="M3" rev="1.0"/>
+		<dependency name="M4" rev="1.0"/>
+	</dependencies>
+</ivy-module>

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/585a7021/test/repositories/1/IVY-1404/M3/ivys/ivy-1.0.xml
----------------------------------------------------------------------
diff --git a/test/repositories/1/IVY-1404/M3/ivys/ivy-1.0.xml b/test/repositories/1/IVY-1404/M3/ivys/ivy-1.0.xml
new file mode 100644
index 0000000..5c20629
--- /dev/null
+++ b/test/repositories/1/IVY-1404/M3/ivys/ivy-1.0.xml
@@ -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-1404"
+	       module="M3"
+	       revision="1.0"
+	       status="release"
+	/>
+	<publications />
+	<dependencies>
+		<dependency org="org1" name="mod1.2" rev="1.1"/>
+	</dependencies>
+</ivy-module>

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/585a7021/test/repositories/1/IVY-1404/M4/ivys/ivy-1.0.xml
----------------------------------------------------------------------
diff --git a/test/repositories/1/IVY-1404/M4/ivys/ivy-1.0.xml b/test/repositories/1/IVY-1404/M4/ivys/ivy-1.0.xml
new file mode 100644
index 0000000..aa7d7b0
--- /dev/null
+++ b/test/repositories/1/IVY-1404/M4/ivys/ivy-1.0.xml
@@ -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-1404"
+	       module="M4"
+	       revision="1.0"
+	       status="release"
+	/>
+	<publications />
+	<dependencies>
+		<dependency org="org1" name="mod1.2" rev="2.0"/>
+	</dependencies>
+</ivy-module>


Mime
View raw message