mirror of https://github.com/apache/maven.git
formatting
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@542736 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a866905cb4
commit
4c175033e8
|
@ -17,30 +17,30 @@ import java.util.Map;
|
|||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* Responsible for parsing the Maven-2.0.x lifecycle-definition syntaxes. This class is partitioned
|
||||
* from the others, because this syntax should be deprecated and removed from support, eventually.
|
||||
* Responsible for parsing the Maven-2.0.x lifecycle-definition syntaxes. This class is partitioned from the others,
|
||||
* because this syntax should be deprecated and removed from support, eventually.
|
||||
*
|
||||
* @author jdcasey
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class LegacyLifecycleMappingParser
|
||||
{
|
||||
|
||||
public static final String ROLE = LegacyLifecycleMappingParser.class.getName();
|
||||
|
||||
|
||||
private MojoBindingFactory mojoBindingFactory;
|
||||
|
||||
public LifecycleBindings parseDefaultMappings( List lifecycles )
|
||||
public LifecycleBindings parseDefaultMappings( final List lifecycles )
|
||||
throws LifecycleSpecificationException
|
||||
{
|
||||
LifecycleBindings bindings = new LifecycleBindings();
|
||||
|
||||
|
||||
bindings.setPackaging( "unmatched" );
|
||||
|
||||
|
||||
for ( Iterator it = lifecycles.iterator(); it.hasNext(); )
|
||||
{
|
||||
LegacyLifecycle lifecycle = (LegacyLifecycle) it.next();
|
||||
|
||||
|
||||
if ( "clean".equals( lifecycle.getId() ) )
|
||||
{
|
||||
bindings.setCleanBinding( parseCleanBindings( lifecycle.getDefaultPhases(), Collections.EMPTY_LIST ) );
|
||||
|
@ -58,63 +58,95 @@ public class LegacyLifecycleMappingParser
|
|||
throw new LifecycleSpecificationException( "Unrecognized lifecycle: " + lifecycle.getId() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LifecycleUtils.setOrigin( bindings, "default lifecycle" );
|
||||
|
||||
return bindings;
|
||||
}
|
||||
|
||||
public LifecycleBindings parseMappings( LifecycleMapping mapping, String packaging )
|
||||
public LifecycleBindings parseMappings( final LifecycleMapping mapping, final String packaging )
|
||||
throws LifecycleSpecificationException
|
||||
{
|
||||
LifecycleBindings bindings = new LifecycleBindings();
|
||||
bindings.setPackaging( packaging );
|
||||
|
||||
|
||||
bindings.setCleanBinding( parseCleanBindings( mapping.getPhases( "clean" ), mapping.getOptionalMojos( "clean" ) ) );
|
||||
bindings.setBuildBinding( parseBuildBindings( mapping.getPhases( "default" ), mapping.getOptionalMojos( "default" ) ) );
|
||||
|
||||
bindings.setBuildBinding( parseBuildBindings( mapping.getPhases( "default" ),
|
||||
mapping.getOptionalMojos( "default" ) ) );
|
||||
|
||||
bindings.setSiteBinding( parseSiteBindings( mapping.getPhases( "site" ), mapping.getOptionalMojos( "site" ) ) );
|
||||
|
||||
|
||||
LifecycleUtils.setOrigin( bindings, "packaging: " + packaging );
|
||||
|
||||
return bindings;
|
||||
}
|
||||
|
||||
private BuildBinding parseBuildBindings( Map phases, List optionalKeys )
|
||||
|
||||
private BuildBinding parseBuildBindings( final Map phases, final List optionalKeys )
|
||||
throws LifecycleSpecificationException
|
||||
{
|
||||
BuildBinding binding = new BuildBinding();
|
||||
|
||||
|
||||
if ( phases != null )
|
||||
{
|
||||
binding.setValidate( parsePhaseBindings( (String) phases.get( "validate" ), optionalKeys ) );
|
||||
|
||||
binding.setInitialize( parsePhaseBindings( (String) phases.get( "initialize" ), optionalKeys ) );
|
||||
|
||||
binding.setGenerateSources( parsePhaseBindings( (String) phases.get( "generate-sources" ), optionalKeys ) );
|
||||
|
||||
binding.setProcessSources( parsePhaseBindings( (String) phases.get( "process-sources" ), optionalKeys ) );
|
||||
|
||||
binding.setGenerateResources( parsePhaseBindings( (String) phases.get( "generate-resources" ), optionalKeys ) );
|
||||
|
||||
binding.setProcessResources( parsePhaseBindings( (String) phases.get( "process-resources" ), optionalKeys ) );
|
||||
|
||||
binding.setCompile( parsePhaseBindings( (String) phases.get( "compile" ), optionalKeys ) );
|
||||
|
||||
binding.setProcessClasses( parsePhaseBindings( (String) phases.get( "process-classes" ), optionalKeys ) );
|
||||
binding.setGenerateTestSources( parsePhaseBindings( (String) phases.get( "generate-test-sources" ), optionalKeys ) );
|
||||
binding.setProcessTestSources( parsePhaseBindings( (String) phases.get( "process-test-sources" ), optionalKeys ) );
|
||||
binding.setGenerateTestResources( parsePhaseBindings( (String) phases.get( "generate-test-resources" ), optionalKeys ) );
|
||||
binding.setProcessTestResources( parsePhaseBindings( (String) phases.get( "process-test-resources" ), optionalKeys ) );
|
||||
|
||||
binding.setGenerateTestSources( parsePhaseBindings( (String) phases.get( "generate-test-sources" ),
|
||||
optionalKeys ) );
|
||||
|
||||
binding.setProcessTestSources( parsePhaseBindings( (String) phases.get( "process-test-sources" ),
|
||||
optionalKeys ) );
|
||||
|
||||
binding.setGenerateTestResources( parsePhaseBindings( (String) phases.get( "generate-test-resources" ),
|
||||
optionalKeys ) );
|
||||
|
||||
binding.setProcessTestResources( parsePhaseBindings( (String) phases.get( "process-test-resources" ),
|
||||
optionalKeys ) );
|
||||
|
||||
binding.setTestCompile( parsePhaseBindings( (String) phases.get( "test-compile" ), optionalKeys ) );
|
||||
binding.setProcessTestClasses( parsePhaseBindings( (String) phases.get( "process-test-classes" ), optionalKeys ) );
|
||||
|
||||
binding.setProcessTestClasses( parsePhaseBindings( (String) phases.get( "process-test-classes" ),
|
||||
optionalKeys ) );
|
||||
|
||||
binding.setTest( parsePhaseBindings( (String) phases.get( "test" ), optionalKeys ) );
|
||||
|
||||
binding.setPreparePackage( parsePhaseBindings( (String) phases.get( "prepare-package" ), optionalKeys ) );
|
||||
|
||||
binding.setCreatePackage( parsePhaseBindings( (String) phases.get( "package" ), optionalKeys ) );
|
||||
binding.setPreIntegrationTest( parsePhaseBindings( (String) phases.get( "pre-integration-test" ), optionalKeys ) );
|
||||
|
||||
binding.setPreIntegrationTest( parsePhaseBindings( (String) phases.get( "pre-integration-test" ),
|
||||
optionalKeys ) );
|
||||
|
||||
binding.setIntegrationTest( parsePhaseBindings( (String) phases.get( "integration-test" ), optionalKeys ) );
|
||||
binding.setPostIntegrationTest( parsePhaseBindings( (String) phases.get( "post-integration-test" ), optionalKeys ) );
|
||||
|
||||
binding.setPostIntegrationTest( parsePhaseBindings( (String) phases.get( "post-integration-test" ),
|
||||
optionalKeys ) );
|
||||
|
||||
binding.setVerify( parsePhaseBindings( (String) phases.get( "verify" ), optionalKeys ) );
|
||||
|
||||
binding.setInstall( parsePhaseBindings( (String) phases.get( "install" ), optionalKeys ) );
|
||||
|
||||
binding.setDeploy( parsePhaseBindings( (String) phases.get( "deploy" ), optionalKeys ) );
|
||||
}
|
||||
|
||||
return binding;
|
||||
}
|
||||
|
||||
private CleanBinding parseCleanBindings( Map phaseMappings, List optionalKeys )
|
||||
private CleanBinding parseCleanBindings( final Map phaseMappings, final List optionalKeys )
|
||||
throws LifecycleSpecificationException
|
||||
{
|
||||
CleanBinding binding = new CleanBinding();
|
||||
|
@ -122,14 +154,16 @@ public class LegacyLifecycleMappingParser
|
|||
if ( phaseMappings != null )
|
||||
{
|
||||
binding.setPreClean( parsePhaseBindings( (String) phaseMappings.get( "pre-clean" ), optionalKeys ) );
|
||||
|
||||
binding.setClean( parsePhaseBindings( (String) phaseMappings.get( "clean" ), optionalKeys ) );
|
||||
|
||||
binding.setPostClean( parsePhaseBindings( (String) phaseMappings.get( "post-clean" ), optionalKeys ) );
|
||||
}
|
||||
|
||||
return binding;
|
||||
}
|
||||
|
||||
private Phase parsePhaseBindings( String bindingList, List optionalKeys )
|
||||
private Phase parsePhaseBindings( final String bindingList, final List optionalKeys )
|
||||
throws LifecycleSpecificationException
|
||||
{
|
||||
Phase phase = new Phase();
|
||||
|
@ -141,7 +175,7 @@ public class LegacyLifecycleMappingParser
|
|||
String rawBinding = tok.nextToken().trim();
|
||||
|
||||
MojoBinding binding = mojoBindingFactory.parseMojoBinding( rawBinding );
|
||||
if ( optionalKeys != null && optionalKeys.contains( rawBinding ) )
|
||||
if ( ( optionalKeys != null ) && optionalKeys.contains( rawBinding ) )
|
||||
{
|
||||
binding.setOptional( true );
|
||||
}
|
||||
|
@ -158,7 +192,7 @@ public class LegacyLifecycleMappingParser
|
|||
return phase;
|
||||
}
|
||||
|
||||
private SiteBinding parseSiteBindings( Map phases, List optionalKeys )
|
||||
private SiteBinding parseSiteBindings( final Map phases, final List optionalKeys )
|
||||
throws LifecycleSpecificationException
|
||||
{
|
||||
SiteBinding binding = new SiteBinding();
|
||||
|
@ -166,8 +200,11 @@ public class LegacyLifecycleMappingParser
|
|||
if ( phases != null )
|
||||
{
|
||||
binding.setPreSite( parsePhaseBindings( (String) phases.get( "pre-site" ), optionalKeys ) );
|
||||
|
||||
binding.setSite( parsePhaseBindings( (String) phases.get( "site" ), optionalKeys ) );
|
||||
|
||||
binding.setPostSite( parsePhaseBindings( (String) phases.get( "post-site" ), optionalKeys ) );
|
||||
|
||||
binding.setSiteDeploy( parsePhaseBindings( (String) phases.get( "site-deploy" ), optionalKeys ) );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue