You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2016/05/19 00:24:45 UTC

svn commit: r1744476 - in /sis/trunk: ./ core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/Doclet.java core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/package-info.java

Author: desruisseaux
Date: Thu May 19 00:24:44 2016
New Revision: 1744476

URL: http://svn.apache.org/viewvc?rev=1744476&view=rev
Log:
Do not overwrite the standard CSS file when Javadoc plugin is executed more than once without "mvn clean".

Modified:
    sis/trunk/   (props changed)
    sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/Doclet.java
    sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/package-info.java

Propchange: sis/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May 19 00:24:44 2016
@@ -1,4 +1,4 @@
 /sis/branches/Android:1430670-1480699
-/sis/branches/JDK6:1394364-1744337
-/sis/branches/JDK7:1394913-1744336
-/sis/branches/JDK8:1584960-1744335
+/sis/branches/JDK6:1394364-1744475
+/sis/branches/JDK7:1394913-1744473
+/sis/branches/JDK8:1584960-1744471

Modified: sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/Doclet.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/Doclet.java?rev=1744476&r1=1744475&r2=1744476&view=diff
==============================================================================
--- sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/Doclet.java [UTF-8] (original)
+++ sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/Doclet.java [UTF-8] Thu May 19 00:24:44 2016
@@ -50,7 +50,7 @@ import com.sun.tools.doclets.formats.htm
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.5
- * @version 0.5
+ * @version 0.7
  * @module
  */
 public final class Doclet extends HtmlDoclet {
@@ -97,7 +97,7 @@ public final class Doclet extends HtmlDo
             copyResources(customCSS.getParentFile(), output);
             final Rewriter r = new Rewriter();
             for (final File file : output.listFiles()) {
-                if (file.isDirectory()) {  // Do not process files in the root directory, only in sub-directories.
+                if (file.isDirectory()) {       // Do not process files in the root directory, only in sub-directories.
                     r.processDirectory(file);
                 }
             }
@@ -148,6 +148,7 @@ public final class Doclet extends HtmlDo
 
     /**
      * Copies the standard CSS file, then copies the custom CSS file.
+     * If the {@value #RENAMED_CSS} file already exists, it will not be overwritten.
      *
      * @param  inputFile        The custom CSS file to copy in the destination directory.
      * @param  outputDirectory  The directory where to copy the CSS file.
@@ -156,29 +157,31 @@ public final class Doclet extends HtmlDo
     private static void copyStylesheet(final File inputFile, final File outputDirectory) throws IOException {
         final File stylesheetFile = new File(outputDirectory, STYLESHEET);
         final File standardFile   = new File(outputDirectory, RENAMED_CSS);
-        /*
-         * Copy the standard CSS file, skipping the import of DejaVu font
-         * since our custom CSS file does not use it.
-         */
-        BufferedReader in  = openReader(stylesheetFile);
-        BufferedWriter out = openWriter(standardFile);
-        try {
-            String line;
-            while ((line = in.readLine()) != null) {
-                if (!line.equals("@import url('resources/fonts/dejavu.css');")) {
-                    out.write(line);
-                    out.newLine();
+        if (!standardFile.exists()) {
+            /*
+             * Copy the standard CSS file, skipping the import of DejaVu font
+             * since our custom CSS file does not use it.
+             */
+            final BufferedReader in  = openReader(stylesheetFile);
+            final BufferedWriter out = openWriter(standardFile);
+            try {
+                String line;
+                while ((line = in.readLine()) != null) {
+                    if (!line.equals("@import url('resources/fonts/dejavu.css');")) {
+                        out.write(line);
+                        out.newLine();
+                    }
                 }
+            } finally {
+                out.close();
+                in.close();
             }
-        } finally {
-            out.close();
-            in.close();
         }
         /*
          * Copy the custom CSS file, skipping comments for more compact file.
          */
-        in  = openReader(inputFile);
-        out = openWriter(stylesheetFile);
+        final BufferedReader in  = openReader(inputFile);
+        final BufferedWriter out = openWriter(stylesheetFile);
         try {
             String line;
             while ((line = in.readLine()) != null) {

Modified: sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/package-info.java?rev=1744476&r1=1744475&r2=1744476&view=diff
==============================================================================
--- sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/package-info.java [UTF-8] (original)
+++ sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/package-info.java [UTF-8] Thu May 19 00:24:44 2016
@@ -21,7 +21,7 @@
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.5
- * @version 0.5
+ * @version 0.7
  * @module
  */
 package org.apache.sis.internal.doclet;