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

[maven-site-plugin] branch MSITE-914 updated (a6f63f11 -> dcc3182d)

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

michaelo pushed a change to branch MSITE-914
in repository https://gitbox.apache.org/repos/asf/maven-site-plugin.git


 discard a6f63f11 [MSITE-914] SiteMojo never populates supportedLocales Velocity context property
     new dcc3182d [MSITE-914] SiteMojo never populates supportedLocales Velocity context property

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (a6f63f11)
            \
             N -- N -- N   refs/heads/MSITE-914 (dcc3182d)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/site/xdoc/{index.xml => index.xml.vm}      |  2 +-
 src/it/projects/site-sd-lang/verify.bsh            | 38 +++++++++++++++-------
 2 files changed, 27 insertions(+), 13 deletions(-)
 rename src/it/projects/site-sd-lang/src/site/xdoc/{index.xml => index.xml.vm} (90%)


[maven-site-plugin] 01/01: [MSITE-914] SiteMojo never populates supportedLocales Velocity context property

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit dcc3182d0ad35c5069c8601c9a89f3a5350a4493
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sat Nov 19 23:23:06 2022 +0100

    [MSITE-914] SiteMojo never populates supportedLocales Velocity context property
    
    This closes #111
---
 .../src/site/xdoc/{index.xml => index.xml.vm}      |  2 +-
 src/it/projects/site-sd-lang/verify.bsh            | 38 +++++++++++++++-------
 .../apache/maven/plugins/site/render/SiteMojo.java |  7 ++--
 3 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/src/it/projects/site-sd-lang/src/site/xdoc/index.xml b/src/it/projects/site-sd-lang/src/site/xdoc/index.xml.vm
similarity index 90%
rename from src/it/projects/site-sd-lang/src/site/xdoc/index.xml
rename to src/it/projects/site-sd-lang/src/site/xdoc/index.xml.vm
index 5a8d21eb..b7e22572 100644
--- a/src/it/projects/site-sd-lang/src/site/xdoc/index.xml
+++ b/src/it/projects/site-sd-lang/src/site/xdoc/index.xml.vm
@@ -28,7 +28,7 @@ under the License.
 
 		<section name="first section">
 			<p>
-				 this is the multimodule page in english 
+				This is the multimodule page in English and the following locales are supported: $supportedLocales.
 			</p>
 		</section>
 
diff --git a/src/it/projects/site-sd-lang/verify.bsh b/src/it/projects/site-sd-lang/verify.bsh
index 3a029733..8f4efe01 100644
--- a/src/it/projects/site-sd-lang/verify.bsh
+++ b/src/it/projects/site-sd-lang/verify.bsh
@@ -19,6 +19,7 @@
  */
 
 import java.io.*;
+import org.codehaus.plexus.util.*;
 
 boolean result = true;
 
@@ -42,10 +43,23 @@ try
         return false;
     }
 
-    File projectInfoDirectory = new File( topLevelDirectory, "project-info.html" );
-    if ( !projectInfoDirectory.exists() || !projectInfoDirectory.isFile() )
+    File indexFile = new File( topLevelDirectory, "index.html" );
+    if ( !indexFile.exists() || !indexFile.isFile() )
     {
-        System.err.println( "Site project-info.html '" + projectInfoDirectory + "' is missing or not a file." );
+        System.err.println( "Site index.html '" + indexFile + "' is missing or not a file." );
+        return false;
+    }
+    String content = FileUtils.fileRead( indexFile, "UTF-8" );
+    if ( !content.contains( "the following locales are supported: [en, fr]" ) )
+    {
+        System.err.println( "index.html does not contain supported locales" );
+        return false;
+    }
+
+    File projectInfoFile = new File( topLevelDirectory, "project-info.html" );
+    if ( !projectInfoFile.exists() || !projectInfoFile.isFile() )
+    {
+        System.err.println( "Site project-info.html '" + projectInfoFile + "' is missing or not a file." );
         return false;
     }
 
@@ -56,10 +70,10 @@ try
         return false;
     }
 
-    File frProjectInfoDirectory = new File( frDirectory, "project-info.html" );
-    if ( !frProjectInfoDirectory.exists() || !frProjectInfoDirectory.isFile() )
+    File frProjectInfoFile = new File( frDirectory, "project-info.html" );
+    if ( !frProjectInfoFile.exists() || !frProjectInfoFile.isFile() )
     {
-        System.err.println( "Site fr project-info.html '" + frProjectInfoDirectory + "' is missing or not a file." );
+        System.err.println( "Site fr project-info.html '" + frProjectInfoFile + "' is missing or not a file." );
         return false;
     }
 
@@ -70,17 +84,17 @@ try
         return false;
     }
 
-    File moduleProjectInfoDirectory = new File( moduleDirectory, "project-info.html" );
-    if ( !moduleProjectInfoDirectory.exists() || !moduleProjectInfoDirectory.isFile() )
+    File moduleProjectInfoFile = new File( moduleDirectory, "project-info.html" );
+    if ( !moduleProjectInfoFile.exists() || !moduleProjectInfoFile.isFile() )
     {
-        System.err.println( "Site module project-info.html '" + moduleProjectInfoDirectory + "' is missing or not a file." );
+        System.err.println( "Site module project-info.html '" + moduleProjectInfoFile + "' is missing or not a file." );
         return false;
     }
 
-    File frModuleProjectInfoDirectory = new File( frModuleDirectory, "project-info.html" );
-    if ( !frModuleProjectInfoDirectory.exists() || !frModuleProjectInfoDirectory.isFile() )
+    File frModuleProjectInfoFile = new File( frModuleDirectory, "project-info.html" );
+    if ( !frModuleProjectInfoFile.exists() || !frModuleProjectInfoFile.isFile() )
     {
-        System.err.println( "Site fr module project-info.html '" + frModuleProjectInfoDirectory + "' is missing or not a file." );
+        System.err.println( "Site fr module project-info.html '" + frModuleProjectInfoFile + "' is missing or not a file." );
         return false;
     }
 
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 f4066d8b..ce2fce59 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
@@ -140,7 +140,7 @@ public class SiteMojo
                     getLog().info( buffer().strong( "Rendering localized site for " + locale.getDisplayName() + " ("
                         + locale + ")" ).toString() );
                 }
-                renderLocale( locale, reports );
+                renderLocale( locale, reports, localesList );
             }
         }
         catch ( RendererException e )
@@ -158,10 +158,11 @@ public class SiteMojo
         }
     }
 
-    private void renderLocale( Locale locale, List<MavenReportExecution> reports )
+    private void renderLocale( Locale locale, List<MavenReportExecution> reports, List<Locale> supportedLocales )
         throws IOException, RendererException, MojoFailureException, MojoExecutionException
     {
         SiteRenderingContext context = createSiteRenderingContext( locale );
+        context.addSiteLocales( supportedLocales );
         // MSITE-723 add generated site directory, in case some content has been put in pre-site phase
         context.addSiteDirectory( generatedSiteDirectory );
 
@@ -216,7 +217,7 @@ public class SiteMojo
 
     /**
      * Render Doxia documents from the list given, but not reports.
-     * 
+     *
      * @param documents a collection of documents containing both Doxia source files and reports
      * @return the sublist of documents that are not Doxia source files
      */