Browse Source

adding destFile naming scheme to tar, for consistency with the zip family and other tasks. I know Costin thinks we do this deliberately, just to break his builds, so even though I have updated the manual and the test cases, I have commented out the deprecated message which users should get when they use the tarfile attribute. Which means old builds still work, but the old params are no longer documented for new users.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271035 13f79535-47bb-0310-9956-ffa450edef68
master
Steve Loughran 23 years ago
parent
commit
d65cafdcec
4 changed files with 20 additions and 9 deletions
  1. +2
    -2
      build.xml
  2. +3
    -3
      docs/manual/CoreTasks/tar.html
  3. +4
    -4
      src/etc/testcases/taskdefs/tar.xml
  4. +11
    -0
      src/main/org/apache/tools/ant/taskdefs/Tar.java

+ 2
- 2
build.xml View File

@@ -604,7 +604,7 @@
basedir="${dist.name}/.." basedir="${dist.name}/.."
includes="${dist.name}/**"/> includes="${dist.name}/**"/>
<tar longfile="gnu" <tar longfile="gnu"
tarfile="${dist.base}/bin/${dist.name}-bin.tar">
destfile="${dist.base}/bin/${dist.name}-bin.tar">
<tarfileset dir="${dist.name}/.." mode="755" username="ant" group="ant"> <tarfileset dir="${dist.name}/.." mode="755" username="ant" group="ant">
<include name="${dist.name}/bin/ant"/> <include name="${dist.name}/bin/ant"/>
<include name="${dist.name}/bin/antRun"/> <include name="${dist.name}/bin/antRun"/>
@@ -634,7 +634,7 @@
basedir="${dist.name}/.." basedir="${dist.name}/.."
includes="${dist.name}/**"/> includes="${dist.name}/**"/>
<tar longfile="gnu" <tar longfile="gnu"
tarfile="${dist.base}/src/${dist.name}-src.tar" >
destfile="${dist.base}/src/${dist.name}-src.tar" >
<tarfileset dir="${dist.name}/.." mode="755" username="ant" group="ant"> <tarfileset dir="${dist.name}/.." mode="755" username="ant" group="ant">
<include name="${dist.name}/bootstrap.sh"/> <include name="${dist.name}/bootstrap.sh"/>
<include name="${dist.name}/build.sh"/> <include name="${dist.name}/build.sh"/>


+ 3
- 3
docs/manual/CoreTasks/tar.html View File

@@ -52,7 +52,7 @@ the limit.</p>
<td valign="top" align="center"><b>Required</b></td> <td valign="top" align="center"><b>Required</b></td>
</tr> </tr>
<tr> <tr>
<td valign="top">tarfile</td>
<td valign="top">destfile</td>
<td valign="top">the tar-file to create.</td> <td valign="top">the tar-file to create.</td>
<td align="center" valign="top">Yes</td> <td align="center" valign="top">Yes</td>
</tr> </tr>
@@ -138,7 +138,7 @@ attributes
<p>tars all files in the <code>htdocs/manual</code> directory into a file called <code>manual.tar</code> <p>tars all files in the <code>htdocs/manual</code> directory into a file called <code>manual.tar</code>
in the <code>${dist}</code> directory, then applies the gzip task to compress in the <code>${dist}</code> directory, then applies the gzip task to compress
it.</p> it.</p>
<pre> &lt;tar tarfile=&quot;${dist}/manual.tar&quot;
<pre> &lt;tar destfile=&quot;${dist}/manual.tar&quot;
basedir=&quot;htdocs/manual&quot; basedir=&quot;htdocs/manual&quot;
excludes=&quot;mydocs/**, **/todo.html&quot; excludes=&quot;mydocs/**, **/todo.html&quot;
/&gt;</pre> /&gt;</pre>
@@ -147,7 +147,7 @@ in the <code>${dist}</code> directory. Files in the directory <code>mydocs</code
or files with the name <code>todo.html</code> are excluded.</p> or files with the name <code>todo.html</code> are excluded.</p>


<pre>&lt;tar longfile=&quot;gnu&quot; <pre>&lt;tar longfile=&quot;gnu&quot;
tarfile=&quot;${dist.base}/${dist.name}-src.tar&quot; &gt;
destfile=&quot;${dist.base}/${dist.name}-src.tar&quot; &gt;
&lt;tarfileset dir=&quot;${dist.name}/..&quot; mode=&quot;755&quot; username=&quot;ant&quot; group=&quot;ant&quot;&gt; &lt;tarfileset dir=&quot;${dist.name}/..&quot; mode=&quot;755&quot; username=&quot;ant&quot; group=&quot;ant&quot;&gt;
&lt;include name=&quot;${dist.name}/bootstrap.sh&quot;/&gt; &lt;include name=&quot;${dist.name}/bootstrap.sh&quot;/&gt;
&lt;include name=&quot;${dist.name}/build.sh&quot;/&gt; &lt;include name=&quot;${dist.name}/build.sh&quot;/&gt;


+ 4
- 4
src/etc/testcases/taskdefs/tar.xml View File

@@ -16,19 +16,19 @@


<target name="test4"> <target name="test4">
<touch file="test4.tar"/> <touch file="test4.tar"/>
<tar tarfile="test4.tar"
<tar destfile="test4.tar"
basedir="."/> basedir="."/>
</target> </target>


<target name="test5"> <target name="test5">
<mkdir dir="test5dir"/> <mkdir dir="test5dir"/>
<tar tarfile="test5.tar"
<tar destfile="test5.tar"
basedir="." basedir="."
includes="test5dir"/> includes="test5dir"/>
</target> </target>


<target name="test6"> <target name="test6">
<tar tarfile="blah" longfile="Foo"/>
<tar destfile="blah" longfile="Foo"/>
</target> </target>


<target name="cleanup"> <target name="cleanup">
@@ -39,7 +39,7 @@
</target> </target>


<target name="feather"> <target name="feather">
<tar tarfile="asf-logo.gif.tar"
<tar destfile="asf-logo.gif.tar"
basedir=".." basedir=".."
includes="asf-logo.gif" /> includes="asf-logo.gif" />
</target> </target>


+ 11
- 0
src/main/org/apache/tools/ant/taskdefs/Tar.java View File

@@ -129,11 +129,22 @@ public class Tar extends MatchingTask {


/** /**
* This is the name/location of where to create the tar file. * This is the name/location of where to create the tar file.
* @deprecated for consistency with other tasks, please use setDestFile()
*/ */
public void setTarfile(File tarFile) { public void setTarfile(File tarFile) {
//log("DEPRECATED - The tarfile attribute is deprecated. Please use the destfile attribute instead.");
this.tarFile = tarFile; this.tarFile = tarFile;
} }


/**
* Sets the destfile attribute.
* @since 1.22 ant 1.5
* @param destFile The output of the tar
*/
public void setDestFile(File destFile) {
this.tarFile = destFile;
}

/** /**
* This is the base directory to look in for things to tar. * This is the base directory to look in for things to tar.
*/ */


Loading…
Cancel
Save