mirror of https://github.com/apache/maven.git
[MNG-3004] Re-added calculateExecutionPlan to DLE, fixed ASF code standard
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@931921 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5ffd89030c
commit
643337864b
|
@ -127,8 +127,8 @@ public class DefaultMavenExecutionRequest
|
||||||
private ExecutionListener executionListener;
|
private ExecutionListener executionListener;
|
||||||
|
|
||||||
private String threadCount;
|
private String threadCount;
|
||||||
|
|
||||||
private boolean perCoreThreadCount;
|
private boolean perCoreThreadCount;
|
||||||
private boolean weaveMode;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Suppress SNAPSHOT updates.
|
* Suppress SNAPSHOT updates.
|
||||||
|
@ -1028,28 +1028,29 @@ public MavenExecutionRequest setExecutionListener( ExecutionListener executionLi
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getThreadCount() {
|
public String getThreadCount()
|
||||||
|
{
|
||||||
return threadCount;
|
return threadCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setThreadCount(String threadCount) {
|
public void setThreadCount( String threadCount )
|
||||||
|
{
|
||||||
this.threadCount = threadCount;
|
this.threadCount = threadCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isThreadConfigurationPresent() {
|
public boolean isThreadConfigurationPresent()
|
||||||
|
{
|
||||||
return getThreadCount() != null;
|
return getThreadCount() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPerCoreThreadCount() {
|
public boolean isPerCoreThreadCount()
|
||||||
|
{
|
||||||
return perCoreThreadCount;
|
return perCoreThreadCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPerCoreThreadCount(boolean perCoreThreadCount) {
|
public void setPerCoreThreadCount( boolean perCoreThreadCount )
|
||||||
|
{
|
||||||
this.perCoreThreadCount = perCoreThreadCount;
|
this.perCoreThreadCount = perCoreThreadCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWeaveMode() {
|
|
||||||
return weaveMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,9 +158,6 @@ public interface MavenExecutionRequest
|
||||||
void setPerCoreThreadCount(boolean perCoreThreadCount);
|
void setPerCoreThreadCount(boolean perCoreThreadCount);
|
||||||
boolean isPerCoreThreadCount();
|
boolean isPerCoreThreadCount();
|
||||||
|
|
||||||
boolean isWeaveMode();
|
|
||||||
|
|
||||||
|
|
||||||
// Recursive (really to just process the top-level POM)
|
// Recursive (really to just process the top-level POM)
|
||||||
MavenExecutionRequest setRecursive( boolean recursive );
|
MavenExecutionRequest setRecursive( boolean recursive );
|
||||||
boolean isRecursive();
|
boolean isRecursive();
|
||||||
|
|
|
@ -376,11 +376,13 @@ public Date getStartTime()
|
||||||
return request.getStartTime();
|
return request.getStartTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isParallel() {
|
public boolean isParallel()
|
||||||
|
{
|
||||||
return parallel;
|
return parallel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParallel(boolean parallel) {
|
public void setParallel( boolean parallel )
|
||||||
|
{
|
||||||
this.parallel = parallel;
|
this.parallel = parallel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
import org.apache.maven.lifecycle.internal.BuildListCalculator;
|
import org.apache.maven.lifecycle.internal.BuildListCalculator;
|
||||||
import org.apache.maven.lifecycle.internal.ConcurrencyDependencyGraph;
|
import org.apache.maven.lifecycle.internal.ConcurrencyDependencyGraph;
|
||||||
import org.apache.maven.lifecycle.internal.LifecycleDebugLogger;
|
import org.apache.maven.lifecycle.internal.LifecycleDebugLogger;
|
||||||
|
import org.apache.maven.lifecycle.internal.LifecycleExecutionPlanCalculator;
|
||||||
import org.apache.maven.lifecycle.internal.LifecycleModuleBuilder;
|
import org.apache.maven.lifecycle.internal.LifecycleModuleBuilder;
|
||||||
import org.apache.maven.lifecycle.internal.LifecycleTaskSegmentCalculator;
|
import org.apache.maven.lifecycle.internal.LifecycleTaskSegmentCalculator;
|
||||||
import org.apache.maven.lifecycle.internal.LifecycleThreadedBuilder;
|
import org.apache.maven.lifecycle.internal.LifecycleThreadedBuilder;
|
||||||
|
@ -40,6 +41,7 @@
|
||||||
import org.apache.maven.plugin.MojoExecution;
|
import org.apache.maven.plugin.MojoExecution;
|
||||||
import org.apache.maven.plugin.MojoNotFoundException;
|
import org.apache.maven.plugin.MojoNotFoundException;
|
||||||
import org.apache.maven.plugin.PluginDescriptorParsingException;
|
import org.apache.maven.plugin.PluginDescriptorParsingException;
|
||||||
|
import org.apache.maven.plugin.PluginManagerException;
|
||||||
import org.apache.maven.plugin.PluginNotFoundException;
|
import org.apache.maven.plugin.PluginNotFoundException;
|
||||||
import org.apache.maven.plugin.PluginResolutionException;
|
import org.apache.maven.plugin.PluginResolutionException;
|
||||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||||
|
@ -93,6 +95,9 @@ public class DefaultLifecycleExecutor
|
||||||
@Requirement
|
@Requirement
|
||||||
private LifecycleTaskSegmentCalculator lifecycleTaskSegmentCalculator;
|
private LifecycleTaskSegmentCalculator lifecycleTaskSegmentCalculator;
|
||||||
|
|
||||||
|
@Requirement
|
||||||
|
private LifecycleExecutionPlanCalculator lifecycleExecutionPlanCalculator;
|
||||||
|
|
||||||
@Requirement
|
@Requirement
|
||||||
private ThreadConfigurationService threadConfigService;
|
private ThreadConfigurationService threadConfigService;
|
||||||
|
|
||||||
|
@ -169,7 +174,8 @@ public void execute( MavenSession session )
|
||||||
CompletionService<ProjectSegment> service =
|
CompletionService<ProjectSegment> service =
|
||||||
new ExecutorCompletionService<ProjectSegment>( executor );
|
new ExecutorCompletionService<ProjectSegment>( executor );
|
||||||
|
|
||||||
lifecycleThreadedBuilder.build( session, callableContext, projectBuilds, taskSegments, analyzer, service );
|
lifecycleThreadedBuilder.build( session, callableContext, projectBuilds, taskSegments, analyzer,
|
||||||
|
service );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -208,7 +214,8 @@ private void singleThreadedBuild( MavenSession session, ReactorContext callableC
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
lifecycleModuleBuilder.buildProject( session, callableContext, projectBuild.getProject(), taskSegment );
|
lifecycleModuleBuilder.buildProject( session, callableContext, projectBuild.getProject(),
|
||||||
|
taskSegment );
|
||||||
if ( reactorBuildStatus.isHalted() )
|
if ( reactorBuildStatus.isHalted() )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
@ -279,5 +286,27 @@ MojoDescriptor getMojoDescriptor( String task, MavenSession session, MavenProjec
|
||||||
return mojoDescriptorCreator.getMojoDescriptor( task, session, project );
|
return mojoDescriptorCreator.getMojoDescriptor( task, session, project );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Used by m2eclipse
|
||||||
|
|
||||||
|
@SuppressWarnings({"UnusedDeclaration"})
|
||||||
|
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks )
|
||||||
|
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
|
||||||
|
MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||||
|
PluginManagerException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
|
||||||
|
PluginVersionResolutionException
|
||||||
|
{
|
||||||
|
|
||||||
|
List<TaskSegment> taskSegments = buildListCalculator.calculateTaskSegments( session );
|
||||||
|
|
||||||
|
TaskSegment mergedSegment = new TaskSegment( false );
|
||||||
|
|
||||||
|
for ( TaskSegment taskSegment : taskSegments )
|
||||||
|
{
|
||||||
|
mergedSegment.getTasks().addAll( taskSegment.getTasks() );
|
||||||
|
}
|
||||||
|
|
||||||
|
return lifecycleExecutionPlanCalculator.calculateExecutionPlan( session, session.getCurrentProject(),
|
||||||
|
mergedSegment.getTasks() );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -866,12 +866,13 @@ else if ( commandLine.hasOption( CLIManager.ALSO_MAKE ) && commandLine.hasOption
|
||||||
request.setLocalRepositoryPath( localRepoProperty );
|
request.setLocalRepositoryPath( localRepoProperty );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final String threadConfiguration = commandLine.hasOption( CLIManager.THREADS )
|
||||||
|
? commandLine.getOptionValue( CLIManager.THREADS )
|
||||||
|
: request.getSystemProperties().getProperty(
|
||||||
|
MavenCli.THREADS_DEPRECATED ); // TODO: Remove this setting. Note that the int-tests use it
|
||||||
|
|
||||||
final String threadConfiguration = commandLine.hasOption( CLIManager.THREADS ) ?
|
if ( threadConfiguration != null )
|
||||||
commandLine.getOptionValue( CLIManager.THREADS) :
|
{
|
||||||
request.getSystemProperties().getProperty(MavenCli.THREADS_DEPRECATED); // TODO: Remove this setting. Note that the int-tests use it
|
|
||||||
|
|
||||||
if (threadConfiguration != null){
|
|
||||||
request.setPerCoreThreadCount( threadConfiguration.contains( "C" ) );
|
request.setPerCoreThreadCount( threadConfiguration.contains( "C" ) );
|
||||||
if ( threadConfiguration.contains( "W" ) )
|
if ( threadConfiguration.contains( "W" ) )
|
||||||
{
|
{
|
||||||
|
@ -880,7 +881,6 @@ else if ( commandLine.hasOption( CLIManager.ALSO_MAKE ) && commandLine.hasOption
|
||||||
request.setThreadCount( threadConfiguration.replace( "C", "" ).replace( "W", "" ).replace( "auto", "" ) );
|
request.setThreadCount( threadConfiguration.replace( "C", "" ).replace( "W", "" ).replace( "auto", "" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue