ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xav...@apache.org
Subject svn commit: r632399 - in /ant/ivy/core/trunk: ./ src/java/org/apache/ivy/core/cache/ test/java/org/apache/ivy/ test/java/org/apache/ivy/core/resolve/ test/repositories/branches/bar/bar1/trunk/1/ test/repositories/branches/bar/bar1/trunk/2/ test/reposit...
Date Fri, 29 Feb 2008 17:32:32 GMT
Author: xavier
Date: Fri Feb 29 09:32:23 2008
New Revision: 632399

URL: http://svn.apache.org/viewvc?rev=632399&view=rev
Log:
FIX: ivy-resolve fails when a project has different dependencies in different branches (IVY-717)

Added:
    ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/4/
    ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/4/bar1.jar   (with props)
    ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/4/ivy.xml   (with props)
    ant/ivy/core/trunk/test/repositories/branches/foo/foo1/branch1/5/
    ant/ivy/core/trunk/test/repositories/branches/foo/foo1/branch1/5/foo1.jar
    ant/ivy/core/trunk/test/repositories/branches/foo/foo1/branch1/5/ivy.xml   (with props)
    ant/ivy/core/trunk/test/repositories/branches/foo/foo1/trunk/5/
    ant/ivy/core/trunk/test/repositories/branches/foo/foo1/trunk/5/foo1.jar   (with props)
    ant/ivy/core/trunk/test/repositories/branches/foo/foo1/trunk/5/ivy.xml   (with props)
    ant/ivy/core/trunk/test/repositories/branches/foo/foo2/
    ant/ivy/core/trunk/test/repositories/branches/foo/foo2/branch1/
    ant/ivy/core/trunk/test/repositories/branches/foo/foo2/branch1/1/
    ant/ivy/core/trunk/test/repositories/branches/foo/foo2/branch1/1/foo2.jar   (with props)
    ant/ivy/core/trunk/test/repositories/branches/foo/foo2/branch1/1/ivy.xml   (with props)
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/TestHelper.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
    ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/1/ivy.xml
    ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/2/ivy.xml
    ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/3/ivy.xml

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=632399&r1=632398&r2=632399&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Fri Feb 29 09:32:23 2008
@@ -66,6 +66,7 @@
 =====================================
 - IMPROVEMENT: Make Ivy standalone runnable with no required dependencies (IVY-757)
 
+- FIX: ivy-resolve fails when a project has different dependencies in different branches
(IVY-717)
 - FIX: PublishEventsTest fails when Ivy sources are located in a directory with a + (IVY-755)
 - FIX: XML entity parsing does not work properly (IVY-737) (thanks to Patrick Woodworth)
 - FIX: Cachefileset task silently fails with parent dir ".." construct (IVY-638)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java?rev=632399&r1=632398&r2=632399&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
Fri Feb 29 09:32:23 2008
@@ -60,13 +60,13 @@
 
 public class DefaultRepositoryCacheManager implements RepositoryCacheManager, IvySettingsAware
{
     private static final String DEFAULT_ARTIFACT_PATTERN =
-        "[organisation]/[module]/[type]s/[artifact]-[revision](.[ext])";
+        "[organisation]/[module](/[branch])/[type]s/[artifact]-[revision](.[ext])";
 
     private static final String DEFAULT_DATA_FILE_PATTERN = 
-        "[organisation]/[module]/ivydata-[revision].properties";
+        "[organisation]/[module](/[branch])/ivydata-[revision].properties";
 
     private static final String DEFAULT_IVY_PATTERN = 
-        "[organisation]/[module]/ivy-[revision].xml";
+        "[organisation]/[module](/[branch])/ivy-[revision].xml";
     
     private IvySettings settings;
     

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/TestHelper.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/TestHelper.java?rev=632399&r1=632398&r2=632399&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/TestHelper.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/TestHelper.java Fri Feb 29 09:32:23 2008
@@ -57,6 +57,14 @@
     }
     
 
+    public static File getArchiveFileInCache(Ivy ivy, String mrid, 
+            String artifactName, String type, String ext) {
+        DefaultArtifact artifact = new DefaultArtifact(ModuleRevisionId.parse(mrid), 
+            new Date(), artifactName, type, ext);
+        return getRepositoryCacheManager(ivy, artifact.getModuleRevisionId())
+            .getArchiveFileInCache(artifact);
+    }
+
     public static File getArchiveFileInCache(Ivy ivy, String organisation, String module,

             String revision, String artifactName, String type, String ext) {
         DefaultArtifact artifact = newArtifact(organisation, module, revision,

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=632399&r1=632398&r2=632399&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 Feb 29 09:32:23
2008
@@ -3706,7 +3706,7 @@
             new String[] {"*"}).setValidate(false));
         assertFalse(report.hasError());
 
-        assertTrue(getArchiveFileInCache(ivy, "foo", "foo1", "3", "foo1", "jar", "jar").exists());
+        assertTrue(getArchiveFileInCache(ivy, "foo#foo1#trunk;3", "foo1", "jar", "jar").exists());
     }
 
     public void testBranches2() throws Exception {
@@ -3718,7 +3718,7 @@
             new String[] {"*"}).setValidate(false));
         assertFalse(report.hasError());
 
-        assertTrue(getArchiveFileInCache(ivy, "foo", "foo1", "4", "foo1", "jar", "jar").exists());
+        assertTrue(getArchiveFileInCache(ivy, "foo#foo1#branch1;4", "foo1", "jar", "jar").exists());
     }
 
     public void testBranches3() throws Exception {
@@ -3730,7 +3730,7 @@
             new String[] {"*"}).setValidate(false));
         assertFalse(report.hasError());
 
-        assertTrue(getArchiveFileInCache(ivy, "foo", "foo1", "4", "foo1", "jar", "jar").exists());
+        assertTrue(getArchiveFileInCache(ivy, "foo#foo1#branch1;4", "foo1", "jar", "jar").exists());
     }
 
     public void testBranches4() throws Exception {
@@ -3742,8 +3742,8 @@
             new String[] {"*"}).setValidate(false));
         assertFalse(report.hasError());
 
-        assertTrue(getArchiveFileInCache(ivy, "foo", "foo1", "3", "foo1", "jar", "jar").exists());
-        assertTrue(getArchiveFileInCache(ivy, "bar", "bar2", "2", "bar2", "jar", "jar").exists());
+        assertTrue(getArchiveFileInCache(ivy, "foo#foo1#trunk;3", "foo1", "jar", "jar").exists());
+        assertTrue(getArchiveFileInCache(ivy, "bar#bar2#trunk;2", "bar2", "jar", "jar").exists());
     }
 
     public void testBranches5() throws Exception {
@@ -3755,8 +3755,36 @@
             new String[] {"*"}).setValidate(false));
         assertFalse(report.hasError());
 
-        assertTrue(getArchiveFileInCache(ivy, "foo", "foo1", "4", "foo1", "jar", "jar").exists());
-        assertTrue(getArchiveFileInCache(ivy, "bar", "bar2", "2", "bar2", "jar", "jar").exists());
+        assertTrue(getArchiveFileInCache(ivy, "foo#foo1#branch1;4", "foo1", "jar", "jar").exists());
+        assertTrue(getArchiveFileInCache(ivy, "bar#bar2#trunk;2", "bar2", "jar", "jar").exists());
+    }
+
+    public void testBranches6() throws Exception {
+        // test case for IVY-717
+        
+        // bar1;4 -> foo#foo1#${ivy.branch};5
+        // foo#foo1#branch1;5 -> foo#foo2#${ivy.branch};1
+        // foo#foo1#trunk;5 -> {}
+        
+        Ivy ivy = new Ivy();
+        ivy.configure(new File("test/repositories/branches/ivysettings.xml"));
+
+        ivy.setVariable("ivy.branch", "branch1");
+        ResolveReport report = ivy.resolve(new File(
+                "test/repositories/branches/bar/bar1/trunk/4/ivy.xml").toURL(), 
+                getResolveOptions(new String[] {"*"}).setValidate(false));
+        assertFalse(report.hasError());
+
+        assertTrue(getArchiveFileInCache(ivy, "foo#foo1#branch1;5", "foo1", "jar", "jar").exists());
+        assertTrue(getArchiveFileInCache(ivy, "foo#foo2#branch1;1", "foo2", "jar", "jar").exists());
+
+        ivy.setVariable("ivy.branch", "trunk");
+        report = ivy.resolve(new File(
+                "test/repositories/branches/bar/bar1/trunk/4/ivy.xml").toURL(), 
+                getResolveOptions(new String[] {"*"}).setValidate(false));
+        assertFalse(report.hasError());
+        assertEquals(1, report.getConfigurationReport("default").getNodesNumber());
+        assertTrue(getArchiveFileInCache(ivy, "foo#foo1#trunk;5", "foo1", "jar", "jar").exists());
     }
 
     public void testExternalArtifacts() throws Exception {
@@ -3902,6 +3930,12 @@
             String artifactName, String type, String ext) {
         return TestHelper.getArchiveFileInCache(
             ivy, organisation, module, revision, artifactName, type, ext);
+    }
+
+    private File getArchiveFileInCache(Ivy ivy, String mrid,
+            String artifactName, String type, String ext) {
+        return TestHelper.getArchiveFileInCache(
+            ivy, mrid, artifactName, type, ext);
     }
 
     private ResolveOptions getResolveOptions(String[] confs) {

Modified: ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/1/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/1/ivy.xml?rev=632399&r1=632398&r2=632399&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/1/ivy.xml (original)
+++ ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/1/ivy.xml Fri Feb 29 09:32:23
2008
@@ -19,6 +19,6 @@
 <ivy-module version="1.4">
 	<info organisation="bar" module="bar1" revision="1"/>
 	<dependencies>
-		<dependency org="foo" name="foo1" rev="latest.integration" />
+		<dependency org="foo" name="foo1" rev="[0,4]" />
 	</dependencies>
 </ivy-module>

Modified: ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/2/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/2/ivy.xml?rev=632399&r1=632398&r2=632399&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/2/ivy.xml (original)
+++ ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/2/ivy.xml Fri Feb 29 09:32:23
2008
@@ -19,6 +19,6 @@
 <ivy-module version="1.4">
 	<info organisation="bar" module="bar1" revision="2"/>
 	<dependencies>
-		<dependency org="foo" name="foo1" branch="branch1" rev="latest.integration" />
+		<dependency org="foo" name="foo1" branch="branch1" rev="[0,4]" />
 	</dependencies>
 </ivy-module>

Modified: ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/3/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/3/ivy.xml?rev=632399&r1=632398&r2=632399&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/3/ivy.xml (original)
+++ ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/3/ivy.xml Fri Feb 29 09:32:23
2008
@@ -19,7 +19,7 @@
 <ivy-module version="1.4">
 	<info organisation="bar" module="bar1" revision="3"/>
 	<dependencies>
-		<dependency org="foo" name="foo1" rev="latest.integration" />
+		<dependency org="foo" name="foo1" rev="[0,4]" />
 		<dependency org="bar" name="bar2" rev="latest.integration" />
 	</dependencies>
 </ivy-module>

Added: ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/4/bar1.jar
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/4/bar1.jar?rev=632399&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/4/bar1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/4/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/4/ivy.xml?rev=632399&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/4/ivy.xml (added)
+++ ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/4/ivy.xml Fri Feb 29 09:32:23
2008
@@ -0,0 +1,24 @@
+<!--
+   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.4">
+	<info organisation="bar" module="bar1" revision="2"/>
+	<dependencies>
+		<dependency org="foo" name="foo1" branch="${ivy.branch}" rev="5" />
+	</dependencies>
+</ivy-module>

Propchange: ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/4/ivy.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/core/trunk/test/repositories/branches/bar/bar1/trunk/4/ivy.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/core/trunk/test/repositories/branches/foo/foo1/branch1/5/foo1.jar
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/branches/foo/foo1/branch1/5/foo1.jar?rev=632399&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/branches/foo/foo1/branch1/5/foo1.jar (added)
+++ ant/ivy/core/trunk/test/repositories/branches/foo/foo1/branch1/5/foo1.jar Fri Feb 29 09:32:23
2008
@@ -0,0 +1 @@
+1
\ No newline at end of file

Added: ant/ivy/core/trunk/test/repositories/branches/foo/foo1/branch1/5/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/branches/foo/foo1/branch1/5/ivy.xml?rev=632399&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/branches/foo/foo1/branch1/5/ivy.xml (added)
+++ ant/ivy/core/trunk/test/repositories/branches/foo/foo1/branch1/5/ivy.xml Fri Feb 29 09:32:23
2008
@@ -0,0 +1,24 @@
+<!--
+   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.4">
+	<info organisation="foo" module="foo1" branch="branch1" revision="5"/>
+	<dependencies>
+		<dependency org="foo" name="foo2" branch="branch1" rev="1" />
+	</dependencies>
+</ivy-module>

Propchange: ant/ivy/core/trunk/test/repositories/branches/foo/foo1/branch1/5/ivy.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/ivy/core/trunk/test/repositories/branches/foo/foo1/trunk/5/foo1.jar
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/branches/foo/foo1/trunk/5/foo1.jar?rev=632399&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ant/ivy/core/trunk/test/repositories/branches/foo/foo1/trunk/5/foo1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: ant/ivy/core/trunk/test/repositories/branches/foo/foo1/trunk/5/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/branches/foo/foo1/trunk/5/ivy.xml?rev=632399&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/branches/foo/foo1/trunk/5/ivy.xml (added)
+++ ant/ivy/core/trunk/test/repositories/branches/foo/foo1/trunk/5/ivy.xml Fri Feb 29 09:32:23
2008
@@ -0,0 +1,21 @@
+<!--
+   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.4">
+	<info organisation="foo" module="foo1" branch="trunk" revision="5"/>
+</ivy-module>

Propchange: ant/ivy/core/trunk/test/repositories/branches/foo/foo1/trunk/5/ivy.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/core/trunk/test/repositories/branches/foo/foo1/trunk/5/ivy.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/core/trunk/test/repositories/branches/foo/foo2/branch1/1/foo2.jar
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/branches/foo/foo2/branch1/1/foo2.jar?rev=632399&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ant/ivy/core/trunk/test/repositories/branches/foo/foo2/branch1/1/foo2.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: ant/ivy/core/trunk/test/repositories/branches/foo/foo2/branch1/1/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/branches/foo/foo2/branch1/1/ivy.xml?rev=632399&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/branches/foo/foo2/branch1/1/ivy.xml (added)
+++ ant/ivy/core/trunk/test/repositories/branches/foo/foo2/branch1/1/ivy.xml Fri Feb 29 09:32:23
2008
@@ -0,0 +1,21 @@
+<!--
+   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.4">
+	<info organisation="foo" module="foo2" branch="branch1" revision="1"/>
+</ivy-module>

Propchange: ant/ivy/core/trunk/test/repositories/branches/foo/foo2/branch1/1/ivy.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/core/trunk/test/repositories/branches/foo/foo2/branch1/1/ivy.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message