maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsive...@apache.org
Subject svn commit: r620676 - in /maven/shared/trunk/maven-doxia-tools/src: main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java main/java/org/apache/maven/doxia/tools/SiteTool.java test/java/org/apache/maven/doxia/tools/SiteToolTest.java
Date Tue, 12 Feb 2008 00:17:07 GMT
Author: vsiveton
Date: Mon Feb 11 16:17:06 2008
New Revision: 620676

URL: http://svn.apache.org/viewvc?rev=620676&view=rev
Log:
MSITE-279: Inheritance of elements from site descriptor quite broken
Submitted by: Benjamin Bentmann
Reviewed by: Vincent Siveton

o applied. This patch modify the API

Modified:
    maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java
    maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/SiteTool.java
    maven/shared/trunk/maven-doxia-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java

Modified: maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java?rev=620676&r1=620675&r2=620676&view=diff
==============================================================================
--- maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java
(original)
+++ maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java
Mon Feb 11 16:17:06 2008
@@ -391,7 +391,7 @@
     }
 
     /** {@inheritDoc} */
-    public File getSiteDescriptorFromBasedir( File siteDirectory, File basedir, Locale locale
)
+    public File getSiteDescriptorFromBasedir( String siteDirectory, File basedir, Locale
locale )
     {
         if ( basedir == null )
         {
@@ -401,20 +401,20 @@
         if ( siteDirectory == null )
         {
             // TODO need to be more dynamic
-            siteDirectory = new File( basedir, "src/site" );
+            siteDirectory = "src/site";
         }
         if ( locale == null )
         {
             locale = new Locale( "" );
         }
 
-        String relativePath = getRelativePath( siteDirectory.getAbsolutePath(), basedir.getAbsolutePath()
);
+        File siteDir = new File( basedir, siteDirectory );
 
-        File siteDescriptor = new File( relativePath, "site_" + locale.getLanguage() + ".xml"
);
+        File siteDescriptor = new File( siteDir, "site_" + locale.getLanguage() + ".xml"
);
 
-        if ( !siteDescriptor.exists() )
+        if ( !siteDescriptor.isFile() )
         {
-            siteDescriptor = new File( relativePath, "site.xml" );
+            siteDescriptor = new File( siteDir, "site.xml" );
         }
         return siteDescriptor;
     }
@@ -465,7 +465,7 @@
     /** {@inheritDoc} */
     public DecorationModel getDecorationModel( MavenProject project, List reactorProjects,
                                                ArtifactRepository localRepository, List repositories,
-                                               File siteDirectory, Locale locale, String
inputEncoding,
+                                               String siteDirectory, Locale locale, String
inputEncoding,
                                                String outputEncoding )
         throws SiteToolException
     {
@@ -494,11 +494,6 @@
             throw new IllegalArgumentException( "outputEncoding could not be null" );
         }
 
-        if ( siteDirectory == null )
-        {
-            // TODO need to be more dynamic
-            siteDirectory = new File( project.getBasedir(), "src/site" );
-        }
         if ( locale == null )
         {
             locale = Locale.getDefault();
@@ -987,7 +982,7 @@
 
     private DecorationModel getDecorationModel( MavenProject project, List reactorProjects,
                                                 ArtifactRepository localRepository, List
repositories,
-                                                File siteDirectory, Locale locale, Map origProps,
String inputEncoding,
+                                                String siteDirectory, Locale locale, Map
origProps, String inputEncoding,
                                                 String outputEncoding )
         throws SiteToolException
     {

Modified: maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/SiteTool.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/SiteTool.java?rev=620676&r1=620675&r2=620676&view=diff
==============================================================================
--- maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/SiteTool.java
(original)
+++ maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/SiteTool.java
Mon Feb 11 16:17:06 2008
@@ -84,13 +84,13 @@
     String getRelativePath( String to, String from );
 
     /**
-     * @param siteDirectory containing the <code>site.xml</code> file. If null,
using by default "${basedir}/src/site".
+     * @param siteDirectory The path to the directory containing the <code>site.xml</code>
file, relative to the project base directory. If null, using by default "src/site".
      * @param basedir not null.
      * @param locale the locale wanted for the site descriptor. If not null, searching for
<code>site_<i>localeLanguage</i>.xml</code>,
      * otherwise searching for <code>site.xml</code>.
      * @return the site descriptor relative file, i.e. <code>src/site/site.xml</code>,
depending parameters value.
      */
-    File getSiteDescriptorFromBasedir( File siteDirectory, File basedir, Locale locale );
+    File getSiteDescriptorFromBasedir( String siteDirectory, File basedir, Locale locale
);
 
     /**
      * @param project the Maven project, not null.
@@ -110,7 +110,7 @@
      * @param reactorProjects the Maven reactor projects, not null.
      * @param localRepository the Maven local repository, not null.
      * @param repositories the Maven remote repositories, not null.
-     * @param siteDirectory containing the <code>site.xml</code> file. If null,
using by default "${basedir}/src/site".
+     * @param siteDirectory The path to the directory containing the <code>site.xml</code>
file, relative to the project base directory. If null, using by default "src/site".
      * @param locale the locale used for the i18n in DecorationModel. If null, using the
default locale in the jvm.
      * @param inputEncoding the input encoding of the site descriptor, not null.
      * @param outputEncoding the output encoding wanted, not null.
@@ -118,7 +118,7 @@
      * @throws SiteToolException if any
      */
     DecorationModel getDecorationModel( MavenProject project, List reactorProjects, ArtifactRepository
localRepository,
-                                        List repositories, File siteDirectory, Locale locale,
String inputEncoding,
+                                        List repositories, String siteDirectory, Locale locale,
String inputEncoding,
                                         String outputEncoding )
         throws SiteToolException;
 

Modified: maven/shared/trunk/maven-doxia-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-doxia-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java?rev=620676&r1=620675&r2=620676&view=diff
==============================================================================
--- maven/shared/trunk/maven-doxia-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java
(original)
+++ maven/shared/trunk/maven-doxia-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java
Mon Feb 11 16:17:06 2008
@@ -145,13 +145,13 @@
         assertNotNull( tool );
 
         SiteToolMavenProjectStub project = new SiteToolMavenProjectStub();
-        assertEquals( tool.getSiteDescriptorFromBasedir( null, project.getBasedir(), null
).toString(), "src"
-            + File.separator + "site" + File.separator + "site.xml" );
-        assertEquals( tool.getSiteDescriptorFromBasedir( null, project.getBasedir(), Locale.ENGLISH
).toString(), "src"
-            + File.separator + "site" + File.separator + "site.xml" );
-        File siteDir = new File( project.getBasedir(), "src/blabla" );
-        assertEquals( tool.getSiteDescriptorFromBasedir( siteDir, project.getBasedir(), null
).toString(), "src"
-            + File.separator + "blabla" + File.separator + "site.xml" );
+        assertEquals( tool.getSiteDescriptorFromBasedir( null, project.getBasedir(), null
).toString(),
+            project.getBasedir() + File.separator + "src" + File.separator + "site" + File.separator
+ "site.xml" );
+        assertEquals( tool.getSiteDescriptorFromBasedir( null, project.getBasedir(), Locale.ENGLISH
).toString(),
+            project.getBasedir() + File.separator + "src" + File.separator + "site" + File.separator
+ "site.xml" );
+        String siteDir = "src/blabla";
+        assertEquals( tool.getSiteDescriptorFromBasedir( siteDir, project.getBasedir(), null
).toString(),
+            project.getBasedir() + File.separator + "src" + File.separator + "blabla" + File.separator
+ "site.xml" );
     }
 
     /**
@@ -189,7 +189,7 @@
         project.setGroupId( "org.apache.maven" );
         project.setArtifactId( "maven-site" );
         project.setVersion( "1.0" );
-        File siteDirectory = new File( project.getBasedir(), "src/site" );
+        String siteDirectory = "src/site";
         List reactorProjects = new ArrayList();
 
         project.setBasedir( null ); // get it from repo



Mime
View raw message