ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r1375585 - in /ant/ivy/core/trunk: src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java test/java/org/apache/ivy/core/retrieve/RetrieveTest.java
Date Tue, 21 Aug 2012 14:49:47 GMT
Author: hibou
Date: Tue Aug 21 14:49:46 2012
New Revision: 1375585

URL: http://svn.apache.org/viewvc?rev=1375585&view=rev
Log:
Fix sync retrieve of uncompressed artifacts

Modified:
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java?rev=1375585&r1=1375584&r2=1375585&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java Tue Aug 21
14:49:46 2012
@@ -185,8 +185,12 @@ public class RetrieveEngine {
                         targetIvysStructure
                                 .addAll(FileUtil.getPathFiles(ivyRetrieveRoot, destFile));
                     } else {
-                        targetArtifactsStructure.addAll(FileUtil.getPathFiles(fileRetrieveRoot,
-                            destFile));
+                        Iterator destFiles = FileUtil.listAll(destFile, Collections.EMPTY_LIST)
+                                .iterator();
+                        while (destFiles.hasNext()) {
+                            targetArtifactsStructure.addAll(FileUtil.getPathFiles(fileRetrieveRoot,
+                                (File) destFiles.next()));
+                        }
                     }
                 }
             }

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java?rev=1375585&r1=1375584&r2=1375585&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java Tue Aug 21
14:49:46 2012
@@ -334,6 +334,35 @@ public class RetrieveTest extends TestCa
         assertEquals(new File(dest, "META-INF/MANIFEST.MF"), jarContents[0].listFiles()[0]);
     }
 
+    public void testUncompressSync() throws Exception {
+        ResolveOptions roptions = getResolveOptions(new String[] {"*"});
+        roptions.setExpandCompressed(true);
+
+        URL url = new File("test/repositories/1/compression/module1/ivys/ivy-1.0.xml").toURI()
+                .toURL();
+
+        // normal resolve, the file goes in the cache
+        ResolveReport report = ivy.resolve(url, roptions);
+        assertFalse(report.hasError());
+        ModuleDescriptor md = report.getModuleDescriptor();
+        assertNotNull(md);
+
+        String pattern = "build/test/retrieve/[organization]/[module]/[conf]/[type]s/[artifact]-[revision](.[ext])";
+
+        RetrieveOptions options = getRetrieveOptions();
+        options.setUncompressed(true);
+        options.setSync(true);
+        ivy.retrieve(md.getModuleRevisionId(), pattern, options);
+
+        File dest = new File("build/test/retrieve/compression/module2/default/jars/module2-1.0");
+        assertTrue(dest.exists());
+        assertTrue(dest.isDirectory());
+        File[] jarContents = dest.listFiles();
+        assertEquals(new File(dest, "META-INF"), jarContents[0]);
+        assertEquals(new File(dest, "test.txt"), jarContents[1]);
+        assertEquals(new File(dest, "META-INF/MANIFEST.MF"), jarContents[0].listFiles()[0]);
+    }
+
     private RetrieveOptions getRetrieveOptions() {
         return new RetrieveOptions();
     }



Mime
View raw message