From 79ed7988811fa8d618bd4606af0fa60b566bf2d1 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Sun, 22 Oct 2023 12:34:32 +0200 Subject: [PATCH] Make field names consistent --- .../site/render/ReportDocumentRenderer.java | 22 +++++++++---------- .../maven/plugins/site/render/SiteMojo.java | 22 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/site/render/ReportDocumentRenderer.java b/src/main/java/org/apache/maven/plugins/site/render/ReportDocumentRenderer.java index 7d25c9aa..c359269d 100644 --- a/src/main/java/org/apache/maven/plugins/site/render/ReportDocumentRenderer.java +++ b/src/main/java/org/apache/maven/plugins/site/render/ReportDocumentRenderer.java @@ -78,22 +78,22 @@ public ReportDocumentRenderer( } private static class MultiPageSubSink extends SiteRendererSink { - private File outputDir; + private File outputDirectory; private String outputName; - MultiPageSubSink(File outputDir, String outputName, DocumentRenderingContext docRenderingContext) { + MultiPageSubSink(File outputDirectory, String outputName, DocumentRenderingContext docRenderingContext) { super(docRenderingContext); this.outputName = outputName; - this.outputDir = outputDir; + this.outputDirectory = outputDirectory; } public String getOutputName() { return outputName; } - public File getOutputDir() { - return outputDir; + public File getOutputDirectory() { + return outputDirectory; } } @@ -119,10 +119,10 @@ private static class MultiPageSinkFactory implements SinkFactory { } @Override - public Sink createSink(File outputDir, String outputName) { + public Sink createSink(File outputDirectory, String outputName) { // Create a new document rendering context, similar to the main one, but with a different output name String document = PathTool.getRelativeFilePath( - report.getReportOutputDirectory().getPath(), new File(outputDir, outputName).getPath()); + report.getReportOutputDirectory().getPath(), new File(outputDirectory, outputName).getPath()); // Remove .html suffix since we know that we are in Site Renderer context document = document.substring(0, document.lastIndexOf('.')); @@ -136,7 +136,7 @@ public Sink createSink(File outputDir, String outputName) { docRenderingContext.getGenerator()); // Create a sink for this subpage, based on this new document rendering context - MultiPageSubSink sink = new MultiPageSubSink(outputDir, outputName, subSinkContext); + MultiPageSubSink sink = new MultiPageSubSink(outputDirectory, outputName, subSinkContext); // Add it to the list of sinks associated to this report sinks.add(sink); @@ -239,11 +239,11 @@ public void renderDocument(Writer writer, SiteRenderer siteRenderer, SiteRenderi log.debug(" Rendering " + outputName); // Create directories if necessary - if (!mySink.getOutputDir().exists()) { - mySink.getOutputDir().mkdirs(); + if (!mySink.getOutputDirectory().exists()) { + mySink.getOutputDirectory().mkdirs(); } - File outputFile = new File(mySink.getOutputDir(), outputName); + File outputFile = new File(mySink.getOutputDirectory(), outputName); try (Writer out = WriterFactory.newWriter(outputFile, siteRenderingContext.getOutputEncoding())) { siteRenderer.mergeDocumentIntoSite(out, mySink, siteRenderingContext); diff --git a/src/main/java/org/apache/maven/plugins/site/render/SiteMojo.java b/src/main/java/org/apache/maven/plugins/site/render/SiteMojo.java index d60da16f..84d24e5f 100644 --- a/src/main/java/org/apache/maven/plugins/site/render/SiteMojo.java +++ b/src/main/java/org/apache/maven/plugins/site/render/SiteMojo.java @@ -142,24 +142,24 @@ private void renderLocale(Locale locale, List reports, Lis getLog().info("Validation is switched on, xml input documents will be validated!"); } - File outputDir = getOutputDirectory(locale); + File outputDirectory = getOutputDirectory(locale); Map documents = locateDocuments(context, reports, locale); // copy resources - siteRenderer.copyResources(context, outputDir); + siteRenderer.copyResources(context, outputDirectory); // 1. render Doxia documents first - List nonDoxiaDocuments = renderDoxiaDocuments(documents, context, outputDir, false); + List nonDoxiaDocuments = renderDoxiaDocuments(documents, context, outputDirectory, false); // prepare external reports for (MavenReportExecution mavenReportExecution : reports) { MavenReport report = mavenReportExecution.getMavenReport(); - report.setReportOutputDirectory(outputDir); + report.setReportOutputDirectory(outputDirectory); } // 2. then non-Doxia documents (e.g., reports) - renderNonDoxiaDocuments(nonDoxiaDocuments, context, outputDir); + renderNonDoxiaDocuments(nonDoxiaDocuments, context, outputDirectory); // 3. Generated docs must be (re-)done afterwards as they are often generated by reports context.getSiteDirectories().clear(); @@ -172,10 +172,10 @@ private void renderLocale(Locale locale, List reports, Lis Map generatedDocuments = siteRenderer.locateDocumentFiles(context, false /* not editable */); - renderDoxiaDocuments(generatedDocuments, context, outputDir, true); + renderDoxiaDocuments(generatedDocuments, context, outputDirectory, true); // copy generated resources also - siteRenderer.copyResources(context, outputDir); + siteRenderer.copyResources(context, outputDirectory); } /** @@ -185,7 +185,7 @@ private void renderLocale(Locale locale, List reports, Lis * @return the sublist of documents that are not Doxia source files */ private List renderDoxiaDocuments( - Map documents, SiteRenderingContext context, File outputDir, boolean generated) + Map documents, SiteRenderingContext context, File outputDirectory, boolean generated) throws RendererException, IOException { Map doxiaDocuments = new TreeMap<>(); List nonDoxiaDocuments = new ArrayList<>(); @@ -233,7 +233,7 @@ private List renderDoxiaDocuments( getLog().info(mb.toString()); - siteRenderer.render(doxiaDocuments.values(), context, outputDir); + siteRenderer.render(doxiaDocuments.values(), context, outputDirectory); } return nonDoxiaDocuments; @@ -244,7 +244,7 @@ private List renderDoxiaDocuments( * * @param documents a collection of documents containing non-Doxia source files */ - private void renderNonDoxiaDocuments(List documents, SiteRenderingContext context, File outputDir) + private void renderNonDoxiaDocuments(List documents, SiteRenderingContext context, File outputDirectory) throws RendererException, IOException { Map counts = new TreeMap<>(); @@ -277,7 +277,7 @@ private void renderNonDoxiaDocuments(List documents, SiteRende getLog().info(mb.toString()); } - siteRenderer.render(documents, context, outputDir); + siteRenderer.render(documents, context, outputDirectory); } }