Working on MNG-250...

Resolving MNG-488

o Brought the metadata tags for marmalade mojos up to snuff with the java-mojo annotations
o Added @aggregator annotation ( <aggregator>true</aggregator> in marmalade) for mojos
o Added support for aggregator flag throughout plugin-descriptor, generator, and builder.

More commits to follow...


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@226329 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-07-29 03:04:38 +00:00
parent 86c55a3bd1
commit 9d6ba0d633
13 changed files with 233 additions and 12 deletions

View File

@ -62,6 +62,8 @@ public class MojoDescriptor
private String deprecated;
private boolean aggregator = false;
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
@ -389,4 +391,14 @@ public class MojoDescriptor
{
this.executeLifecycle = executeLifecycle;
}
public void setAggregator( boolean aggregator )
{
this.aggregator = aggregator;
}
public boolean isAggregator()
{
return aggregator;
}
}

View File

@ -167,6 +167,13 @@ public class PluginDescriptorBuilder
mojo.setProjectRequired( Boolean.valueOf( requiresProject ).booleanValue() );
}
String aggregator = c.getChild( "aggregator" ).getValue();
if ( aggregator != null )
{
mojo.setAggregator( Boolean.valueOf( aggregator ).booleanValue() );
}
String requiresOnline = c.getChild( "requiresOnline" ).getValue();
if ( requiresOnline != null )

View File

@ -132,6 +132,12 @@ public class PluginDescriptorGenerator
//
// ----------------------------------------------------------------------
element( w, "aggregator", "" + mojoDescriptor.isAggregator() );
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
element( w, "requiresOnline", "" + mojoDescriptor.isOnlineRequired() );
// ----------------------------------------------------------------------

View File

@ -51,6 +51,7 @@ public class JavaMojoDescriptorExtractor
implements MojoDescriptorExtractor
{
public static final String MAVEN_PLUGIN_INSTANTIATION = "instantiationStrategy";
public static final String CONFIGURATOR = "configurator";
public static final String PARAMETER = "parameter";
@ -77,6 +78,8 @@ public class JavaMojoDescriptorExtractor
public static final String GOAL_REQUIRES_PROJECT = "requiresProject";
public static final String GOAL_IS_AGGREGATOR = "aggregator";
public static final String GOAL_REQUIRES_ONLINE = "requiresOnline";
public static final String GOAL_INHERIT_BY_DEFAULT = "inheritByDefault";
@ -236,6 +239,17 @@ public class JavaMojoDescriptorExtractor
mojoDescriptor.setProjectRequired( true );
}
// ----------------------------------------------------------------------
// Aggregator flag
// ----------------------------------------------------------------------
DocletTag aggregator = findInClassHierarchy( javaClass, GOAL_IS_AGGREGATOR );
if ( aggregator != null )
{
mojoDescriptor.setAggregator( true );
}
// ----------------------------------------------------------------------
// Online flag
// ----------------------------------------------------------------------

View File

@ -0,0 +1,34 @@
package org.apache.maven.script.marmalade.tags;
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed 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.codehaus.marmalade.runtime.MarmaladeExecutionException;
/**
* @author jdcasey Created on Feb 8, 2005
*/
public class AggregatorTag
extends AbstractBooleanValuedBodyTag
{
protected void setValue( Boolean value ) throws MarmaladeExecutionException
{
MetadataTag metadataTag = (MetadataTag) requireParent( MetadataTag.class );
metadataTag.setAggregator( value.booleanValue() );
}
}

View File

@ -0,0 +1,34 @@
package org.apache.maven.script.marmalade.tags;
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed 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.codehaus.marmalade.runtime.MarmaladeExecutionException;
/**
* @author jdcasey Created on Feb 8, 2005
*/
public class ExecuteLifecycleTag
extends AbstractStringValuedBodyTag
{
protected void setValue( String value ) throws MarmaladeExecutionException
{
MetadataTag metadataTag = (MetadataTag) requireParent( MetadataTag.class );
metadataTag.setExecuteLifecycle( value );
}
}

View File

@ -21,14 +21,14 @@ import org.codehaus.marmalade.runtime.MarmaladeExecutionException;
/**
* @author jdcasey Created on Feb 8, 2005
*/
public class LifecyclePhaseTag
public class ExecutePhaseTag
extends AbstractStringValuedBodyTag
{
protected void setValue( String value ) throws MarmaladeExecutionException
{
MetadataTag metadataTag = (MetadataTag) requireParent( MetadataTag.class );
metadataTag.setLifecyclePhase( value );
metadataTag.setExecutePhase( value );
}
}

View File

@ -17,7 +17,6 @@ package org.apache.maven.script.marmalade.tags;
*/
import org.codehaus.marmalade.model.AbstractMarmaladeTag;
import org.codehaus.marmalade.model.MarmaladeTag;
import org.codehaus.marmalade.runtime.MarmaladeExecutionContext;
import org.codehaus.marmalade.runtime.MarmaladeExecutionException;
@ -37,7 +36,7 @@ public class ExecuteTag
{
for ( Iterator it = children().iterator(); it.hasNext(); )
{
MarmaladeTag child = (MarmaladeTag) it.next();
it.next();
}
}

View File

@ -0,0 +1,34 @@
package org.apache.maven.script.marmalade.tags;
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed 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.codehaus.marmalade.runtime.MarmaladeExecutionException;
/**
* @author jdcasey Created on Feb 8, 2005
*/
public class InheritByDefaultTag
extends AbstractBooleanValuedBodyTag
{
protected void setValue( Boolean value ) throws MarmaladeExecutionException
{
MetadataTag metadataTag = (MetadataTag) requireParent( MetadataTag.class );
metadataTag.setInheritByDefault( value.booleanValue() );
}
}

View File

@ -49,10 +49,18 @@ public class MetadataTag
private List parameters = new ArrayList();
private String lifecyclePhase;
private String description;
private boolean aggregator = false;
private boolean inheritByDefault = true;
private boolean requiresOnline;
private String executePhase;
private String executeLifecycle;
protected boolean alwaysProcessChildren()
{
return false;
@ -99,6 +107,16 @@ public class MetadataTag
descriptor.setInstantiationStrategy( instantiationStrategy );
}
if ( notEmpty( executeLifecycle ) )
{
descriptor.setExecuteLifecycle( executeLifecycle );
}
if ( notEmpty( executePhase ) )
{
descriptor.setExecutePhase( executePhase );
}
try
{
descriptor.setParameters( parameters );
@ -110,6 +128,9 @@ public class MetadataTag
descriptor.setDependencyResolutionRequired( requiresDependencyResolution );
descriptor.setProjectRequired( requiresProject );
descriptor.setAggregator( aggregator );
descriptor.setInheritedByDefault( inheritByDefault );
descriptor.setOnlineRequired( requiresOnline );
String basePath = (String) context.getVariable( MarmaladeMojoExecutionDirectives.SCRIPT_BASEPATH_INVAR,
getExpressionEvaluator() );
@ -136,11 +157,6 @@ public class MetadataTag
return test != null && test.trim().length() > 0;
}
public void setLifecyclePhase( String lifecyclePhase )
{
this.lifecyclePhase = lifecyclePhase;
}
public void setGoal( String goal )
{
this.goal = goal;
@ -176,4 +192,29 @@ public class MetadataTag
this.parameters = parameters;
}
public void setAggregator( boolean aggregator )
{
this.aggregator = aggregator;
}
public void setInheritByDefault( boolean inheritByDefault )
{
this.inheritByDefault = inheritByDefault;
}
public void setRequiresOnline( boolean requiresOnline )
{
this.requiresOnline = requiresOnline;
}
public void setExecutePhase( String executePhase )
{
this.executePhase = executePhase;
}
public void setExecuteLifecycle( String executeLifecycle )
{
this.executeLifecycle = executeLifecycle;
}
}

View File

@ -32,13 +32,15 @@ public class MojoDefinitionTagLibrary
registerTag( "executionStrategy", ExecutionStrategyTag.class );
registerTag( "goal", GoalTag.class );
registerTag( "instantiationStrategy", InstantiationStrategyTag.class );
registerTag( "lifecyclePhase", LifecyclePhaseTag.class );
registerTag( "metadata", MetadataTag.class );
registerTag( "mojo", MojoTag.class );
registerTag( "parameters", ParametersTag.class );
registerTag( "parameter", ParameterTag.class );
registerTag( "requiresDependencyResolution", RequiresDependencyResolutionTag.class );
registerTag( "requiresProject", RequiresProjectTag.class );
registerTag( "requiresOnline", RequiresOnlineTag.class );
registerTag( "inheritByDefault", InheritByDefaultTag.class );
registerTag( "aggregator", AggregatorTag.class );
registerTag( "name", ParamNameTag.class );
registerTag( "expression", ParamExpressionTag.class );
registerTag( "type", ParamTypeTag.class );

View File

@ -41,6 +41,8 @@ public class ParameterTag
private boolean required = true;
private String defaultVal;
protected void doExecute( MarmaladeExecutionContext context )
throws MarmaladeExecutionException
{
@ -62,6 +64,7 @@ public class ParameterTag
param.setRequired( required );
param.setType( type );
param.setDeprecated( deprecated );
param.setDefaultValue( defaultVal );
return param;
}
@ -88,6 +91,7 @@ public class ParameterTag
public void setDefault( String defaultVal )
{
this.defaultVal = defaultVal;
}
public void setRequired( boolean required )

View File

@ -0,0 +1,34 @@
package org.apache.maven.script.marmalade.tags;
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed 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.codehaus.marmalade.runtime.MarmaladeExecutionException;
/**
* @author jdcasey Created on Feb 8, 2005
*/
public class RequiresOnlineTag
extends AbstractBooleanValuedBodyTag
{
protected void setValue( Boolean value ) throws MarmaladeExecutionException
{
MetadataTag metadataTag = (MetadataTag) requireParent( MetadataTag.class );
metadataTag.setRequiresOnline( value.booleanValue() );
}
}