Cleanup up some methods. Removed mixins from interfaces.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@746288 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Britton Isbell 2009-02-20 16:33:41 +00:00
parent ec84760e04
commit dd676fd685
5 changed files with 33 additions and 95 deletions

View File

@ -94,7 +94,6 @@ public class PomTransformer
ProjectUri.Build.PluginManagement.Plugins.Plugin.Executions.Execution.Goals.xURI,
ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.xUri,
ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.Dependency.Exclusions.xUri,
ProjectUri.Build.Plugins.xUri,
ProjectUri.Build.Plugins.Plugin.configuration,
ProjectUri.Reporting.Plugins.xUri,
@ -104,26 +103,17 @@ public class PomTransformer
ProjectUri.Build.Resources.Resource.includes,
ProjectUri.Build.Resources.Resource.excludes,
ProjectUri.Build.TestResources.xUri,
ProjectUri.Build.Filters.xUri,
ProjectUri.CiManagement.Notifiers.xUri,
ProjectUri.Contributors.xUri,
ProjectUri.Dependencies.xUri,
// ProjectUri.Dependencies.Dependency.Exclusions.xUri,
ProjectUri.DependencyManagement.Dependencies.xUri,
// ProjectUri.DependencyManagement.Dependencies.Dependency.Exclusions.xUri,
ProjectUri.Developers.xUri,
ProjectUri.Developers.Developer.roles,
ProjectUri.Licenses.xUri,
ProjectUri.MailingLists.xUri,
ProjectUri.Modules.xUri,
ProjectUri.PluginRepositories.xUri,
ProjectUri.Profiles.xUri,
ProjectUri.Profiles.Profile.Build.Plugins.xUri,
ProjectUri.Profiles.Profile.Build.Plugins.Plugin.Dependencies.xUri,
@ -131,23 +121,13 @@ public class PomTransformer
ProjectUri.Profiles.Profile.Build.Resources.xUri,
ProjectUri.Profiles.Profile.Build.TestResources.xUri,
ProjectUri.Profiles.Profile.Dependencies.xUri,
// ProjectUri.Profiles.Profile.Dependencies.Dependency.Exclusions.xUri,
ProjectUri.Profiles.Profile.DependencyManagement.Dependencies.xUri,
// ProjectUri.Profiles.Profile.DependencyManagement.Dependencies.Dependency.Exclusions.xUri,
ProjectUri.Profiles.Profile.PluginRepositories.xUri,
ProjectUri.Profiles.Profile.Reporting.Plugins.xUri,
//ProjectUri.Profiles.Profile.Reporting.Plugins.Plugin.ReportSets.xUri,
ProjectUri.Profiles.Profile.Repositories.xUri,
ProjectUri.Profiles.Profile.Build.PluginManagement.Plugins.xUri,
// ProjectUri.Profiles.Profile.Build.PluginManagement.Plugins.Plugin.Executions.xUri,
// ProjectUri.Profiles.Profile.Build.PluginManagement.Plugins.Plugin.Executions.Execution.Goals.xURI,
ProjectUri.Profiles.Profile.Build.PluginManagement.Plugins.Plugin.Dependencies.xUri,
// ProjectUri.Profiles.Profile.Build.PluginManagement.Plugins.Plugin.Dependencies.Dependency.Exclusions.xUri,
ProjectUri.Reporting.Plugins.xUri,
//ProjectUri.Reporting.Plugins.Plugin.ReportSets.xUri,
ProjectUri.Repositories.xUri) ));
/**

View File

@ -39,7 +39,6 @@ import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.model.Build;
import org.apache.maven.model.Model;
import org.apache.maven.model.Profile;
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.apache.maven.profiles.MavenProfilesBuilder;
import org.apache.maven.profiles.ProfileManager;
import org.apache.maven.profiles.activation.DefaultProfileActivationContext;
@ -56,7 +55,6 @@ import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.LogEnabled;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.WriterFactory;
/**
@ -281,11 +279,6 @@ public class DefaultMavenProjectBuilder
this.logger = logger;
}
private Logger getLogger()
{
return logger;
}
private MavenProject buildWithProfiles( Model model, ProjectBuilderConfiguration config, File projectDescriptor,
File parentDescriptor, boolean isReactorProject )
throws ProjectBuildingException
@ -351,30 +344,6 @@ public class DefaultMavenProjectBuilder
return project;
}
private MavenProject superProject;
private MavenProject getSuperProject( ProjectBuilderConfiguration config, File projectDescriptor )
{
if ( superProject != null )
{
return superProject;
}
Model model = projectBuilder.getSuperModel();
try
{
superProject = new MavenProject( model, artifactFactory, mavenTools, this, config );
}
catch ( InvalidRepositoryException e )
{
// Not going to happen as this exception is thrown when checking distributionManagement and the super pom
// doesn't have a distributionManagement section.
}
return superProject;
}
private MavenProject readModelFromLocalPath( String projectId, File projectDescriptor, PomArtifactResolver resolver, ProjectBuilderConfiguration config )
throws ProjectBuildingException
{
@ -402,9 +371,8 @@ public class DefaultMavenProjectBuilder
try
{
mavenProject = projectBuilder.buildFromLocalPath( projectDescriptor,
null,
interpolatorProperties,
mavenProject = projectBuilder.buildFromLocalPath( projectDescriptor,
interpolatorProperties,
resolver,
config,
this);

View File

@ -36,7 +36,6 @@ import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.apache.maven.project.*;
import org.apache.maven.project.builder.*;
import org.apache.maven.project.builder.ProjectUri;
import org.apache.maven.project.builder.profile.ProfileContext;
@ -147,19 +146,18 @@ public class DefaultProjectBuilder
}
}
public PomClassicDomainModel buildModel( File pom,
public PomClassicDomainModel buildModel( File pom,
Collection<InterpolatorProperty> interpolatorProperties,
PomArtifactResolver resolver )
throws IOException
{
return buildModel( pom, null, interpolatorProperties, null, null, resolver );
return buildModel( pom, interpolatorProperties, null, null, resolver );
}
private PomClassicDomainModel buildModel(File pom,
List<Model> mixins,
Collection<InterpolatorProperty> interpolatorProperties,
Collection<String> activeProfileIds, Collection<String> inactiveProfileIds,
PomArtifactResolver resolver )
PomArtifactResolver resolver)
throws IOException
{
if ( pom == null )
@ -172,17 +170,6 @@ public class DefaultProjectBuilder
throw new IllegalArgumentException( "resolver: null" );
}
if ( mixins == null )
{
mixins = new ArrayList<Model>();
mixins.add( getSuperModel() );
}
else
{
mixins = new ArrayList<Model>( mixins );
Collections.reverse( mixins );
}
if(activeProfileIds == null)
{
activeProfileIds = new ArrayList<String>();
@ -258,11 +245,8 @@ public class DefaultProjectBuilder
domainModels.addAll( mavenParents );
}
for ( Model model : mixins )
{
domainModels.add( convertToDomainModel( model ) );
}
domainModels.add( convertToDomainModel( getSuperModel() ) );
PomTransformer transformer = new PomTransformer( new PomClassicDomainModelFactory() );
ModelTransformerContext ctx = new ModelTransformerContext(PomTransformer.MODEL_CONTAINER_INFOS );
@ -282,7 +266,7 @@ public class DefaultProjectBuilder
private PomClassicDomainModel convertToDomainModel(Model model) throws IOException
{
if ( model == null )
if ( model == null )
{
throw new IllegalArgumentException( "model: null" );
}
@ -304,12 +288,11 @@ public class DefaultProjectBuilder
return new PomClassicDomainModel(new ByteArrayInputStream(baos.toByteArray()));
}
public MavenProject buildFromLocalPath( File pom,
List<Model> mixins,
Collection<InterpolatorProperty> interpolatorProperties,
PomArtifactResolver resolver,
ProjectBuilderConfiguration projectBuilderConfiguration,
MavenProjectBuilder mavenProjectBuilder)
public MavenProject buildFromLocalPath(File pom,
Collection<InterpolatorProperty> interpolatorProperties,
PomArtifactResolver resolver,
ProjectBuilderConfiguration projectBuilderConfiguration,
MavenProjectBuilder mavenProjectBuilder)
throws IOException
{
@ -323,9 +306,8 @@ public class DefaultProjectBuilder
projectBuilderConfiguration.getGlobalProfileManager().getProfileActivationContext() != null ) ?
projectBuilderConfiguration.getGlobalProfileManager().getProfileActivationContext().getExplicitlyInactiveProfileIds() : new ArrayList<String>();
PomClassicDomainModel domainModel = buildModel( pom,
mixins,
interpolatorProperties,
PomClassicDomainModel domainModel = buildModel( pom,
interpolatorProperties,
activeProfileIds, inactiveProfileIds,
resolver );
@ -472,8 +454,6 @@ public class DefaultProjectBuilder
return domainModels;
}
// Model model = domainModel.getModel();
File parentFile = new File( projectDirectory, domainModel.getRelativePathOfParent() ).getCanonicalFile();
if ( parentFile.isDirectory() )
{
@ -554,6 +534,18 @@ public class DefaultProjectBuilder
this.logger = logger;
}
private DomainModel superDomainModel;
private DomainModel getSuperDomainModel()
throws IOException
{
if( superDomainModel == null )
{
superDomainModel = convertToDomainModel( getSuperModel() );
}
return superDomainModel;
}
// Super Model Handling
private static final String MAVEN_MODEL_VERSION = "4.0.0";

View File

@ -42,19 +42,17 @@ public interface ProjectBuilder
* Returns a maven project for the specified input stream.
*
* @param pom input stream of the model
* @param mixins list of models containing additional parent models in order from most to least specialized
* @param interpolatorProperties properties used for interpolation of properties within the model
* @param resolver artifact resolver used in resolving artifacts
* @param projectBuilderConfiguration
* @return a maven project for the specified input stream
* @throws IOException if there is a problem in the construction of the maven project
*/
MavenProject buildFromLocalPath( File pom,
List<Model> mixins,
Collection<InterpolatorProperty> interpolatorProperties,
PomArtifactResolver resolver,
ProjectBuilderConfiguration projectBuilderConfiguration,
MavenProjectBuilder mavenProjectBuilder)
MavenProject buildFromLocalPath(File pom,
Collection<InterpolatorProperty> interpolatorProperties,
PomArtifactResolver resolver,
ProjectBuilderConfiguration projectBuilderConfiguration,
MavenProjectBuilder mavenProjectBuilder)
throws IOException;
Model getSuperModel();

View File

@ -900,7 +900,7 @@ public class PomConstructionTest
}
config.setGlobalProfileManager(new DefaultProfileManager(this.getContainer(), pCtx));
return new PomTestWrapper( pomFile, projectBuilder.buildFromLocalPath( pomFile, null, null, pomArtifactResolver,
return new PomTestWrapper( pomFile, projectBuilder.buildFromLocalPath( pomFile, null, pomArtifactResolver,
config, mavenProjectBuilder ) );
}