Author: jdcasey
Date: Mon Aug 18 22:14:32 2008
New Revision: 686957

URL: http://svn.apache.org/viewvc?rev=686957&view=rev
Log:
Move distro assembly plugin version back down to 2.1, and adjust detection of 
plugins that use reactor projects (or could use them via the session) by 
injecting defaultValue and expression into the mojo descriptors for later use 
in the lifecycle executor.

Modified:
    maven/components/branches/maven-2.0.10-RC/apache-maven/pom.xml
    
maven/components/branches/maven-2.0.10-RC/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
    
maven/components/branches/maven-2.0.10-RC/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java

Modified: maven/components/branches/maven-2.0.10-RC/apache-maven/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.10-RC/apache-maven/pom.xml?rev=686957&r1=686956&r2=686957&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.10-RC/apache-maven/pom.xml (original)
+++ maven/components/branches/maven-2.0.10-RC/apache-maven/pom.xml Mon Aug 18 
22:14:32 2008
@@ -97,7 +97,10 @@
       </plugin>
       <plugin>
         <artifactId>maven-assembly-plugin</artifactId>
+        <version>2.1</version>
+        <!--
         <version>2.2-beta-2</version>
+        -->
         <executions>
           <execution>
             <id>bin-assembly</id>

Modified: 
maven/components/branches/maven-2.0.10-RC/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: 
http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.10-RC/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=686957&r1=686956&r2=686957&view=diff
==============================================================================
--- 
maven/components/branches/maven-2.0.10-RC/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
 (original)
+++ 
maven/components/branches/maven-2.0.10-RC/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
 Mon Aug 18 22:14:32 2008
@@ -58,6 +58,7 @@
 import org.apache.maven.plugin.PluginManagerException;
 import org.apache.maven.plugin.PluginNotFoundException;
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.descriptor.Parameter;
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.plugin.lifecycle.Execution;
 import org.apache.maven.plugin.lifecycle.Phase;
@@ -567,8 +568,7 @@
 
             calculateConcreteState( project, session );
             
-            PlexusConfiguration configuration = 
mojoDescriptor.getMojoConfiguration();
-            boolean usesAllProjects = mojoDescriptor.isAggregator() || 
usesSessionOrReactorProjects( configuration );
+            boolean usesAllProjects = mojoDescriptor.isAggregator() || 
usesSessionOrReactorProjects( mojoDescriptor );
             
             if ( usesAllProjects )
             {
@@ -735,15 +735,27 @@
         project.setExecutionProject( executionProject );
     }
 
-    private boolean usesSessionOrReactorProjects( PlexusConfiguration 
configuration )
+    private boolean usesSessionOrReactorProjects( MojoDescriptor 
mojoDescriptor )
     {
-        String value = configuration != null ? String.valueOf( configuration ) 
: null;
-        
-        if ( value != null )
+        List params = mojoDescriptor.getParameters();
+        if ( params != null )
         {
-            if ( value.indexOf( "${session" ) > -1 || value.indexOf( 
"${reactorProjects}" ) > -1 )
+            for ( Iterator it = params.iterator(); it.hasNext(); )
             {
-                return true;
+                Parameter param = (Parameter) it.next();
+                String value = param.getExpression();
+                if ( value != null && value.trim().length() > 0
+                    && ( value.indexOf( "${session" ) > -1 || value.indexOf( 
"${reactorProjects}" ) > -1 ) )
+                {
+                    return true;
+                }
+                
+                value = param.getDefaultValue();
+                if ( value != null && value.trim().length() > 0
+                    && ( value.indexOf( "${session" ) > -1 || value.indexOf( 
"${reactorProjects}" ) > -1 ) )
+                {
+                    return true;
+                }
             }
         }
         
@@ -1267,7 +1279,7 @@
                 if ( lifecycleForkers.contains( execution.getMojoDescriptor() 
) )
                 {
                     taskIterator.remove();
-                    getLogger().warn( "Removing: " + 
execution.getMojoDescriptor().getGoal()
+                    getLogger().warn( "Removing: " + 
execution.getMojoDescriptor().getFullGoalName()
                                       + " from forked lifecycle, to prevent 
recursive invocation." );
                 }
             }

Modified: 
maven/components/branches/maven-2.0.10-RC/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java
URL: 
http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.10-RC/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java?rev=686957&r1=686956&r2=686957&view=diff
==============================================================================
--- 
maven/components/branches/maven-2.0.10-RC/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java
 (original)
+++ 
maven/components/branches/maven-2.0.10-RC/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java
 Mon Aug 18 22:14:32 2008
@@ -30,7 +30,10 @@
 import java.io.IOException;
 import java.io.Reader;
 import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
@@ -280,6 +283,37 @@
 
             parameters.add( parameter );
         }
+        
+        PlexusConfiguration[] parameterConfigs = c.getChild( "configuration" 
).getChildren();
+        if ( parameterConfigs != null && parameterConfigs.length > 0 )
+        {
+            Map configMap = new HashMap( parameterConfigs.length );
+            for ( int i = 0; i < parameterConfigs.length; i++ )
+            {
+                configMap.put( parameterConfigs[i].getName(), 
parameterConfigs[i] );
+            }
+            
+            for ( Iterator it = parameters.iterator(); it.hasNext(); )
+            {
+                Parameter param = (Parameter) it.next();
+                PlexusConfiguration paramConfig = (PlexusConfiguration) 
configMap.get( param.getName() );
+                
+                if ( paramConfig != null )
+                {
+                    String expr = paramConfig.getValue();
+                    if ( expr != null && expr.trim().length() > 0 )
+                    {
+                        param.setExpression( expr );
+                    }
+                    
+                    String defaultValue = paramConfig.getAttribute( 
"default-value" );
+                    if ( defaultValue != null && defaultValue.trim().length() 
> 0 )
+                    {
+                        param.setDefaultValue( defaultValue );
+                    }
+                }
+            }
+        }
 
         mojo.setParameters( parameters );
 


Reply via email to