maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r927602 - in /maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model: building/ plugin/
Date Thu, 25 Mar 2010 21:54:04 GMT
Author: bentmann
Date: Thu Mar 25 21:54:04 2010
New Revision: 927602

URL: http://svn.apache.org/viewvc?rev=927602&view=rev
Log:
[MNG-4162] Removal of all reporting logic from the core of Maven

o Finished converter for reporting section

Added:
    maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportConfigurationExpander.java
  (with props)
    maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/ReportConfigurationExpander.java
  (with props)
Modified:
    maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
    maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java
    maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportingConverter.java
    maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java

Modified: maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java?rev=927602&r1=927601&r2=927602&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
(original)
+++ maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
Thu Mar 25 21:54:04 2010
@@ -46,6 +46,7 @@ import org.apache.maven.model.normalizat
 import org.apache.maven.model.path.ModelPathTranslator;
 import org.apache.maven.model.plugin.LifecycleBindingsInjector;
 import org.apache.maven.model.plugin.PluginConfigurationExpander;
+import org.apache.maven.model.plugin.ReportConfigurationExpander;
 import org.apache.maven.model.plugin.ReportingConverter;
 import org.apache.maven.model.profile.DefaultProfileActivationContext;
 import org.apache.maven.model.profile.ProfileActivationContext;
@@ -109,6 +110,9 @@ public class DefaultModelBuilder
     private PluginConfigurationExpander pluginConfigurationExpander;
 
     @Requirement
+    private ReportConfigurationExpander reportConfigurationExpander;
+
+    @Requirement
     private ReportingConverter reportingConverter;
 
     public ModelBuildingResult build( ModelBuildingRequest request )
@@ -276,9 +280,11 @@ public class DefaultModelBuilder
 
         if ( request.isProcessPlugins() )
         {
-            pluginConfigurationExpander.expandPluginConfiguration( resultModel, request,
problems );
+            reportConfigurationExpander.expandPluginConfiguration( resultModel, request,
problems );
 
             reportingConverter.convertReporting( resultModel, request, problems );
+
+            pluginConfigurationExpander.expandPluginConfiguration( resultModel, request,
problems );
         }
 
         modelValidator.validateEffectiveModel( resultModel, request, problems );

Modified: maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java?rev=927602&r1=927601&r2=927602&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java
(original)
+++ maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java
Thu Mar 25 21:54:04 2010
@@ -26,16 +26,13 @@ import org.apache.maven.model.Model;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.PluginExecution;
 import org.apache.maven.model.PluginManagement;
-import org.apache.maven.model.ReportPlugin;
-import org.apache.maven.model.ReportSet;
-import org.apache.maven.model.Reporting;
 import org.apache.maven.model.building.ModelBuildingRequest;
 import org.apache.maven.model.building.ModelProblemCollector;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.util.xml.Xpp3Dom;
 
 /**
- * Handles expansion of general plugin configuration into individual executions and report
sets.
+ * Handles expansion of general build plugin configuration into individual executions.
  * 
  * @author Benjamin Bentmann
  */
@@ -47,7 +44,6 @@ public class DefaultPluginConfigurationE
     public void expandPluginConfiguration( Model model, ModelBuildingRequest request, ModelProblemCollector
problems )
     {
         Build build = model.getBuild();
-        Reporting reporting = model.getReporting();
 
         if ( build != null )
         {
@@ -60,24 +56,6 @@ public class DefaultPluginConfigurationE
                 expand( pluginManagement.getPlugins() );
             }
         }
-
-        if ( reporting != null )
-        {
-            for ( ReportPlugin reportPlugin : reporting.getPlugins() )
-            {
-                Xpp3Dom parentDom = (Xpp3Dom) reportPlugin.getConfiguration();
-
-                if ( parentDom != null )
-                {
-                    for ( ReportSet execution : reportPlugin.getReportSets() )
-                    {
-                        Xpp3Dom childDom = (Xpp3Dom) execution.getConfiguration();
-                        childDom = Xpp3Dom.mergeXpp3Dom( childDom, new Xpp3Dom( parentDom
) );
-                        execution.setConfiguration( childDom );
-                    }
-                }
-            }
-        }
     }
 
     private void expand( List<Plugin> plugins )

Added: maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportConfigurationExpander.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportConfigurationExpander.java?rev=927602&view=auto
==============================================================================
--- maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportConfigurationExpander.java
(added)
+++ maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportConfigurationExpander.java
Thu Mar 25 21:54:04 2010
@@ -0,0 +1,64 @@
+package org.apache.maven.model.plugin;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.model.ReportSet;
+import org.apache.maven.model.Reporting;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+/**
+ * Handles expansion of general report plugin configuration into individual report sets.
+ * 
+ * @author Benjamin Bentmann
+ */
+@Component( role = ReportConfigurationExpander.class )
+public class DefaultReportConfigurationExpander
+    implements ReportConfigurationExpander
+{
+
+    public void expandPluginConfiguration( Model model, ModelBuildingRequest request, ModelProblemCollector
problems )
+    {
+        Reporting reporting = model.getReporting();
+
+        if ( reporting != null )
+        {
+            for ( ReportPlugin reportPlugin : reporting.getPlugins() )
+            {
+                Xpp3Dom parentDom = (Xpp3Dom) reportPlugin.getConfiguration();
+
+                if ( parentDom != null )
+                {
+                    for ( ReportSet execution : reportPlugin.getReportSets() )
+                    {
+                        Xpp3Dom childDom = (Xpp3Dom) execution.getConfiguration();
+                        childDom = Xpp3Dom.mergeXpp3Dom( childDom, new Xpp3Dom( parentDom
) );
+                        execution.setConfiguration( childDom );
+                    }
+                }
+            }
+        }
+    }
+
+}

Propchange: maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportConfigurationExpander.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportConfigurationExpander.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportingConverter.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportingConverter.java?rev=927602&r1=927601&r2=927602&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportingConverter.java
(original)
+++ maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportingConverter.java
Thu Mar 25 21:54:04 2010
@@ -108,7 +108,7 @@ public class DefaultReportingConverter
             Xpp3Dom reportPlugin = convert( plugin );
             reportPlugins.addChild( reportPlugin );
 
-            if ( !reporting.isExcludeDefaults()
+            if ( !reporting.isExcludeDefaults() && !hasMavenProjectInfoReportsPlugin
                 && "org.apache.maven.plugins".equals( reportPlugin.getChild( "groupId"
).getValue() )
                 && "maven-project-info-reports-plugin".equals( reportPlugin.getChild(
"artifactId" ).getValue() ) )
             {
@@ -118,7 +118,7 @@ public class DefaultReportingConverter
 
         if ( !reporting.isExcludeDefaults() && !hasMavenProjectInfoReportsPlugin
)
         {
-            Xpp3Dom dom = new Xpp3Dom( "plugin" );
+            Xpp3Dom dom = new Xpp3Dom( "reportPlugin" );
 
             addDom( dom, "groupId", "org.apache.maven.plugins" );
             addDom( dom, "artifactId", "maven-project-info-reports-plugin" );
@@ -160,7 +160,7 @@ public class DefaultReportingConverter
 
     private Xpp3Dom convert( ReportPlugin plugin )
     {
-        Xpp3Dom dom = new Xpp3Dom( "plugin" );
+        Xpp3Dom dom = new Xpp3Dom( "reportPlugin" );
 
         addDom( dom, "groupId", plugin.getGroupId() );
         addDom( dom, "artifactId", plugin.getArtifactId() );
@@ -172,19 +172,42 @@ public class DefaultReportingConverter
             configuration = new Xpp3Dom( configuration );
             dom.addChild( configuration );
         }
-        Xpp3Dom reports = new Xpp3Dom( "reports" );
 
-        if (! plugin.getReportSets().isEmpty())
+        if ( !plugin.getReportSets().isEmpty() )
         {
-            dom.addChild( reports );
+            Xpp3Dom reportSets = new Xpp3Dom( "reportSets" );
+            for ( ReportSet reportSet : plugin.getReportSets() )
+            {
+                Xpp3Dom rs = convert( reportSet );
+                reportSets.addChild( rs );
+            }
+            dom.addChild( reportSets );
         }
-        // TODO: Clarifiy conversion f reporset.configuration
-        for ( ReportSet reportSet : plugin.getReportSets() )
+
+        return dom;
+    }
+
+    private Xpp3Dom convert( ReportSet reportSet )
+    {
+        Xpp3Dom dom = new Xpp3Dom( "reportSet" );
+
+        addDom( dom, "id", reportSet.getId() );
+
+        Xpp3Dom configuration = (Xpp3Dom) reportSet.getConfiguration();
+        if ( configuration != null )
+        {
+            configuration = new Xpp3Dom( configuration );
+            dom.addChild( configuration );
+        }
+
+        if ( !reportSet.getReports().isEmpty() )
         {
-            for (String report : reportSet.getReports())
+            Xpp3Dom reports = new Xpp3Dom( "reports" );
+            for ( String report : reportSet.getReports() )
             {
                 addDom( reports, "report", report );
             }
+            dom.addChild( reports );
         }
 
         return dom;

Modified: maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java?rev=927602&r1=927601&r2=927602&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java
(original)
+++ maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java
Thu Mar 25 21:54:04 2010
@@ -24,7 +24,7 @@ import org.apache.maven.model.building.M
 import org.apache.maven.model.building.ModelProblemCollector;
 
 /**
- * Handles expansion of general plugin configuration into individual executions and report
sets.
+ * Handles expansion of general build plugin configuration into individual executions.
  * 
  * @author Benjamin Bentmann
  */
@@ -32,10 +32,9 @@ public interface PluginConfigurationExpa
 {
 
     /**
-     * Merges values from general plugin configuration into the individual plugin executions
and reports sets of the
-     * given model.
+     * Merges values from general build plugin configuration into the individual plugin executions
of the given model.
      * 
-     * @param model The model whose plugin configuration should be expanded, must not be
<code>null</code>.
+     * @param model The model whose build plugin configuration should be expanded, must not
be <code>null</code>.
      * @param request The model building request that holds further settings, must not be
{@code null}.
      * @param problems The container used to collect problems that were encountered, must
not be {@code null}.
      */

Added: maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/ReportConfigurationExpander.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/ReportConfigurationExpander.java?rev=927602&view=auto
==============================================================================
--- maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/ReportConfigurationExpander.java
(added)
+++ maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/ReportConfigurationExpander.java
Thu Mar 25 21:54:04 2010
@@ -0,0 +1,43 @@
+package org.apache.maven.model.plugin;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+
+/**
+ * Handles expansion of general report plugin configuration into individual report sets.
+ * 
+ * @author Benjamin Bentmann
+ */
+public interface ReportConfigurationExpander
+{
+
+    /**
+     * Merges values from general report plugin configuration into the individual reports
sets of the given model.
+     * 
+     * @param model The model whose report plugin configuration should be expanded, must
not be <code>null</code>.
+     * @param request The model building request that holds further settings, must not be
{@code null}.
+     * @param problems The container used to collect problems that were encountered, must
not be {@code null}.
+     */
+    void expandPluginConfiguration( Model model, ModelBuildingRequest request, ModelProblemCollector
problems );
+
+}

Propchange: maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/ReportConfigurationExpander.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/plugin/ReportConfigurationExpander.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message