git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@326636 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -56,6 +56,31 @@ does not exist.</p> | |||||
| <p>expands <i>test.tar.gz</i> to <i>subdir/test.tar</i> (assuming | <p>expands <i>test.tar.gz</i> to <i>subdir/test.tar</i> (assuming | ||||
| subdir is a directory).</p> | subdir is a directory).</p> | ||||
| <h3>Related tasks</h3> | |||||
| <pre> | |||||
| <gunzip src="some-archive.gz" dest="some-dest-dir"/> | |||||
| </pre> | |||||
| is identical to | |||||
| <pre> | |||||
| <copy todir="some-dest-dir"> | |||||
| <gzipresource> | |||||
| <file file="some-archive.gz"/> | |||||
| </gzipresource> | |||||
| <mapper type="glob" from="*.gz" to="*"/> | |||||
| </copy> | |||||
| </pre> | |||||
| <p>The same is also true for <code><bunzip2></code> and | |||||
| <code><bzip2resource></code>. <code><copy></code> offers | |||||
| additional features like <a | |||||
| href="../CoreTypes/filterchains.html">filtering files</a> on the fly, | |||||
| allowing a file to be mapped to multiple destinations, preserving the | |||||
| last modified time or a configurable file system timestamp | |||||
| granularity.</p> | |||||
| <hr> | <hr> | ||||
| <p align="center">Copyright © 2000-2001,2004-2005 The Apache Software Foundation. All rights | <p align="center">Copyright © 2000-2001,2004-2005 The Apache Software Foundation. All rights | ||||
| Reserved.</p> | Reserved.</p> | ||||
| @@ -117,6 +117,38 @@ nested element.</p> | |||||
| <mapper type="flatten"/> | <mapper type="flatten"/> | ||||
| </unzip> | </unzip> | ||||
| </pre> | </pre> | ||||
| <h3>Related tasks</h3> | |||||
| <pre> | |||||
| <unzip src="some-archive" dest="some-dir"< | |||||
| <patternset> | |||||
| <include name="some-pattern"/> | |||||
| </patternset> | |||||
| <mapper type="some-mapper"/> | |||||
| </unzip> | |||||
| </pre> | |||||
| is identical to | |||||
| <pre> | |||||
| <copy todir="some-dir" preservelastmodified="true"< | |||||
| <zipfileset src="some-archive"> | |||||
| <patternset> | |||||
| <include name="some-pattern"/> | |||||
| </patternset> | |||||
| </zipfileset> | |||||
| <mapper type="some-mapper"/> | |||||
| </copy> | |||||
| </pre> | |||||
| <p>The same is also true for <code><untar></code> and | |||||
| <code><tarfileset></code>. <code><copy></code> offers | |||||
| additional features like <a | |||||
| href="../CoreTypes/filterchains.html">filtering files</a> on the fly, | |||||
| allowing a file to be mapped to multiple destinations or a | |||||
| configurable file system timestamp granularity.</p> | |||||
| <hr> | <hr> | ||||
| <p align="center">Copyright © 2000-2005 The Apache Software Foundation. All rights | <p align="center">Copyright © 2000-2005 The Apache Software Foundation. All rights | ||||
| Reserved.</p> | Reserved.</p> | ||||
| @@ -14,4 +14,13 @@ | |||||
| <target name="prepare"> | <target name="prepare"> | ||||
| <gunzip src="expected/asf-logo-huge.tar.gz"/> | <gunzip src="expected/asf-logo-huge.tar.gz"/> | ||||
| </target> | </target> | ||||
| <target name="testDocumentationClaimsOnCopy"> | |||||
| <copy todir="."> | |||||
| <bzip2resource> | |||||
| <file file="expected/asf-logo-huge.tar.bz2"/> | |||||
| </bzip2resource> | |||||
| <mapper type="glob" from="*.bz2" to="*"/> | |||||
| </copy> | |||||
| </target> | |||||
| </project> | </project> | ||||
| @@ -24,4 +24,13 @@ | |||||
| <gunzip src="expected/asf-logo.gif.gz" dest="asf-logo.gif" /> | <gunzip src="expected/asf-logo.gif.gz" dest="asf-logo.gif" /> | ||||
| </target> | </target> | ||||
| <target name="testDocumentationClaimsOnCopy"> | |||||
| <copy todir="."> | |||||
| <gzipresource> | |||||
| <file file="expected/asf-logo.gif.gz"/> | |||||
| </gzipresource> | |||||
| <mapper type="glob" from="*.gz" to="*"/> | |||||
| </copy> | |||||
| </target> | |||||
| </project> | </project> | ||||
| @@ -4,6 +4,8 @@ | |||||
| <target name="cleanup"> | <target name="cleanup"> | ||||
| <delete file="asf-logo.gif" /> | <delete file="asf-logo.gif" /> | ||||
| <delete file="untartest.tar" /> | |||||
| <delete dir="untartestin"/> | |||||
| <delete dir="untartestout"/> | <delete dir="untartestout"/> | ||||
| </target> | </target> | ||||
| @@ -59,4 +61,26 @@ | |||||
| </zipfileset> | </zipfileset> | ||||
| </untar> | </untar> | ||||
| </target> | </target> | ||||
| <target name="prepareTestTar"> | |||||
| <mkdir dir="untartestin/1"/> | |||||
| <mkdir dir="untartestin/2"/> | |||||
| <touch file="untartestin/1/foo"/> | |||||
| <touch file="untartestin/2/bar"/> | |||||
| <copy todir="untartestin/2"> | |||||
| <fileset dir="expected" includes="*md5*"/> | |||||
| </copy> | |||||
| <tar destfile="untartest.tar" basedir="untartestin"/> | |||||
| </target> | |||||
| <target name="testDocumentationClaimsOnCopy" depends="prepareTestTar"> | |||||
| <copy todir="untartestout" preservelastmodified="true"> | |||||
| <tarfileset src="untartest.tar"> | |||||
| <patternset> | |||||
| <include name="2/"/> | |||||
| </patternset> | |||||
| </tarfileset> | |||||
| </copy> | |||||
| </target> | |||||
| </project> | </project> | ||||
| @@ -48,4 +48,11 @@ public class BUnzip2Test extends BuildFileTest { | |||||
| FILE_UTILS.contentEquals(project.resolveFile("expected/asf-logo-huge.tar"), | FILE_UTILS.contentEquals(project.resolveFile("expected/asf-logo-huge.tar"), | ||||
| project.resolveFile("asf-logo-huge.tar"))); | project.resolveFile("asf-logo-huge.tar"))); | ||||
| } | } | ||||
| public void testDocumentationClaimsOnCopy() throws java.io.IOException { | |||||
| executeTarget("testDocumentationClaimsOnCopy"); | |||||
| assertTrue("File content mismatch after bunzip2", | |||||
| FILE_UTILS.contentEquals(project.resolveFile("expected/asf-logo-huge.tar"), | |||||
| project.resolveFile("asf-logo-huge.tar"))); | |||||
| } | |||||
| } | } | ||||
| @@ -58,4 +58,9 @@ public class GUnzipTest extends BuildFileTest { | |||||
| project.resolveFile("asf-logo.gif"))); | project.resolveFile("asf-logo.gif"))); | ||||
| } | } | ||||
| public void testDocumentationClaimsOnCopy() throws java.io.IOException { | |||||
| executeTarget("testDocumentationClaimsOnCopy"); | |||||
| assertTrue(FILE_UTILS.contentEquals(project.resolveFile("../asf-logo.gif"), | |||||
| project.resolveFile("asf-logo.gif"))); | |||||
| } | |||||
| } | } | ||||
| @@ -82,4 +82,10 @@ public class UntarTest extends BuildFileTest { | |||||
| assertTrue(FILE_UTILS.contentEquals(project.resolveFile("../asf-logo.gif"), | assertTrue(FILE_UTILS.contentEquals(project.resolveFile("../asf-logo.gif"), | ||||
| project.resolveFile("asf-logo.gif"))); | project.resolveFile("asf-logo.gif"))); | ||||
| } | } | ||||
| public void testDocumentationClaimsOnCopy() { | |||||
| executeTarget("testDocumentationClaimsOnCopy"); | |||||
| assertFalse(getProject().resolveFile("untartestout/1/foo").exists()); | |||||
| assertTrue(getProject().resolveFile("untartestout/2/bar").exists()); | |||||
| } | |||||
| } | } | ||||