Return-Path:
Delivered-To: apmail-ant-dev-archive@www.apache.org
Received: (qmail 60882 invoked from network); 2 Oct 2005 20:05:08 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199)
by minotaur.apache.org with SMTP; 2 Oct 2005 20:05:07 -0000
Received: (qmail 2416 invoked by uid 500); 2 Oct 2005 20:05:05 -0000
Delivered-To: apmail-ant-dev-archive@ant.apache.org
Received: (qmail 2362 invoked by uid 500); 2 Oct 2005 20:05:05 -0000
Mailing-List: contact dev-help@ant.apache.org; run by ezmlm
Precedence: bulk
List-Unsubscribe:
List-Help:
List-Post:
List-Id: "Ant Developers List"
Reply-To: "Ant Developers List"
Delivered-To: mailing list dev@ant.apache.org
Received: (qmail 2351 invoked by uid 500); 2 Oct 2005 20:05:05 -0000
Received: (qmail 2348 invoked by uid 99); 2 Oct 2005 20:05:05 -0000
X-ASF-Spam-Status: No, hits=-9.8 required=10.0
tests=ALL_TRUSTED,NO_REAL_NAME
X-Spam-Check-By: apache.org
Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194)
by apache.org (qpsmtpd/0.29) with SMTP; Sun, 02 Oct 2005 13:05:04 -0700
Received: (qmail 60516 invoked by uid 65534); 2 Oct 2005 20:04:44 -0000
Message-ID: <20051002200444.60515.qmail@minotaur.apache.org>
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r293157 - in /ant/core/trunk: build.xml
docs/manual/CoreTasks/jar.html
src/main/org/apache/tools/ant/taskdefs/Jar.java
Date: Sun, 02 Oct 2005 20:04:44 -0000
To: ant-cvs@apache.org
From: jkf@apache.org
X-Mailer: svnmailer-1.0.5
X-Virus-Checked: Checked by ClamAV on apache.org
X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N
Author: jkf
Date: Sun Oct 2 13:04:39 2005
New Revision: 293157
URL: http://svn.apache.org/viewcvs?rev=293157&view=rev
Log:
Updated the Jar task to have an whenmanifestonly attribute,
creating the possibility to skip jar files that would
otherwise only contain a jar file. Also started to use this
for the optional tasks in the build.xml
Modified:
ant/core/trunk/build.xml
ant/core/trunk/docs/manual/CoreTasks/jar.html
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jar.java
Modified: ant/core/trunk/build.xml
URL: http://svn.apache.org/viewcvs/ant/core/trunk/build.xml?rev=293157&r1=293156&r2=293157&view=diff
==============================================================================
--- ant/core/trunk/build.xml (original)
+++ ant/core/trunk/build.xml Sun Oct 2 13:04:39 2005
@@ -777,7 +777,8 @@
+ basedir="${build.classes}"
+ whenmanifestonly="fail">
@@ -786,7 +787,8 @@
+ manifest="${manifest}"
+ whenmanifestonly="fail">
@@ -835,7 +837,8 @@
+ manifest="${manifest}"
+ whenmanifestonly="fail">
@@ -849,7 +852,8 @@
+ manifest="${manifest.tmp}"
+ whenmanifestonly="skip">
@@ -895,7 +899,8 @@
+ manifest="${manifest.tmp}"
+ whenmanifestonly="skip">
@@ -928,7 +933,8 @@
+ manifest="${manifest.tmp}"
+ whenmanifestonly="skip">
Modified: ant/core/trunk/docs/manual/CoreTasks/jar.html
URL: http://svn.apache.org/viewcvs/ant/core/trunk/docs/manual/CoreTasks/jar.html?rev=293157&r1=293156&r2=293157&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTasks/jar.html (original)
+++ ant/core/trunk/docs/manual/CoreTasks/jar.html Sun Oct 2 13:04:39 2005
@@ -43,6 +43,13 @@
of two seconds. If a file is less than two seconds newer than the
entry in the archive, Ant will not consider it newer.
+The whenmanifestonly
parameter controls what happens when no
+files, apart from the manifest file, match.
+If skip
, the JAR is not created and a warning is issued.
+If fail
, the JAR is not created and the build is halted with an error.
+If create
, (default) an empty JAR file (only containing a manifest)
+is created.
+
(The Jar task is a shortcut for specifying the manifest file of a JAR file.
The same thing can be accomplished by using the fullpath
attribute of a zipfileset in a Zip task. The one difference is that if the
@@ -153,6 +160,11 @@
update |
indicates whether to update or overwrite
the destination file if it already exists. Default is "false". |
+ No |
+
+
+ whenmanifestonly |
+ behavior when no files match. Valid values are "fail", "skip", and "create". Default is "create". |
No |
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jar.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jar.java?rev=293157&r1=293156&r2=293157&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jar.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jar.java Sun Oct 2 13:04:39 2005
@@ -140,6 +140,8 @@
private ZipExtraField[] JAR_MARKER = new ZipExtraField[] {
JarMarker.getInstance()
};
+
+ protected String emptyBehavior = "create";
/** constructor */
public Jar() {
@@ -161,6 +163,16 @@
}
/**
+ * Not used for jar files.
+ * @param we not used
+ * @ant.attribute ignore="true"
+ */
+ public void setWhenmanifestonly(WhenEmpty we) {
+ emptyBehavior = we.getValue();
+ }
+
+
+ /**
* Set the destination file.
* @param jarFile the destination file
* @deprecated Use setDestFile(File) instead
@@ -677,6 +689,18 @@
return true;
}
+ if (emptyBehavior.equals("skip")) {
+ log("Warning: skipping " + archiveType + " archive "
+ + zipFile + " because no files were included.",
+ Project.MSG_WARN);
+ return true;
+ } else if (emptyBehavior.equals("fail")) {
+ throw new BuildException("Cannot create " + archiveType
+ + " archive " + zipFile
+ + ": no files were included.",
+ getLocation());
+ }
+
ZipOutputStream zOut = null;
try {
log("Building MANIFEST-only jar: "
@@ -737,6 +761,7 @@
*/
public void reset() {
super.reset();
+ emptyBehavior = "create";
configuredManifest = null;
filesetManifestConfig = null;
mergeManifestsMain = false;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org