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 2018/06/21 09:47:56 UTC
[sis] 03/03: Do not overwrite the standard CSS files when Javadoc
plugin is executed more than once without "mvn clean".
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to tag 0.7
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 8bb29905736a98f3c0c06aa45e24dce85a28fc99
Author: Martin Desruisseaux <de...@apache.org>
AuthorDate: Thu May 19 00:09:30 2016 +0000
Do not overwrite the standard CSS files when Javadoc plugin is executed more than once without "mvn clean".
git-svn-id: https://svn.apache.org/repos/asf/sis/branches/JDK8@1744471 13f79535-47bb-0310-9956-ffa450edef68
---
.../org/apache/sis/internal/doclet/Doclet.java | 41 ++++++++++++----------
.../apache/sis/internal/doclet/package-info.java | 2 +-
2 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/Doclet.java b/core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/Doclet.java
index c949770..2f09dc6 100644
--- a/core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/Doclet.java
+++ b/core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/Doclet.java
@@ -50,7 +50,7 @@ import com.sun.tools.doclets.formats.html.HtmlDoclet;
*
* @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 HtmlDoclet {
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 HtmlDoclet {
/**
* 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 HtmlDoclet {
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.
+ */
+ 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();
+ }
}
+ } 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);
+ BufferedReader in = openReader(inputFile);
+ BufferedWriter out = openWriter(stylesheetFile);
try {
String line;
while ((line = in.readLine()) != null) {
diff --git a/core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/package-info.java b/core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/package-info.java
index 8ae4446..62f15e6 100644
--- a/core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/package-info.java
+++ b/core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/package-info.java
@@ -21,7 +21,7 @@
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.5
- * @version 0.5
+ * @version 0.7
* @module
*/
package org.apache.sis.internal.doclet;