From 16e0c2864905cd7709563ef7e38379eff9897455 Mon Sep 17 00:00:00 2001 From: Peter Donald Date: Wed, 12 Sep 2001 14:21:43 +0000 Subject: [PATCH] Unify the attribute of the archive to "file" rather than having three separate attributes (zipfile, jarfile and warfile). git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269684 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 3 +++ docs/manual/CoreTasks/jar.html | 10 +++++----- docs/manual/CoreTasks/war.html | 4 ++-- docs/manual/CoreTasks/zip.html | 14 +++++++------- src/main/org/apache/tools/ant/taskdefs/Jar.java | 3 ++- src/main/org/apache/tools/ant/taskdefs/War.java | 3 ++- src/main/org/apache/tools/ant/taskdefs/Zip.java | 15 ++++++++++++++- 7 files changed, 35 insertions(+), 17 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 66e14f10f..6f944c596 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -7,6 +7,9 @@ Changes that could break older environments: Other changes: -------------- +* The attributes zipfile, jarfile and warfile (from the Zip, Jar and War tasks) + have been deprecated and supersceded by a new attribute "file". + Fixed bugs: ----------- diff --git a/docs/manual/CoreTasks/jar.html b/docs/manual/CoreTasks/jar.html index 931e2024e..477d558d2 100644 --- a/docs/manual/CoreTasks/jar.html +++ b/docs/manual/CoreTasks/jar.html @@ -56,7 +56,7 @@ include an empty one for you.)

Required - jarfile + file the jar-file to create. Yes @@ -138,17 +138,17 @@ end up in the META-INF directory of the jar file. If this fileset includes a file named MANIFEST.MF, the file is ignored and you will get a warning.

Examples

-
  <jar jarfile="${dist}/lib/app.jar" basedir="${build}/classes"/>
+
  <jar file="${dist}/lib/app.jar" basedir="${build}/classes"/>

jars all files in the ${build}/classes directory into a file called app.jar in the ${dist}/lib directory.

-
  <jar jarfile="${dist}/lib/app.jar"
+
  <jar file="${dist}/lib/app.jar"
        basedir="${build}/classes"
        excludes="**/Test.class"
   />

jars all files in the ${build}/classes directory into a file called app.jar in the ${dist}/lib directory. Files with the name Test.class are excluded.

-
  <jar jarfile="${dist}/lib/app.jar"
+
  <jar file="${dist}/lib/app.jar"
        basedir="${build}/classes"
        includes="mypackage/test/**"
        excludes="**/Test.class"
@@ -157,7 +157,7 @@ with the name Test.class are excluded.

called app.jar in the ${dist}/lib directory. Only files under the directory mypackage/test are used, and files with the name Test.class are excluded.

-
  <jar jarfile="${dist}/lib/app.jar">
+
  <jar file="${dist}/lib/app.jar">
     <fileset dir="${build}/classes"
              excludes="**/Test.class"
     />
diff --git a/docs/manual/CoreTasks/war.html b/docs/manual/CoreTasks/war.html
index cee682286..bf5c87d9d 100644
--- a/docs/manual/CoreTasks/war.html
+++ b/docs/manual/CoreTasks/war.html
@@ -26,7 +26,7 @@ attributes of zipfilesets in a Zip or Jar task.)

Required - warfile + file the war-file to create. Yes @@ -140,7 +140,7 @@ src/graphics/images/gifs/large/logo.gif
then the war file myapp.war created with
-<war warfile="myapp.war" webxml="src/metadata/myapp.xml">
+<war file="myapp.war" webxml="src/metadata/myapp.xml">
   <fileset dir="src/html/myapp"/>
   <fileset dir="src/jsp/myapp"/>
   <lib dir="thirdparty/libs">
diff --git a/docs/manual/CoreTasks/zip.html b/docs/manual/CoreTasks/zip.html
index f9f7092c4..e070e3147 100644
--- a/docs/manual/CoreTasks/zip.html
+++ b/docs/manual/CoreTasks/zip.html
@@ -57,7 +57,7 @@ Java.

Required - zipfile + file the zip-file to create. Yes @@ -142,12 +142,12 @@ contents will be extracted and included in the archive. As with directories, in for inclusion in the archive.

Examples

-
  <zip zipfile="${dist}/manual.zip"
+
  <zip file="${dist}/manual.zip"
        basedir="htdocs/manual"
   />

zips all files in the htdocs/manual directory into a file called manual.zip in the ${dist} directory.

-
  <zip zipfile="${dist}/manual.zip"
+
  <zip file="${dist}/manual.zip"
        basedir="htdocs/manual"
        update="true"
   />
@@ -155,27 +155,27 @@ in the ${dist} directory.

in the ${dist} directory. If manual.zip doesn't exist, it is created; otherwise it is updated with the new/changed files.

-
  <zip zipfile="${dist}/manual.zip"
+
  <zip file="${dist}/manual.zip"
        basedir="htdocs/manual"
        excludes="mydocs/**, **/todo.html"
   />

zips all files in the htdocs/manual directory. Files in the directory mydocs, or files with the name todo.html are excluded.

-
  <zip zipfile="${dist}/manual.zip"
+
  <zip file="${dist}/manual.zip"
        basedir="htdocs/manual"
        includes="api/**/*.html"
        excludes="**/todo.html"
   />

zips all files in the htdocs/manual directory. Only html files under the directory api are zipped, and files with the name todo.html are excluded.

-
  <zip zipfile="${dist}/manual.zip">
+
  <zip file="${dist}/manual.zip">
     <fileset dir="htdocs/manual"/>
     <fileset dir="." includes="ChangeLog.txt"/>
   </zip>

zips all files in the htdocs/manual directory, and also adds the file ChangeLog.txt in the current directory. ChangeLog.txt will be added to the top of the ZIP file, just as if it had been located at htdocs/manual/ChangeLog.txt.

-
  <zip zipfile="${dist}/manual.zip">
+
  <zip file="${dist}/manual.zip">
     <zipfileset dir="htdocs/manual" prefix="docs/user-guide"/>
     <zipfileset dir="." includes="ChangeLog27.txt" fullpath="docs/ChangeLog.txt"/>
     <zipfileset src="examples.zip" includes="**/*.html" prefix="docs/examples"/>
diff --git a/src/main/org/apache/tools/ant/taskdefs/Jar.java b/src/main/org/apache/tools/ant/taskdefs/Jar.java
index 2a8e48ff3..0a7a050cb 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Jar.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Jar.java
@@ -83,7 +83,8 @@ public class Jar extends Zip {
     }
 
     public void setJarfile(File jarFile) {
-        super.setZipfile(jarFile);
+        log("DEPRECATED - The jarfile attribute is deprecated. Use file attribute instead.");
+        super.setFile(jarFile);
     }
 
     public void addConfiguredManifest(Manifest newManifest) throws ManifestException {
diff --git a/src/main/org/apache/tools/ant/taskdefs/War.java b/src/main/org/apache/tools/ant/taskdefs/War.java
index 7e12d545e..ff2ceed43 100644
--- a/src/main/org/apache/tools/ant/taskdefs/War.java
+++ b/src/main/org/apache/tools/ant/taskdefs/War.java
@@ -78,7 +78,8 @@ public class War extends Jar {
     }
 
     public void setWarfile(File warFile) {
-        super.setZipfile(warFile);
+        log("DEPRECATED - The warfile attribute is deprecated. Use file attribute instead.");
+        super.setFile(warFile);
     }
     
     public void setWebxml(File descr) {
diff --git a/src/main/org/apache/tools/ant/taskdefs/Zip.java b/src/main/org/apache/tools/ant/taskdefs/Zip.java
index 7691db47a..4b840c461 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Zip.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Zip.java
@@ -102,9 +102,22 @@ public class Zip extends MatchingTask {
     /**
      * This is the name/location of where to 
      * create the .zip file.
+     *
+     * @deprecated Use setFile() instead
      */
     public void setZipfile(File zipFile) {
-        this.zipFile = zipFile;
+        log("DEPRECATED - The zipfile attribute is deprecated. Use file attribute instead.");
+        setFile( zipFile );
+    }
+    
+    /**
+     * This is the name/location of where to 
+     * create the .zip file.
+     *
+     * @deprecated Use setFile() instead
+     */
+    public void setFile(File file) {
+        this.zipFile = file;
     }
     
     /**