maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r391848 - in /maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer: DefaultSiteRenderer.java DocumentRenderer.java DoxiaDocumentRenderer.java
Date Wed, 05 Apr 2006 23:47:59 GMT
Author: brett
Date: Wed Apr  5 16:47:59 2006
New Revision: 391848

URL: http://svn.apache.org/viewcvs?rev=391848&view=rev
Log:
[MSITE-40] don't regenerate doc files that are unchanged
Submitted by: Jesse McConnell

Modified:
    maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java
    maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DocumentRenderer.java
    maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DoxiaDocumentRenderer.java

Modified: maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java?rev=391848&r1=391847&r2=391848&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java
(original)
+++ maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java
Wed Apr  5 16:47:59 2006
@@ -201,22 +201,35 @@
         {
             DocumentRenderer docRenderer = (DocumentRenderer) i.next();
 
-            File outputFile = new File( outputDirectory, docRenderer.getOutputName() );
+            RenderingContext renderingContext = docRenderer.getRenderingContext();
 
-            if ( !outputFile.getParentFile().exists() )
-            {
-                outputFile.getParentFile().mkdirs();
-            }
+            File outputFile = new File ( outputDirectory, docRenderer.getOutputName() );
+
+            File inputFile = new File ( renderingContext.getBasedir(), renderingContext.getInputName()
);
 
-            OutputStreamWriter writer = new OutputStreamWriter( new FileOutputStream( outputFile
), outputEncoding );
 
-            try
+            if ( !outputFile.exists() || inputFile.lastModified() > outputFile.lastModified()
)
             {
-                docRenderer.renderDocument( writer, this, siteRenderingContext );
+                if ( !outputFile.getParentFile().exists() )
+                {
+                    outputFile.getParentFile().mkdirs();
+                }
+
+                OutputStreamWriter writer =
+                    new OutputStreamWriter( new FileOutputStream( outputFile ), outputEncoding
);
+
+                try
+                {
+                    docRenderer.renderDocument( writer, this, siteRenderingContext );
+                }
+                finally
+                {
+                    IOUtil.close( writer );
+                }
             }
-            finally
+            else
             {
-                IOUtil.close( writer );
+                getLogger().info( inputFile + " unchanged, not regenerating..." );
             }
         }
     }

Modified: maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DocumentRenderer.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DocumentRenderer.java?rev=391848&r1=391847&r2=391848&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DocumentRenderer.java
(original)
+++ maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DocumentRenderer.java
Wed Apr  5 16:47:59 2006
@@ -16,6 +16,8 @@
  * limitations under the License.
  */
 
+import org.apache.maven.doxia.module.xhtml.decoration.render.RenderingContext;
+
 import java.io.FileNotFoundException;
 import java.io.Writer;
 
@@ -26,8 +28,10 @@
  */
 public interface DocumentRenderer
 {
-    void renderDocument( Writer writer, Renderer renderer, SiteRenderingContext siteRenderingContext
)
+    public void renderDocument( Writer writer, Renderer renderer, SiteRenderingContext siteRenderingContext
)
         throws RendererException, FileNotFoundException;
 
-    String getOutputName();
+    public String getOutputName();
+
+    public RenderingContext getRenderingContext();
 }

Modified: maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DoxiaDocumentRenderer.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DoxiaDocumentRenderer.java?rev=391848&r1=391847&r2=391848&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DoxiaDocumentRenderer.java
(original)
+++ maven/doxia/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DoxiaDocumentRenderer.java
Wed Apr  5 16:47:59 2006
@@ -47,4 +47,9 @@
         return renderingContext.getOutputName();
     }
 
+    public RenderingContext getRenderingContext()
+    {
+        return renderingContext;
+    }
+
 }



Mime
View raw message