formatting

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@542736 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2007-05-30 03:02:03 +00:00
parent a866905cb4
commit 4c175033e8
1 changed files with 64 additions and 27 deletions

View File

@ -17,8 +17,8 @@ import java.util.Map;
import java.util.StringTokenizer; import java.util.StringTokenizer;
/** /**
* Responsible for parsing the Maven-2.0.x lifecycle-definition syntaxes. This class is partitioned * Responsible for parsing the Maven-2.0.x lifecycle-definition syntaxes. This class is partitioned from the others,
* from the others, because this syntax should be deprecated and removed from support, eventually. * because this syntax should be deprecated and removed from support, eventually.
* *
* @author jdcasey * @author jdcasey
* *
@ -30,7 +30,7 @@ public class LegacyLifecycleMappingParser
private MojoBindingFactory mojoBindingFactory; private MojoBindingFactory mojoBindingFactory;
public LifecycleBindings parseDefaultMappings( List lifecycles ) public LifecycleBindings parseDefaultMappings( final List lifecycles )
throws LifecycleSpecificationException throws LifecycleSpecificationException
{ {
LifecycleBindings bindings = new LifecycleBindings(); LifecycleBindings bindings = new LifecycleBindings();
@ -64,14 +64,17 @@ public class LegacyLifecycleMappingParser
return bindings; return bindings;
} }
public LifecycleBindings parseMappings( LifecycleMapping mapping, String packaging ) public LifecycleBindings parseMappings( final LifecycleMapping mapping, final String packaging )
throws LifecycleSpecificationException throws LifecycleSpecificationException
{ {
LifecycleBindings bindings = new LifecycleBindings(); LifecycleBindings bindings = new LifecycleBindings();
bindings.setPackaging( packaging ); bindings.setPackaging( packaging );
bindings.setCleanBinding( parseCleanBindings( mapping.getPhases( "clean" ), mapping.getOptionalMojos( "clean" ) ) ); 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" ) ) ); bindings.setSiteBinding( parseSiteBindings( mapping.getPhases( "site" ), mapping.getOptionalMojos( "site" ) ) );
LifecycleUtils.setOrigin( bindings, "packaging: " + packaging ); LifecycleUtils.setOrigin( bindings, "packaging: " + packaging );
@ -79,7 +82,7 @@ public class LegacyLifecycleMappingParser
return bindings; return bindings;
} }
private BuildBinding parseBuildBindings( Map phases, List optionalKeys ) private BuildBinding parseBuildBindings( final Map phases, final List optionalKeys )
throws LifecycleSpecificationException throws LifecycleSpecificationException
{ {
BuildBinding binding = new BuildBinding(); BuildBinding binding = new BuildBinding();
@ -87,34 +90,63 @@ public class LegacyLifecycleMappingParser
if ( phases != null ) if ( phases != null )
{ {
binding.setValidate( parsePhaseBindings( (String) phases.get( "validate" ), optionalKeys ) ); binding.setValidate( parsePhaseBindings( (String) phases.get( "validate" ), optionalKeys ) );
binding.setInitialize( parsePhaseBindings( (String) phases.get( "initialize" ), optionalKeys ) ); binding.setInitialize( parsePhaseBindings( (String) phases.get( "initialize" ), optionalKeys ) );
binding.setGenerateSources( parsePhaseBindings( (String) phases.get( "generate-sources" ), optionalKeys ) ); binding.setGenerateSources( parsePhaseBindings( (String) phases.get( "generate-sources" ), optionalKeys ) );
binding.setProcessSources( parsePhaseBindings( (String) phases.get( "process-sources" ), optionalKeys ) ); binding.setProcessSources( parsePhaseBindings( (String) phases.get( "process-sources" ), optionalKeys ) );
binding.setGenerateResources( parsePhaseBindings( (String) phases.get( "generate-resources" ), optionalKeys ) ); binding.setGenerateResources( parsePhaseBindings( (String) phases.get( "generate-resources" ), optionalKeys ) );
binding.setProcessResources( parsePhaseBindings( (String) phases.get( "process-resources" ), optionalKeys ) ); binding.setProcessResources( parsePhaseBindings( (String) phases.get( "process-resources" ), optionalKeys ) );
binding.setCompile( parsePhaseBindings( (String) phases.get( "compile" ), optionalKeys ) ); binding.setCompile( parsePhaseBindings( (String) phases.get( "compile" ), optionalKeys ) );
binding.setProcessClasses( parsePhaseBindings( (String) phases.get( "process-classes" ), 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.setGenerateTestSources( parsePhaseBindings( (String) phases.get( "generate-test-sources" ),
binding.setGenerateTestResources( parsePhaseBindings( (String) phases.get( "generate-test-resources" ), optionalKeys ) ); optionalKeys ) );
binding.setProcessTestResources( parsePhaseBindings( (String) phases.get( "process-test-resources" ), 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.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.setTest( parsePhaseBindings( (String) phases.get( "test" ), optionalKeys ) );
binding.setPreparePackage( parsePhaseBindings( (String) phases.get( "prepare-package" ), optionalKeys ) ); binding.setPreparePackage( parsePhaseBindings( (String) phases.get( "prepare-package" ), optionalKeys ) );
binding.setCreatePackage( parsePhaseBindings( (String) phases.get( "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.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.setVerify( parsePhaseBindings( (String) phases.get( "verify" ), optionalKeys ) );
binding.setInstall( parsePhaseBindings( (String) phases.get( "install" ), optionalKeys ) ); binding.setInstall( parsePhaseBindings( (String) phases.get( "install" ), optionalKeys ) );
binding.setDeploy( parsePhaseBindings( (String) phases.get( "deploy" ), optionalKeys ) ); binding.setDeploy( parsePhaseBindings( (String) phases.get( "deploy" ), optionalKeys ) );
} }
return binding; return binding;
} }
private CleanBinding parseCleanBindings( Map phaseMappings, List optionalKeys ) private CleanBinding parseCleanBindings( final Map phaseMappings, final List optionalKeys )
throws LifecycleSpecificationException throws LifecycleSpecificationException
{ {
CleanBinding binding = new CleanBinding(); CleanBinding binding = new CleanBinding();
@ -122,14 +154,16 @@ public class LegacyLifecycleMappingParser
if ( phaseMappings != null ) if ( phaseMappings != null )
{ {
binding.setPreClean( parsePhaseBindings( (String) phaseMappings.get( "pre-clean" ), optionalKeys ) ); binding.setPreClean( parsePhaseBindings( (String) phaseMappings.get( "pre-clean" ), optionalKeys ) );
binding.setClean( parsePhaseBindings( (String) phaseMappings.get( "clean" ), optionalKeys ) ); binding.setClean( parsePhaseBindings( (String) phaseMappings.get( "clean" ), optionalKeys ) );
binding.setPostClean( parsePhaseBindings( (String) phaseMappings.get( "post-clean" ), optionalKeys ) ); binding.setPostClean( parsePhaseBindings( (String) phaseMappings.get( "post-clean" ), optionalKeys ) );
} }
return binding; return binding;
} }
private Phase parsePhaseBindings( String bindingList, List optionalKeys ) private Phase parsePhaseBindings( final String bindingList, final List optionalKeys )
throws LifecycleSpecificationException throws LifecycleSpecificationException
{ {
Phase phase = new Phase(); Phase phase = new Phase();
@ -141,7 +175,7 @@ public class LegacyLifecycleMappingParser
String rawBinding = tok.nextToken().trim(); String rawBinding = tok.nextToken().trim();
MojoBinding binding = mojoBindingFactory.parseMojoBinding( rawBinding ); MojoBinding binding = mojoBindingFactory.parseMojoBinding( rawBinding );
if ( optionalKeys != null && optionalKeys.contains( rawBinding ) ) if ( ( optionalKeys != null ) && optionalKeys.contains( rawBinding ) )
{ {
binding.setOptional( true ); binding.setOptional( true );
} }
@ -158,7 +192,7 @@ public class LegacyLifecycleMappingParser
return phase; return phase;
} }
private SiteBinding parseSiteBindings( Map phases, List optionalKeys ) private SiteBinding parseSiteBindings( final Map phases, final List optionalKeys )
throws LifecycleSpecificationException throws LifecycleSpecificationException
{ {
SiteBinding binding = new SiteBinding(); SiteBinding binding = new SiteBinding();
@ -166,8 +200,11 @@ public class LegacyLifecycleMappingParser
if ( phases != null ) if ( phases != null )
{ {
binding.setPreSite( parsePhaseBindings( (String) phases.get( "pre-site" ), optionalKeys ) ); binding.setPreSite( parsePhaseBindings( (String) phases.get( "pre-site" ), optionalKeys ) );
binding.setSite( parsePhaseBindings( (String) phases.get( "site" ), optionalKeys ) ); binding.setSite( parsePhaseBindings( (String) phases.get( "site" ), optionalKeys ) );
binding.setPostSite( parsePhaseBindings( (String) phases.get( "post-site" ), optionalKeys ) ); binding.setPostSite( parsePhaseBindings( (String) phases.get( "post-site" ), optionalKeys ) );
binding.setSiteDeploy( parsePhaseBindings( (String) phases.get( "site-deploy" ), optionalKeys ) ); binding.setSiteDeploy( parsePhaseBindings( (String) phases.get( "site-deploy" ), optionalKeys ) );
} }