You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2017/12/15 04:20:21 UTC

[maven-site-plugin] branch master updated: [MSITE-804] fill the generator field with report info

This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-site-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 1ca2fb3  [MSITE-804] fill the generator field with report info
1ca2fb3 is described below

commit 1ca2fb3e86f742b365f580ce02c46c1de1a50d97
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Fri Dec 15 05:20:19 2017 +0100

    [MSITE-804] fill the generator field with report info
---
 .../site/render/AbstractSiteRenderingMojo.java        | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java b/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java
index a189e9b..6102908 100644
--- a/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java
+++ b/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java
@@ -44,6 +44,7 @@ import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.ReportPlugin;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.plugins.site.descriptor.AbstractSiteDescriptorMojo;
@@ -408,7 +409,10 @@ public abstract class AbstractSiteRenderingMojo
             }
             else
             {
-                RenderingContext renderingContext = new RenderingContext( siteDirectory, outputName );
+                String reportMojoInfo = mavenReportExecution.getPlugin().getGroupId() + ':'
+                    + mavenReportExecution.getPlugin().getArtifactId() + ':'
+                    + mavenReportExecution.getPlugin().getVersion() + ':' + mavenReportExecution.getGoal();
+                RenderingContext renderingContext = new RenderingContext( siteDirectory, outputName, reportMojoInfo );
                 DocumentRenderer renderer =
                     new ReportDocumentRenderer( mavenReportExecution, renderingContext, getLog() );
                 documents.put( outputName, renderer );
@@ -467,7 +471,9 @@ public abstract class AbstractSiteRenderingMojo
             // add "Project Information" category summary document
             List<MavenReport> categoryReports = categories.get( MavenReport.CATEGORY_PROJECT_INFORMATION );
 
-            RenderingContext renderingContext = new RenderingContext( siteDirectory, "project-info.html" );
+            RenderingContext renderingContext =
+                new RenderingContext( siteDirectory, "project-info.html",
+                                      getSitePluginInfo() + ":CategorySummaryDocumentRenderer" );
             String title = i18n.getString( "site-plugin", locale, "report.information.title" );
             String desc1 = i18n.getString( "site-plugin", locale, "report.information.description1" );
             String desc2 = i18n.getString( "site-plugin", locale, "report.information.description2" );
@@ -488,7 +494,9 @@ public abstract class AbstractSiteRenderingMojo
         {
             // add "Project Reports" category summary document
             List<MavenReport> categoryReports = categories.get( MavenReport.CATEGORY_PROJECT_REPORTS );
-            RenderingContext renderingContext = new RenderingContext( siteDirectory, "project-reports.html" );
+            RenderingContext renderingContext =
+                new RenderingContext( siteDirectory, "project-reports.html",
+                                      getSitePluginInfo() + ":CategorySummaryDocumentRenderer" );
             String title = i18n.getString( "site-plugin", locale, "report.project.title" );
             String desc1 = i18n.getString( "site-plugin", locale, "report.project.description1" );
             String desc2 = i18n.getString( "site-plugin", locale, "report.project.description2" );
@@ -507,6 +515,11 @@ public abstract class AbstractSiteRenderingMojo
         return documents;
     }
 
+    private String getSitePluginInfo()
+    {
+        PluginDescriptor pluginDescriptor = (PluginDescriptor) getPluginContext().get( "pluginDescriptor" );
+        return pluginDescriptor.getId();
+    }
     protected void populateReportItems( DecorationModel decorationModel, Locale locale,
                                         Map<String, MavenReport> reportsByOutputName )
     {

-- 
To stop receiving notification emails like this one, please contact
['"commits@maven.apache.org" <co...@maven.apache.org>'].