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 String threadCount;
|
||||
|
||||
private boolean perCoreThreadCount;
|
||||
private boolean weaveMode;
|
||||
|
||||
/**
|
||||
* Suppress SNAPSHOT updates.
|
||||
|
@ -1028,28 +1028,29 @@ public class DefaultMavenExecutionRequest
|
|||
return this;
|
||||
}
|
||||
|
||||
public String getThreadCount() {
|
||||
public String getThreadCount()
|
||||
{
|
||||
return threadCount;
|
||||
}
|
||||
|
||||
public void setThreadCount(String threadCount) {
|
||||
public void setThreadCount( String threadCount )
|
||||
{
|
||||
this.threadCount = threadCount;
|
||||
}
|
||||
|
||||
public boolean isThreadConfigurationPresent() {
|
||||
public boolean isThreadConfigurationPresent()
|
||||
{
|
||||
return getThreadCount() != null;
|
||||
}
|
||||
|
||||
public boolean isPerCoreThreadCount() {
|
||||
public boolean isPerCoreThreadCount()
|
||||
{
|
||||
return perCoreThreadCount;
|
||||
}
|
||||
|
||||
public void setPerCoreThreadCount(boolean perCoreThreadCount) {
|
||||
public void setPerCoreThreadCount( boolean perCoreThreadCount )
|
||||
{
|
||||
this.perCoreThreadCount = perCoreThreadCount;
|
||||
}
|
||||
|
||||
public boolean isWeaveMode() {
|
||||
return weaveMode;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -158,9 +158,6 @@ public interface MavenExecutionRequest
|
|||
void setPerCoreThreadCount(boolean perCoreThreadCount);
|
||||
boolean isPerCoreThreadCount();
|
||||
|
||||
boolean isWeaveMode();
|
||||
|
||||
|
||||
// Recursive (really to just process the top-level POM)
|
||||
MavenExecutionRequest setRecursive( boolean recursive );
|
||||
boolean isRecursive();
|
||||
|
|
|
@ -376,11 +376,13 @@ public class MavenSession
|
|||
return request.getStartTime();
|
||||
}
|
||||
|
||||
public boolean isParallel() {
|
||||
public boolean isParallel()
|
||||
{
|
||||
return parallel;
|
||||
}
|
||||
|
||||
public void setParallel(boolean parallel) {
|
||||
public void setParallel( boolean parallel )
|
||||
{
|
||||
this.parallel = parallel;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.apache.maven.execution.MavenSession;
|
|||
import org.apache.maven.lifecycle.internal.BuildListCalculator;
|
||||
import org.apache.maven.lifecycle.internal.ConcurrencyDependencyGraph;
|
||||
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.LifecycleTaskSegmentCalculator;
|
||||
import org.apache.maven.lifecycle.internal.LifecycleThreadedBuilder;
|
||||
|
@ -40,6 +41,7 @@ import org.apache.maven.plugin.InvalidPluginDescriptorException;
|
|||
import org.apache.maven.plugin.MojoExecution;
|
||||
import org.apache.maven.plugin.MojoNotFoundException;
|
||||
import org.apache.maven.plugin.PluginDescriptorParsingException;
|
||||
import org.apache.maven.plugin.PluginManagerException;
|
||||
import org.apache.maven.plugin.PluginNotFoundException;
|
||||
import org.apache.maven.plugin.PluginResolutionException;
|
||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||
|
@ -93,6 +95,9 @@ public class DefaultLifecycleExecutor
|
|||
@Requirement
|
||||
private LifecycleTaskSegmentCalculator lifecycleTaskSegmentCalculator;
|
||||
|
||||
@Requirement
|
||||
private LifecycleExecutionPlanCalculator lifecycleExecutionPlanCalculator;
|
||||
|
||||
@Requirement
|
||||
private ThreadConfigurationService threadConfigService;
|
||||
|
||||
|
@ -148,7 +153,7 @@ public class DefaultLifecycleExecutor
|
|||
{
|
||||
ExecutorService executor = threadConfigService.getExecutorService( executionRequest.getThreadCount(),
|
||||
executionRequest.isPerCoreThreadCount(),
|
||||
session.getProjects().size());
|
||||
session.getProjects().size() );
|
||||
try
|
||||
{
|
||||
|
||||
|
@ -169,7 +174,8 @@ public class DefaultLifecycleExecutor
|
|||
CompletionService<ProjectSegment> service =
|
||||
new ExecutorCompletionService<ProjectSegment>( executor );
|
||||
|
||||
lifecycleThreadedBuilder.build( session, callableContext, projectBuilds, taskSegments, analyzer, service );
|
||||
lifecycleThreadedBuilder.build( session, callableContext, projectBuilds, taskSegments, analyzer,
|
||||
service );
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
@ -208,7 +214,8 @@ public class DefaultLifecycleExecutor
|
|||
{
|
||||
try
|
||||
{
|
||||
lifecycleModuleBuilder.buildProject( session, callableContext, projectBuild.getProject(), taskSegment );
|
||||
lifecycleModuleBuilder.buildProject( session, callableContext, projectBuild.getProject(),
|
||||
taskSegment );
|
||||
if ( reactorBuildStatus.isHalted() )
|
||||
{
|
||||
break;
|
||||
|
@ -279,5 +286,27 @@ public class DefaultLifecycleExecutor
|
|||
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,21 +866,21 @@ public class MavenCli
|
|||
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 ) ?
|
||||
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"));
|
||||
if (threadConfiguration.contains("W"))
|
||||
if ( threadConfiguration != null )
|
||||
{
|
||||
request.setPerCoreThreadCount( threadConfiguration.contains( "C" ) );
|
||||
if ( threadConfiguration.contains( "W" ) )
|
||||
{
|
||||
LifecycleWeaveBuilder.setWeaveMode(request.getUserProperties());
|
||||
LifecycleWeaveBuilder.setWeaveMode( request.getUserProperties() );
|
||||
}
|
||||
request.setThreadCount(threadConfiguration.replace("C", "").replace("W", "").replace("auto", ""));
|
||||
request.setThreadCount( threadConfiguration.replace( "C", "" ).replace( "W", "" ).replace( "auto", "" ) );
|
||||
}
|
||||
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue