conor 02/03/20 04:23:42
Modified: src/main/org/apache/tools/ant/taskdefs Manifest.java
Log:
Don't rewrite the manifest if it hasn't changed.
PR: 7045
Submitted by: [EMAIL PROTECTED] (Jose Alberto Fernandez)
Revision Changes Path
1.26 +21 -4
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Manifest.java
Index: Manifest.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Manifest.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -w -u -r1.25 -r1.26
--- Manifest.java 20 Mar 2002 12:11:57 -0000 1.25
+++ Manifest.java 20 Mar 2002 12:23:42 -0000 1.26
@@ -78,6 +78,7 @@
*
* @author Conor MacNeill
* @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Jose Alberto Fernandez</a>
*
* @ant.task category="java"
*/
@@ -1027,17 +1028,19 @@
}
Manifest toWrite = getDefaultManifest();
+ Manifest current = null;
+ BuildException error = null;
- if (mode.getValue().equals("update") && manifestFile.exists()) {
+ if (manifestFile.exists()) {
FileReader f = null;
try {
f = new FileReader(manifestFile);
- toWrite.merge(new Manifest(f));
+ current = new Manifest(f);
} catch (ManifestException m) {
- throw new BuildException("Existing manifest " + manifestFile
+ error = new BuildException("Existing manifest " +
manifestFile
+ " is invalid", m, location);
} catch (IOException e) {
- throw new BuildException("Failed to read " + manifestFile,
+ error = new BuildException("Failed to read " + manifestFile,
e, location);
} finally {
if (f != null) {
@@ -1049,9 +1052,23 @@
}
try {
+ if (mode.getValue().equals("update") && manifestFile.exists()) {
+ if (current != null) {
+ toWrite.merge(current);
+ }
+ else if (error != null) {
+ throw error;
+ }
+ }
+
toWrite.merge(this);
} catch (ManifestException m) {
throw new BuildException("Manifest is invalid", m, location);
+ }
+
+ if (toWrite.equals(current)) {
+ log("Manifest has not changed, do not recreate",
project.MSG_VERBOSE);
+ return;
}
PrintWriter w = null;
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>