mirror of https://github.com/apache/maven.git
o Refactoring: Moved one incorrectly placed method from BuildListCalculator to TaskSegmentCalculator
This method was creating a lot of strange internal dependencies since it was mis-placed git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@935741 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b329fdb4e5
commit
2339e16750
|
@ -126,7 +126,7 @@ public class DefaultLifecycleExecutor
|
|||
boolean isThreaded = executionRequest.isThreadConfigurationPresent();
|
||||
session.setParallel( isThreaded );
|
||||
|
||||
List<TaskSegment> taskSegments = buildListCalculator.calculateTaskSegments( session );
|
||||
List<TaskSegment> taskSegments = lifecycleTaskSegmentCalculator.calculateTaskSegments( session );
|
||||
|
||||
ProjectBuildList projectBuilds = buildListCalculator.calculateProjectBuilds( session, taskSegments );
|
||||
|
||||
|
@ -285,7 +285,7 @@ public class DefaultLifecycleExecutor
|
|||
PluginVersionResolutionException
|
||||
{
|
||||
|
||||
List<TaskSegment> taskSegments = buildListCalculator.calculateTaskSegments( session );
|
||||
List<TaskSegment> taskSegments = lifecycleTaskSegmentCalculator.calculateTaskSegments( session );
|
||||
|
||||
TaskSegment mergedSegment = new TaskSegment( false );
|
||||
|
||||
|
|
|
@ -15,18 +15,10 @@
|
|||
package org.apache.maven.lifecycle.internal;
|
||||
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.lifecycle.LifecycleNotFoundException;
|
||||
import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException;
|
||||
import org.apache.maven.plugin.*;
|
||||
import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
|
||||
import org.apache.maven.plugin.version.PluginVersionResolutionException;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.component.annotations.Requirement;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -37,40 +29,6 @@ import java.util.List;
|
|||
@Component( role = BuildListCalculator.class )
|
||||
public class BuildListCalculator
|
||||
{
|
||||
@Requirement
|
||||
private LifecycleTaskSegmentCalculator lifeCycleTaskSegmentCalculator;
|
||||
|
||||
@SuppressWarnings({"UnusedDeclaration"})
|
||||
public BuildListCalculator()
|
||||
{
|
||||
}
|
||||
|
||||
public BuildListCalculator( LifecycleTaskSegmentCalculator lifeCycleTaskSegmentCalculator )
|
||||
{
|
||||
this.lifeCycleTaskSegmentCalculator = lifeCycleTaskSegmentCalculator;
|
||||
}
|
||||
|
||||
public List<TaskSegment> calculateTaskSegments( MavenSession session )
|
||||
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
|
||||
MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||
PluginVersionResolutionException, LifecyclePhaseNotFoundException, LifecycleNotFoundException
|
||||
{
|
||||
|
||||
MavenProject rootProject = session.getTopLevelProject();
|
||||
|
||||
List<String> tasks = session.getGoals();
|
||||
|
||||
if ( tasks == null || tasks.isEmpty() )
|
||||
{
|
||||
if ( !StringUtils.isEmpty( rootProject.getDefaultGoal() ) )
|
||||
{
|
||||
tasks = Arrays.asList( StringUtils.split( rootProject.getDefaultGoal() ) );
|
||||
}
|
||||
}
|
||||
|
||||
return lifeCycleTaskSegmentCalculator.calculateTaskSegments( session, tasks );
|
||||
}
|
||||
|
||||
public ProjectBuildList calculateProjectBuilds( MavenSession session, List<TaskSegment> taskSegments )
|
||||
{
|
||||
List<ProjectSegment> projectBuilds = new ArrayList<ProjectSegment>();
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
package org.apache.maven.lifecycle.internal;
|
||||
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.lifecycle.LifecycleNotFoundException;
|
||||
import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException;
|
||||
import org.apache.maven.plugin.*;
|
||||
import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
|
||||
import org.apache.maven.plugin.version.PluginVersionResolutionException;
|
||||
|
@ -34,10 +36,10 @@ import java.util.List;
|
|||
|
||||
public interface LifecycleTaskSegmentCalculator
|
||||
{
|
||||
List<TaskSegment> calculateTaskSegments( MavenSession session, List<String> tasks )
|
||||
public List<TaskSegment> calculateTaskSegments( MavenSession session )
|
||||
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
|
||||
MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||
PluginVersionResolutionException;
|
||||
PluginVersionResolutionException, LifecyclePhaseNotFoundException, LifecycleNotFoundException;
|
||||
|
||||
public boolean requiresProject( MavenSession session );
|
||||
|
||||
|
|
|
@ -15,14 +15,23 @@
|
|||
package org.apache.maven.lifecycle.internal;
|
||||
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.plugin.*;
|
||||
import org.apache.maven.lifecycle.LifecycleNotFoundException;
|
||||
import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException;
|
||||
import org.apache.maven.plugin.InvalidPluginDescriptorException;
|
||||
import org.apache.maven.plugin.MojoNotFoundException;
|
||||
import org.apache.maven.plugin.PluginDescriptorParsingException;
|
||||
import org.apache.maven.plugin.PluginNotFoundException;
|
||||
import org.apache.maven.plugin.PluginResolutionException;
|
||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||
import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
|
||||
import org.apache.maven.plugin.version.PluginVersionResolutionException;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.component.annotations.Requirement;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -50,6 +59,27 @@ public class LifecycleTaskSegmentCalculatorImpl
|
|||
{
|
||||
}
|
||||
|
||||
public List<TaskSegment> calculateTaskSegments( MavenSession session )
|
||||
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
|
||||
MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||
PluginVersionResolutionException, LifecyclePhaseNotFoundException, LifecycleNotFoundException
|
||||
{
|
||||
|
||||
MavenProject rootProject = session.getTopLevelProject();
|
||||
|
||||
List<String> tasks = session.getGoals();
|
||||
|
||||
if ( tasks == null || tasks.isEmpty() )
|
||||
{
|
||||
if ( !StringUtils.isEmpty( rootProject.getDefaultGoal() ) )
|
||||
{
|
||||
tasks = Arrays.asList( StringUtils.split( rootProject.getDefaultGoal() ) );
|
||||
}
|
||||
}
|
||||
|
||||
return calculateTaskSegments( session, tasks );
|
||||
}
|
||||
|
||||
public List<TaskSegment> calculateTaskSegments( MavenSession session, List<String> tasks )
|
||||
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
|
||||
MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||
|
|
|
@ -105,12 +105,13 @@ public class LifecycleWeaveBuilder
|
|||
for ( TaskSegment taskSegment : taskSegments )
|
||||
{
|
||||
ProjectBuildList segmentChunks = projectBuilds.getByTaskSegment( taskSegment );
|
||||
ThreadOutputMuxer muxer = null; // new ThreadOutputMuxer( segmentChunks, System.out );
|
||||
Set<String> projectArtifacts = new HashSet<String>();
|
||||
Set<Artifact> projectArtifactsA = new HashSet<Artifact>();
|
||||
for (ProjectSegment segmentChunk : segmentChunks) {
|
||||
for ( ProjectSegment segmentChunk : segmentChunks )
|
||||
{
|
||||
Artifact artifact = segmentChunk.getProject().getArtifact();
|
||||
if (artifact != null) {
|
||||
if ( artifact != null )
|
||||
{
|
||||
projectArtifacts.add( ArtifactUtils.key( artifact ) );
|
||||
projectArtifactsA.add( artifact );
|
||||
}
|
||||
|
@ -122,9 +123,11 @@ public class LifecycleWeaveBuilder
|
|||
MavenExecutionPlan executionPlan =
|
||||
builderCommon.resolveBuildPlan( projectBuild.getSession(), projectBuild.getProject(),
|
||||
projectBuild.getTaskSegment(), projectArtifactsA );
|
||||
for (Artifact dependency : projectBuild.getProject().getDependencyArtifacts()) {
|
||||
for ( Artifact dependency : projectBuild.getProject().getDependencyArtifacts() )
|
||||
{
|
||||
String s = ArtifactUtils.key( dependency );
|
||||
if ( projectArtifacts.contains(s)){
|
||||
if ( projectArtifacts.contains( s ) )
|
||||
{
|
||||
dependency.setFile( null );
|
||||
dependency.setResolved( false );
|
||||
dependency.setRepository( null );
|
||||
|
@ -137,9 +140,8 @@ public class LifecycleWeaveBuilder
|
|||
|
||||
final Callable<ProjectSegment> projectBuilder =
|
||||
createCallableForBuildingOneFullModule( buildContext, session, reactorBuildStatus,
|
||||
executionPlan, projectBuild, muxer,
|
||||
dependencyContext, concurrentBuildLogger,
|
||||
projectBuilds );
|
||||
executionPlan, projectBuild, dependencyContext,
|
||||
concurrentBuildLogger );
|
||||
|
||||
futures.add( service.submit( projectBuilder ) );
|
||||
}
|
||||
|
@ -169,10 +171,8 @@ public class LifecycleWeaveBuilder
|
|||
final ReactorBuildStatus reactorBuildStatus,
|
||||
final MavenExecutionPlan executionPlan,
|
||||
final ProjectSegment projectBuild,
|
||||
final ThreadOutputMuxer muxer,
|
||||
final DependencyContext dependencyContext,
|
||||
final ConcurrentBuildLogger concurrentBuildLogger,
|
||||
final ProjectBuildList projectBuilds )
|
||||
final ConcurrentBuildLogger concurrentBuildLogger )
|
||||
{
|
||||
return new Callable<ProjectSegment>()
|
||||
{
|
||||
|
@ -203,7 +203,8 @@ public class LifecycleWeaveBuilder
|
|||
concurrentBuildLogger.createBuildLogItem( projectBuild.getProject(), current );
|
||||
final Schedule schedule = current.getSchedule();
|
||||
|
||||
buildExecutionPlanItem(current, phaseRecorder, schedule, reactorContext, projectBuild, dependencyContext);
|
||||
buildExecutionPlanItem( current, phaseRecorder, schedule, reactorContext, projectBuild,
|
||||
dependencyContext );
|
||||
|
||||
current.setComplete();
|
||||
builtLogItem.setComplete();
|
||||
|
@ -215,7 +216,8 @@ public class LifecycleWeaveBuilder
|
|||
final Schedule scheduleOfNext = nextPlanItem.getSchedule();
|
||||
if ( scheduleOfNext == null || !scheduleOfNext.isParallel() )
|
||||
{
|
||||
waitForAppropriateUpstreamExecutionsToFinish(builtLogItem, nextPlanItem, projectBuild);
|
||||
waitForAppropriateUpstreamExecutionsToFinish( builtLogItem, nextPlanItem,
|
||||
projectBuild );
|
||||
}
|
||||
reResolveReactorDependencies( nextPlanItem, projectBuild );
|
||||
}
|
||||
|
@ -247,7 +249,8 @@ public class LifecycleWeaveBuilder
|
|||
};
|
||||
}
|
||||
|
||||
private void reResolveReactorDependencies(ExecutionPlanItem nextPlanItem, ProjectSegment projectBuild) {
|
||||
private void reResolveReactorDependencies( ExecutionPlanItem nextPlanItem, ProjectSegment projectBuild )
|
||||
{
|
||||
if ( requiresReResolutionOfUpstreamReactorArtifacts( nextPlanItem ) )
|
||||
{
|
||||
reresolveUpstreamProjectArtifacts( projectBuild );
|
||||
|
@ -258,7 +261,11 @@ public class LifecycleWeaveBuilder
|
|||
}
|
||||
}
|
||||
|
||||
private void waitForAppropriateUpstreamExecutionsToFinish(BuildLogItem builtLogItem, ExecutionPlanItem nextPlanItem, ProjectSegment projectBuild) throws InterruptedException {
|
||||
private void waitForAppropriateUpstreamExecutionsToFinish( BuildLogItem builtLogItem,
|
||||
ExecutionPlanItem nextPlanItem,
|
||||
ProjectSegment projectBuild )
|
||||
throws InterruptedException
|
||||
{
|
||||
for ( MavenProject upstreamProject : projectBuild.getImmediateUpstreamProjects() )
|
||||
{
|
||||
final MavenExecutionPlan upstreamPlan = executionPlans.get( upstreamProject );
|
||||
|
@ -286,11 +293,14 @@ public class LifecycleWeaveBuilder
|
|||
}
|
||||
}
|
||||
|
||||
private void reresolveUpstreamProjectArtifacts(ProjectSegment projectBuild) {
|
||||
for ( MavenProject upstreamProject : projectBuild.getTransitiveUpstreamProjects() ){
|
||||
private void reresolveUpstreamProjectArtifacts( ProjectSegment projectBuild )
|
||||
{
|
||||
for ( MavenProject upstreamProject : projectBuild.getTransitiveUpstreamProjects() )
|
||||
{
|
||||
Artifact upStreamArtifact = upstreamProject.getArtifact();
|
||||
Artifact dependencyArtifact = findDependency( projectBuild.getProject(), upStreamArtifact );
|
||||
if (dependencyArtifact != null){
|
||||
if ( dependencyArtifact != null )
|
||||
{
|
||||
dependencyArtifact.setFile( upStreamArtifact.getFile() );
|
||||
dependencyArtifact.setResolved( true );
|
||||
dependencyArtifact.setRepository( upStreamArtifact.getRepository() );
|
||||
|
@ -299,11 +309,14 @@ public class LifecycleWeaveBuilder
|
|||
}
|
||||
}
|
||||
|
||||
private void reresolveUpstreamTestScopedArtifacts(ProjectSegment projectBuild) {
|
||||
for ( MavenProject upstreamProject : projectBuild.getTransitiveUpstreamProjects() ){
|
||||
private void reresolveUpstreamTestScopedArtifacts( ProjectSegment projectBuild )
|
||||
{
|
||||
for ( MavenProject upstreamProject : projectBuild.getTransitiveUpstreamProjects() )
|
||||
{
|
||||
Artifact upStreamArtifact = findTestScopedArtifact( upstreamProject );
|
||||
Artifact dependencyArtifact = findDependency( projectBuild.getProject(), upStreamArtifact );
|
||||
if (dependencyArtifact != null){
|
||||
if ( dependencyArtifact != null )
|
||||
{
|
||||
dependencyArtifact.setFile( upStreamArtifact.getFile() );
|
||||
dependencyArtifact.setResolved( upStreamArtifact.isResolved() );
|
||||
dependencyArtifact.setRepository( upStreamArtifact.getRepository() );
|
||||
|
@ -312,27 +325,32 @@ public class LifecycleWeaveBuilder
|
|||
}
|
||||
}
|
||||
|
||||
private Artifact findTestScopedArtifact(MavenProject upstreamProject) {
|
||||
if ( upstreamProject == null){
|
||||
private Artifact findTestScopedArtifact( MavenProject upstreamProject )
|
||||
{
|
||||
if ( upstreamProject == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
List<Artifact> artifactList = upstreamProject.getAttachedArtifacts();
|
||||
for (Artifact artifact : artifactList) {
|
||||
if (Artifact.SCOPE_TEST.equals( artifact.getScope())){
|
||||
for ( Artifact artifact : artifactList )
|
||||
{
|
||||
if ( Artifact.SCOPE_TEST.equals( artifact.getScope() ) )
|
||||
{
|
||||
return artifact;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Artifact findDependency(MavenProject project, Artifact upStreamArtifact) {
|
||||
if (upStreamArtifact == null){
|
||||
private static Artifact findDependency( MavenProject project, Artifact upStreamArtifact )
|
||||
{
|
||||
if ( upStreamArtifact == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
String key = ArtifactUtils.key( upStreamArtifact.getGroupId(),
|
||||
upStreamArtifact.getArtifactId(),
|
||||
String key = ArtifactUtils.key( upStreamArtifact.getGroupId(), upStreamArtifact.getArtifactId(),
|
||||
upStreamArtifact.getVersion() );
|
||||
final Set<Artifact> deps = project.getDependencyArtifacts();
|
||||
for ( Artifact dep : deps )
|
||||
|
@ -356,22 +374,25 @@ public class LifecycleWeaveBuilder
|
|||
private boolean requiresReResolutionOfUpstreamTestScopedReactorArtifacts( ExecutionPlanItem nextExecutionPlanItem )
|
||||
{
|
||||
final String phase = nextExecutionPlanItem.getLifecyclePhase();
|
||||
return "package".equals(phase) || "install".equals( phase ) || "compile".equals( phase ) || "test-compile".equals( phase );
|
||||
return "package".equals( phase ) || "install".equals( phase ) || "compile".equals( phase ) ||
|
||||
"test-compile".equals( phase );
|
||||
}
|
||||
|
||||
private void buildExecutionPlanItem(ExecutionPlanItem current, PhaseRecorder phaseRecorder, Schedule schedule, ReactorContext reactorContext, ProjectSegment projectBuild, DependencyContext dependencyContext) throws LifecycleExecutionException {
|
||||
private void buildExecutionPlanItem( ExecutionPlanItem current, PhaseRecorder phaseRecorder, Schedule schedule,
|
||||
ReactorContext reactorContext, ProjectSegment projectBuild,
|
||||
DependencyContext dependencyContext )
|
||||
throws LifecycleExecutionException
|
||||
{
|
||||
if ( schedule != null && schedule.isMojoSynchronized() )
|
||||
{
|
||||
synchronized ( current.getPlugin() )
|
||||
{
|
||||
buildExecutionPlanItem( reactorContext, current, projectBuild, dependencyContext,
|
||||
phaseRecorder );
|
||||
buildExecutionPlanItem( reactorContext, current, projectBuild, dependencyContext, phaseRecorder );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
buildExecutionPlanItem( reactorContext, current, projectBuild, dependencyContext,
|
||||
phaseRecorder );
|
||||
buildExecutionPlanItem( reactorContext, current, projectBuild, dependencyContext, phaseRecorder );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -305,9 +305,6 @@ public class LifecycleExecutorTest
|
|||
System.out.println( dom );
|
||||
}
|
||||
|
||||
// Todo: This method is kind of an oddity. It is only called from the LifecycleExecutorTest, hence it should
|
||||
// really not exist, or at least be moved into the test class.
|
||||
|
||||
MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks )
|
||||
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
|
||||
MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||
|
|
|
@ -29,9 +29,10 @@ public class BuildListCalculatorTest
|
|||
public void testCalculateProjectBuilds()
|
||||
throws Exception
|
||||
{
|
||||
BuildListCalculator buildListCalculator = createBuildListCalculator();
|
||||
LifecycleTaskSegmentCalculator lifecycleTaskSegmentCalculator = getTaskSegmentCalculator();
|
||||
BuildListCalculator buildListCalculator = new BuildListCalculator();
|
||||
final MavenSession session = ProjectDependencyGraphStub.getMavenSession();
|
||||
List<TaskSegment> taskSegments = buildListCalculator.calculateTaskSegments( session );
|
||||
List<TaskSegment> taskSegments = lifecycleTaskSegmentCalculator.calculateTaskSegments( session );
|
||||
final ProjectBuildList buildList = buildListCalculator.calculateProjectBuilds( session, taskSegments );
|
||||
final ProjectBuildList segments = buildList.getByTaskSegment( taskSegments.get( 0 ) );
|
||||
assertEquals( "Stub data contains 3 segments", 3, taskSegments.size() );
|
||||
|
@ -40,10 +41,9 @@ public class BuildListCalculatorTest
|
|||
assertNotNull( build );
|
||||
}
|
||||
|
||||
public static BuildListCalculator createBuildListCalculator()
|
||||
private static LifecycleTaskSegmentCalculator getTaskSegmentCalculator()
|
||||
{
|
||||
LifecycleTaskSegmentCalculator lifecycleTaskSegmentCalculator = new LifecycleTaskSegmentCalculatorStub();
|
||||
return new BuildListCalculator( lifecycleTaskSegmentCalculator );
|
||||
return new LifecycleTaskSegmentCalculatorStub();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
package org.apache.maven.lifecycle.internal;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.lifecycle.internal.stub.LifecycleTaskSegmentCalculatorStub;
|
||||
import org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:kristian@zenior.no">Kristian Rosenvold</a>
|
||||
*/
|
||||
public class LifecycleTaskSegmentCalculatorImplTest
|
||||
extends TestCase
|
||||
{
|
||||
public void testCalculateProjectBuilds()
|
||||
throws Exception
|
||||
{
|
||||
LifecycleTaskSegmentCalculator lifecycleTaskSegmentCalculator = getTaskSegmentCalculator();
|
||||
BuildListCalculator buildListCalculator = new BuildListCalculator();
|
||||
final MavenSession session = ProjectDependencyGraphStub.getMavenSession();
|
||||
List<TaskSegment> taskSegments = lifecycleTaskSegmentCalculator.calculateTaskSegments( session );
|
||||
|
||||
final ProjectBuildList buildList = buildListCalculator.calculateProjectBuilds( session, taskSegments );
|
||||
final ProjectBuildList segments = buildList.getByTaskSegment( taskSegments.get( 0 ) );
|
||||
assertEquals( "Stub data contains 3 segments", 3, taskSegments.size() );
|
||||
assertEquals( "Stub data contains 6 items", 6, segments.size() );
|
||||
final ProjectSegment build = segments.get( 0 );
|
||||
assertNotNull( build );
|
||||
}
|
||||
|
||||
private static LifecycleTaskSegmentCalculator getTaskSegmentCalculator()
|
||||
{
|
||||
return new LifecycleTaskSegmentCalculatorStub();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -20,13 +20,7 @@ import org.apache.maven.execution.MavenExecutionResult;
|
|||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.lifecycle.LifecycleNotFoundException;
|
||||
import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException;
|
||||
import org.apache.maven.lifecycle.internal.stub.CompletionServiceStub;
|
||||
import org.apache.maven.lifecycle.internal.stub.ExecutionEventCatapultStub;
|
||||
import org.apache.maven.lifecycle.internal.stub.LifecycleExecutionPlanCalculatorStub;
|
||||
import org.apache.maven.lifecycle.internal.stub.LoggerStub;
|
||||
import org.apache.maven.lifecycle.internal.stub.MojoExecutorStub;
|
||||
import org.apache.maven.lifecycle.internal.stub.ProjectDependenciesResolverStub;
|
||||
import org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub;
|
||||
import org.apache.maven.lifecycle.internal.stub.*;
|
||||
import org.apache.maven.plugin.InvalidPluginDescriptorException;
|
||||
import org.apache.maven.plugin.MojoNotFoundException;
|
||||
import org.apache.maven.plugin.PluginDescriptorParsingException;
|
||||
|
@ -85,9 +79,9 @@ public class LifecycleWeaveBuilderTest
|
|||
final ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||
try
|
||||
{
|
||||
BuildListCalculator buildListCalculator = BuildListCalculatorTest.createBuildListCalculator();
|
||||
BuildListCalculator buildListCalculator = new BuildListCalculator();
|
||||
final MavenSession session = ProjectDependencyGraphStub.getMavenSession();
|
||||
List<TaskSegment> taskSegments = buildListCalculator.calculateTaskSegments( session );
|
||||
List<TaskSegment> taskSegments = getTaskSegmentCalculator().calculateTaskSegments( session );
|
||||
ProjectBuildList projectBuildList = buildListCalculator.calculateProjectBuilds( session, taskSegments );
|
||||
|
||||
final MojoExecutorStub mojoExecutorStub = new MojoExecutorStub();
|
||||
|
@ -109,6 +103,11 @@ public class LifecycleWeaveBuilderTest
|
|||
}
|
||||
|
||||
|
||||
private static LifecycleTaskSegmentCalculator getTaskSegmentCalculator()
|
||||
{
|
||||
return new LifecycleTaskSegmentCalculatorStub();
|
||||
}
|
||||
|
||||
private ReactorContext createBuildContext( MavenSession session )
|
||||
{
|
||||
MavenExecutionResult mavenExecutionResult = new DefaultMavenExecutionResult();
|
||||
|
@ -120,8 +119,6 @@ public class LifecycleWeaveBuilderTest
|
|||
{
|
||||
final BuilderCommon builderCommon = getBuilderCommon();
|
||||
final LoggerStub loggerStub = new LoggerStub();
|
||||
final LifecycleDependencyResolver lifecycleDependencyResolver =
|
||||
new LifecycleDependencyResolver( new ProjectDependenciesResolverStub(), loggerStub );
|
||||
return new LifecycleWeaveBuilder( mojoExecutor, builderCommon, loggerStub, new ExecutionEventCatapultStub() );
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.maven.lifecycle.internal.stub;
|
|||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.lifecycle.internal.GoalTask;
|
||||
import org.apache.maven.lifecycle.internal.LifecycleTask;
|
||||
import org.apache.maven.lifecycle.internal.LifecycleTaskSegmentCalculator;
|
||||
import org.apache.maven.lifecycle.internal.LifecycleTaskSegmentCalculatorImpl;
|
||||
import org.apache.maven.lifecycle.internal.TaskSegment;
|
||||
import org.apache.maven.plugin.InvalidPluginDescriptorException;
|
||||
import org.apache.maven.plugin.MojoNotFoundException;
|
||||
|
@ -36,7 +36,7 @@ import java.util.List;
|
|||
*/
|
||||
|
||||
public class LifecycleTaskSegmentCalculatorStub
|
||||
implements LifecycleTaskSegmentCalculator
|
||||
extends LifecycleTaskSegmentCalculatorImpl
|
||||
{
|
||||
public static final String clean = "clean";
|
||||
|
||||
|
@ -44,6 +44,7 @@ public class LifecycleTaskSegmentCalculatorStub
|
|||
|
||||
public static final String install = "install";
|
||||
|
||||
|
||||
public List<TaskSegment> calculateTaskSegments( MavenSession session, List<String> tasks )
|
||||
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
|
||||
MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||
|
|
Loading…
Reference in New Issue