DO NOT REPLY [Bug 21380] - [PATCH] Fop Ant task renders only when source is newer than target

2003-10-17 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21380.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21380

[PATCH] Fop Ant task renders only when source is newer than target

[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED



--- Additional Comments From [EMAIL PROTECTED]  2003-10-17 22:26 ---
Added to both maintenance and development branches.  Thanks for the submission!


DO NOT REPLY [Bug 21380] New: - [PATCH] Fop Ant task renders only when source is newer than target

2003-07-07 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21380.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21380

[PATCH] Fop Ant task renders only when source is newer than target

   Summary: [PATCH] Fop Ant task renders only when source is newer
than target
   Product: Fop
   Version: 0.20.5
  Platform: All
OS/Version: All
Status: NEW
  Severity: Enhancement
  Priority: Other
 Component: general
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]


The FOP Ant task currently always renders the output.  The attached patch will
render only when the source file (.fo) is newer then the target (.pdf, etc.). 
There is also a force flag that can be used to always render.

cvs diff -u src/documentation/content/xdocs/anttask.xml
src/org/apache/fop/tools/anttasks/Fop.java 
Index: src/documentation/content/xdocs/anttask.xml
===
RCS file: /home/cvspublic/xml-fop/src/documentation/content/xdocs/anttask.xml,v
retrieving revision 1.3.2.1
diff -u -u -r1.3.2.1 anttask.xml
--- src/documentation/content/xdocs/anttask.xml 19 May 2003 11:20:27 - 
1.3.2.1
+++ src/documentation/content/xdocs/anttask.xml 7 Jul 2003 20:38:12 -
@@ -90,7 +90,12 @@
(codetrue/code) or not (codefalse/code)/td 
tdNo, default is codetrue/code/td 
   /tr 
- /table
+  tr 
+   tdforce/td 
+   tdRecreate target files, even if they are newer than their
corresponding source files./td 
+   tdNo, default is codetrue/code/td 
+  /tr 
+/table
 p/
 tablecaptionParameters specified as nested elements/caption
   tr 
@@ -104,7 +109,7 @@
are used to specify multiple XSL-FO files to be
rendered./td 
tdYes, if no fofile attribute is supplied/td 
   /tr 
- /table
+/table
 /section
 section
 titleExamples/title
Index: src/org/apache/fop/tools/anttasks/Fop.java
===
RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/tools/anttasks/Attic/Fop.java,v
retrieving revision 1.14.2.8
diff -u -u -r1.14.2.8 Fop.java
--- src/org/apache/fop/tools/anttasks/Fop.java  25 Feb 2003 15:19:58 - 
1.14.2.8
+++ src/org/apache/fop/tools/anttasks/Fop.java  7 Jul 2003 20:38:12 -
@@ -92,6 +92,7 @@
  * liuserconfig - file with user configuration (same as the -c command
line option)/li
  * limessagelevel - (error | warn | info | verbose | debug) level to output
non-error messages/li
  * lilogFiles - Controls whether the names of the files that are processed
are logged or not/li
+ * liforce - Recreate target files, even if they are newer than their
corresponding source files/li
  * /ul
  */
 public class Fop extends Task {
@@ -105,6 +106,7 @@
 File userConfig;
 int messageType = Project.MSG_VERBOSE;
 boolean logFiles = true;
+boolean force = true; // Ignore modification dates if true
 
 /**
  * Sets the input file
@@ -238,6 +240,20 @@
 }
 
 /**
+ * Sets force (ignore mod dates) flag 
+ */
+public void setForce(boolean aBoolean) {
+this.force = aBoolean;
+}
+
+/**
+ * Gets force (ignore mod dates) flag
+ */
+public boolean getForce() {
+return this.force;
+}
+
+/**
  * Starts execution of this task
  */
 public void execute() throws BuildException {
@@ -369,8 +385,13 @@
 if (task.getOutdir() != null) {
 outf = new File(task.getOutdir(), outf.getName());
 }
-render(task.getFofile(), outf, rint);
-actioncount++;
+// Only render if force flag is set OR output file doesn't
exist OR
+// output file is older than input file
+if ( task.force || !outf.exists() ||
+(task.getFofile().lastModified()  outf.lastModified() ) ) {
+render(task.getFofile(), outf, rint);
+actioncount++;
+}
 }
 }
 
@@ -413,15 +434,17 @@
 task.log(Error setting base directory:  + e,
Project.MSG_ERR);
 }
 
-render(f, outf, rint);
-actioncount++;
+// Only render if force flag is set OR output file doesn't
exist OR
+// output file is older than input file
+if ( task.force || !outf.exists() || (f.lastModified() 
outf.lastModified() ) ) {
+render(f, outf, rint);
+actioncount++;
+}
 }
 }
 
 if (actioncount

Re: [Patch] Fop Ant task

2001-10-08 Thread Keiron Liddle

This ahs been committed thanks.

On Sun, 07 Oct 2001 20:16:50 Leo Sutic wrote:
 All,
 the FOP Ant task (org.apache.fop.tools.anttasks.Fop) does not support the
 -c
 command line option which enables one to embed fonts into the resulting
 PDF.
 
 This patch adds an attribute userconfig to the Fop task:
 
   fop fofile=in.fo
outfile=out.pdf
userconfig=fop-config.xml/
 
 /LS
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]