mirror of https://github.com/apache/maven.git
Removed the remaining weave mode code
This commit is contained in:
parent
be19ddb6d9
commit
276c7636d3
|
@ -1,99 +0,0 @@
|
|||
package org.apache.maven.lifecycle;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.lifecycle.internal.ExecutionPlanItem;
|
||||
import org.apache.maven.lifecycle.internal.builder.BuilderCommon;
|
||||
import org.apache.maven.plugin.MojoExecution;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Defines scheduling information needed by weave mode.
|
||||
*
|
||||
* @since 3.0
|
||||
* @author Kristian Rosenvold
|
||||
*/
|
||||
public class DefaultSchedules
|
||||
{
|
||||
List<Scheduling> schedules;
|
||||
|
||||
public DefaultSchedules()
|
||||
{
|
||||
}
|
||||
|
||||
public DefaultSchedules( List<Scheduling> schedules )
|
||||
{
|
||||
this.schedules = schedules;
|
||||
}
|
||||
|
||||
public List<ExecutionPlanItem> createExecutionPlanItem( MavenProject mavenProject, List<MojoExecution> executions )
|
||||
{
|
||||
BuilderCommon.attachToThread( mavenProject );
|
||||
|
||||
List<ExecutionPlanItem> result = new ArrayList<ExecutionPlanItem>();
|
||||
for ( MojoExecution mojoExecution : executions )
|
||||
{
|
||||
String lifeCyclePhase = mojoExecution.getLifecyclePhase();
|
||||
final Scheduling scheduling = getScheduling( "default" );
|
||||
|
||||
Schedule schedule = null;
|
||||
if ( scheduling != null )
|
||||
{
|
||||
schedule = scheduling.getSchedule( mojoExecution );
|
||||
if ( schedule == null )
|
||||
{
|
||||
schedule = scheduling.getSchedule( lifeCyclePhase );
|
||||
}
|
||||
}
|
||||
|
||||
result.add( new ExecutionPlanItem( mojoExecution, schedule ) );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets scheduling associated with a given phase.
|
||||
* <p/>
|
||||
* This is part of the experimental weave mode and therefore not part of the public api.
|
||||
*
|
||||
* @param lifecyclePhaseName The name of the lifecycle phase
|
||||
* @return Schecduling information related to phase
|
||||
*/
|
||||
|
||||
Scheduling getScheduling( String lifecyclePhaseName )
|
||||
{
|
||||
for ( Scheduling schedule : schedules )
|
||||
{
|
||||
if ( lifecyclePhaseName.equals( schedule.getLifecycle() ) )
|
||||
{
|
||||
return schedule;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<Scheduling> getSchedules()
|
||||
{
|
||||
return schedules;
|
||||
}
|
||||
}
|
|
@ -139,28 +139,6 @@ public class MavenExecutionPlan
|
|||
return result;
|
||||
}
|
||||
|
||||
public void forceAllComplete()
|
||||
{
|
||||
for ( ExecutionPlanItem executionPlanItem : getExecutionPlanItems() )
|
||||
{
|
||||
executionPlanItem.forceComplete();
|
||||
}
|
||||
}
|
||||
|
||||
public void waitUntilAllDone()
|
||||
throws InterruptedException
|
||||
{
|
||||
for ( ExecutionPlanItem executionPlanItem : getExecutionPlanItems() )
|
||||
{
|
||||
executionPlanItem.waitUntilDone();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean containsPhase( String phase )
|
||||
{
|
||||
return phasesInExecutionPlan.contains( phase );
|
||||
}
|
||||
|
||||
public List<MojoExecution> getMojoExecutions()
|
||||
{
|
||||
List<MojoExecution> result = new ArrayList<MojoExecution>();
|
||||
|
|
|
@ -1,143 +0,0 @@
|
|||
package org.apache.maven.lifecycle;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.plugin.MojoExecution;
|
||||
|
||||
/**
|
||||
* @since 3.0
|
||||
* @author Kristian Rosenvold
|
||||
*/
|
||||
public class Schedule
|
||||
{
|
||||
private String phase;
|
||||
|
||||
private String upstreamPhase; // The upstream phase to lock to.
|
||||
|
||||
private String pluginKey;
|
||||
|
||||
private String mojoGoal;
|
||||
|
||||
private boolean mojoSynchronized;
|
||||
// Indicates that this phase/mojo does not need to respect the reactor-dependency graph
|
||||
// (Module lifecycle order still must be respected )
|
||||
|
||||
private boolean parallel;
|
||||
|
||||
public Schedule()
|
||||
{
|
||||
}
|
||||
|
||||
public Schedule( String phase, boolean mojoSynchronized, boolean parallel )
|
||||
{
|
||||
this.phase = phase;
|
||||
this.mojoSynchronized = mojoSynchronized;
|
||||
this.parallel = parallel;
|
||||
}
|
||||
|
||||
|
||||
public String getPhase()
|
||||
{
|
||||
return phase;
|
||||
}
|
||||
|
||||
public void setPhase( String phase )
|
||||
{
|
||||
this.phase = phase;
|
||||
}
|
||||
|
||||
public String getPluginKey()
|
||||
{
|
||||
return pluginKey;
|
||||
}
|
||||
|
||||
public void setPluginKey( String pluginKey )
|
||||
{
|
||||
this.pluginKey = pluginKey;
|
||||
}
|
||||
|
||||
public boolean isMojoSynchronized()
|
||||
{
|
||||
return mojoSynchronized;
|
||||
}
|
||||
|
||||
public void setMojoSynchronized( boolean mojoSynchronized )
|
||||
{
|
||||
this.mojoSynchronized = mojoSynchronized;
|
||||
}
|
||||
|
||||
|
||||
public boolean isParallel()
|
||||
{
|
||||
return parallel;
|
||||
}
|
||||
|
||||
public void setParallel( boolean parallel )
|
||||
{
|
||||
this.parallel = parallel;
|
||||
}
|
||||
|
||||
public String getUpstreamPhase()
|
||||
{
|
||||
return upstreamPhase;
|
||||
}
|
||||
|
||||
public void setUpstreamPhase( String upstreamPhase )
|
||||
{
|
||||
this.upstreamPhase = upstreamPhase;
|
||||
}
|
||||
|
||||
public String getMojoGoal()
|
||||
{
|
||||
return mojoGoal;
|
||||
}
|
||||
|
||||
public void setMojoGoal( String mojoGoal )
|
||||
{
|
||||
this.mojoGoal = mojoGoal;
|
||||
}
|
||||
|
||||
public boolean hasUpstreamPhaseDefined()
|
||||
{
|
||||
return getUpstreamPhase() != null;
|
||||
}
|
||||
|
||||
public boolean appliesTo( MojoExecution mojoExecution )
|
||||
{
|
||||
if ( pluginKey == null && mojoGoal == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean pluginKeyMatches = ( pluginKey == null ) || pluginKey.equals( mojoExecution.getPlugin().getKey() );
|
||||
|
||||
boolean pluginGoalMatches = ( mojoGoal == null ) || mojoGoal.equals( mojoExecution.getGoal() );
|
||||
|
||||
return pluginKeyMatches && pluginGoalMatches;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Schedule{" + "phase='" + phase + "', upstreamPhase='" + upstreamPhase + "', pluginKey='"
|
||||
+ pluginKey + "', mojoGoal='" + mojoGoal + "', mojoSynchronized=" + mojoSynchronized
|
||||
+ ", parallel=" + parallel + '}';
|
||||
}
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
package org.apache.maven.lifecycle;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.plugin.MojoExecution;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Class Scheduling.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public class Scheduling
|
||||
{
|
||||
private String lifecycle;
|
||||
|
||||
private List<Schedule> schedules;
|
||||
|
||||
public Scheduling()
|
||||
{
|
||||
}
|
||||
|
||||
public Scheduling( String lifecycle, List<Schedule> schedules )
|
||||
{
|
||||
this.lifecycle = lifecycle;
|
||||
this.schedules = schedules;
|
||||
}
|
||||
|
||||
public String getLifecycle()
|
||||
{
|
||||
return lifecycle;
|
||||
}
|
||||
|
||||
public void setLifecycle( String lifecycle )
|
||||
{
|
||||
this.lifecycle = lifecycle;
|
||||
}
|
||||
|
||||
public List<Schedule> getSchedules()
|
||||
{
|
||||
return schedules;
|
||||
}
|
||||
|
||||
|
||||
public Schedule getSchedule( String phaseName )
|
||||
{
|
||||
if ( phaseName != null )
|
||||
{
|
||||
for ( Schedule schedule : schedules )
|
||||
{
|
||||
if ( phaseName.equals( schedule.getPhase() ) )
|
||||
{
|
||||
return schedule;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Schedule getSchedule( MojoExecution mojoExecution )
|
||||
{
|
||||
if ( mojoExecution != null )
|
||||
{
|
||||
for ( Schedule schedule : schedules )
|
||||
{
|
||||
if ( schedule.appliesTo( mojoExecution ) )
|
||||
{
|
||||
return schedule;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setSchedules( List<Schedule> schedules )
|
||||
{
|
||||
this.schedules = schedules;
|
||||
}
|
||||
}
|
|
@ -31,7 +31,6 @@ import java.util.TreeMap;
|
|||
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.lifecycle.DefaultLifecycles;
|
||||
import org.apache.maven.lifecycle.DefaultSchedules;
|
||||
import org.apache.maven.lifecycle.Lifecycle;
|
||||
import org.apache.maven.lifecycle.LifecycleNotFoundException;
|
||||
import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException;
|
||||
|
@ -81,9 +80,6 @@ public class DefaultLifecycleExecutionPlanCalculator
|
|||
@Requirement
|
||||
private DefaultLifecycles defaultLifeCycles;
|
||||
|
||||
@Requirement
|
||||
private DefaultSchedules defaultSchedules;
|
||||
|
||||
@Requirement
|
||||
private MojoDescriptorCreator mojoDescriptorCreator;
|
||||
|
||||
|
@ -98,14 +94,12 @@ public class DefaultLifecycleExecutionPlanCalculator
|
|||
public DefaultLifecycleExecutionPlanCalculator( BuildPluginManager pluginManager,
|
||||
DefaultLifecycles defaultLifeCycles,
|
||||
MojoDescriptorCreator mojoDescriptorCreator,
|
||||
LifecyclePluginResolver lifecyclePluginResolver,
|
||||
DefaultSchedules defaultSchedules )
|
||||
LifecyclePluginResolver lifecyclePluginResolver )
|
||||
{
|
||||
this.pluginManager = pluginManager;
|
||||
this.defaultLifeCycles = defaultLifeCycles;
|
||||
this.mojoDescriptorCreator = mojoDescriptorCreator;
|
||||
this.lifecyclePluginResolver = lifecyclePluginResolver;
|
||||
this.defaultSchedules = defaultSchedules;
|
||||
}
|
||||
|
||||
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project, List<Object> tasks, boolean setup )
|
||||
|
@ -122,7 +116,7 @@ public class DefaultLifecycleExecutionPlanCalculator
|
|||
setupMojoExecutions( session, project, executions );
|
||||
}
|
||||
|
||||
final List<ExecutionPlanItem> planItem = defaultSchedules.createExecutionPlanItem( project, executions );
|
||||
final List<ExecutionPlanItem> planItem = ExecutionPlanItem.createExecutionPlanItems( project, executions );
|
||||
|
||||
return new MavenExecutionPlan( planItem, defaultLifeCycles );
|
||||
}
|
||||
|
|
|
@ -19,11 +19,14 @@ package org.apache.maven.lifecycle.internal;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.lifecycle.Schedule;
|
||||
import org.apache.maven.lifecycle.internal.builder.BuilderCommon;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.plugin.MojoExecution;
|
||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
/**
|
||||
|
@ -38,15 +41,22 @@ public class ExecutionPlanItem
|
|||
{
|
||||
private final MojoExecution mojoExecution;
|
||||
|
||||
private final Schedule schedule;
|
||||
// Completeness just indicates that it has been run or failed
|
||||
|
||||
private final CountDownLatch done = new CountDownLatch( 1 );
|
||||
|
||||
public ExecutionPlanItem( MojoExecution mojoExecution, Schedule schedule )
|
||||
public ExecutionPlanItem( MojoExecution mojoExecution )
|
||||
{
|
||||
this.mojoExecution = mojoExecution;
|
||||
this.schedule = schedule;
|
||||
}
|
||||
|
||||
public static List<ExecutionPlanItem> createExecutionPlanItems( MavenProject mavenProject,
|
||||
List<MojoExecution> executions )
|
||||
{
|
||||
BuilderCommon.attachToThread( mavenProject );
|
||||
|
||||
List<ExecutionPlanItem> result = new ArrayList<ExecutionPlanItem>();
|
||||
for ( MojoExecution mojoExecution : executions )
|
||||
{
|
||||
result.add( new ExecutionPlanItem( mojoExecution ) );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public MojoExecution getMojoExecution()
|
||||
|
@ -59,32 +69,6 @@ public class ExecutionPlanItem
|
|||
return mojoExecution.getLifecyclePhase();
|
||||
}
|
||||
|
||||
public void setComplete()
|
||||
{
|
||||
done.countDown();
|
||||
}
|
||||
|
||||
public boolean isDone()
|
||||
{
|
||||
return done.getCount() < 1;
|
||||
}
|
||||
|
||||
public void forceComplete()
|
||||
{
|
||||
setComplete();
|
||||
}
|
||||
|
||||
public void waitUntilDone()
|
||||
throws InterruptedException
|
||||
{
|
||||
done.await();
|
||||
}
|
||||
|
||||
public Schedule getSchedule()
|
||||
{
|
||||
return schedule;
|
||||
}
|
||||
|
||||
public Plugin getPlugin()
|
||||
{
|
||||
final MojoDescriptor mojoDescriptor = getMojoExecution().getMojoDescriptor();
|
||||
|
@ -94,7 +78,7 @@ public class ExecutionPlanItem
|
|||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "ExecutionPlanItem{" + ", mojoExecution=" + mojoExecution + ", schedule=" + schedule + '}'
|
||||
return "ExecutionPlanItem{" + ", mojoExecution=" + mojoExecution + '}'
|
||||
+ super.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -181,39 +181,4 @@ public class LifecycleDebugLogger
|
|||
logger.debug( "Dependencies (resolve): " + scopesToResolve );
|
||||
}
|
||||
|
||||
public void logWeavePlan( MavenSession session )
|
||||
{
|
||||
if ( !logger.isInfoEnabled() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final ProjectDependencyGraph dependencyGraph = session.getProjectDependencyGraph();
|
||||
logger.info( "=== WEAVE CONCURRENCY BUILD PLAN ======================================" );
|
||||
for ( MavenProject mavenProject : dependencyGraph.getSortedProjects() )
|
||||
{
|
||||
|
||||
StringBuilder item = new StringBuilder();
|
||||
item.append( "Project: " );
|
||||
item.append( mavenProject.getArtifactId() );
|
||||
final List<MavenProject> upstreamProjects = dependencyGraph.getUpstreamProjects( mavenProject, false );
|
||||
if ( upstreamProjects.size() > 0 )
|
||||
{
|
||||
item.append( " ( " );
|
||||
for ( Iterator<MavenProject> it = upstreamProjects.iterator(); it.hasNext(); )
|
||||
{
|
||||
final MavenProject kid = it.next();
|
||||
item.append( kid.getArtifactId() );
|
||||
if ( it.hasNext() )
|
||||
{
|
||||
item.append( ", " );
|
||||
}
|
||||
}
|
||||
item.append( ")" );
|
||||
}
|
||||
logger.info( item.toString() );
|
||||
|
||||
}
|
||||
logger.info( "=======================================================================" );
|
||||
}
|
||||
}
|
|
@ -26,34 +26,6 @@ under the License.
|
|||
-->
|
||||
<component-set>
|
||||
<components>
|
||||
<component>
|
||||
<role>org.apache.maven.lifecycle.DefaultSchedules</role>
|
||||
<implementation>org.apache.maven.lifecycle.DefaultSchedules</implementation>
|
||||
<configuration>
|
||||
<schedules>
|
||||
<scheduling>
|
||||
<lifecycle>default</lifecycle>
|
||||
<schedules>
|
||||
<schedule>
|
||||
<phase>test</phase>
|
||||
<mojoSynchronized>false</mojoSynchronized>
|
||||
<parallel>true</parallel>
|
||||
</schedule>
|
||||
<schedule>
|
||||
<pluginKey>org.apache.maven.plugins:maven-assembly-plugin</pluginKey>
|
||||
<mojoSynchronized>true</mojoSynchronized>
|
||||
</schedule>
|
||||
<schedule>
|
||||
<pluginKey>org.apache.maven.plugins:maven-ear-plugin</pluginKey>
|
||||
<mojoGoal>generate-application-xml</mojoGoal>
|
||||
<upstreamPhase>package</upstreamPhase>
|
||||
</schedule>
|
||||
</schedules>
|
||||
</scheduling>
|
||||
</schedules>
|
||||
</configuration>
|
||||
</component>
|
||||
|
||||
<!-- 'default' lifecycle, without any binding since it is dependent on packaging -->
|
||||
<component>
|
||||
<role>org.apache.maven.lifecycle.Lifecycle</role>
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
package org.apache.maven.lifecycle;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
import org.codehaus.plexus.component.annotations.Requirement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DefaultSchedulesTest
|
||||
extends PlexusTestCase
|
||||
|
||||
{
|
||||
@Requirement
|
||||
DefaultSchedules defaultSchedules;
|
||||
|
||||
public DefaultSchedulesTest()
|
||||
{
|
||||
}
|
||||
|
||||
protected void setUp()
|
||||
throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
defaultSchedules = ( lookup( DefaultSchedules.class ) );
|
||||
}
|
||||
|
||||
public void testScheduling()
|
||||
throws Exception
|
||||
{
|
||||
final List<Scheduling> schedulings = defaultSchedules.getSchedules();
|
||||
DefaultLifecyclesTest.assertNotNull( schedulings );
|
||||
DefaultLifecyclesTest.assertTrue( schedulings.size() > 0 );
|
||||
Scheduling first = schedulings.get( 0 );
|
||||
DefaultLifecyclesTest.assertNotNull( first.getLifecycle() );
|
||||
final List<Schedule> schedules = first.getSchedules();
|
||||
DefaultLifecyclesTest.assertNotNull( schedules );
|
||||
// Ok so if we ever change the first schedule this test will have to change
|
||||
Schedule firstSchedule = schedules.get( 0 );
|
||||
DefaultLifecyclesTest.assertEquals( "test", firstSchedule.getPhase() );
|
||||
DefaultLifecyclesTest.assertTrue( "Should be parllel", firstSchedule.isParallel() );
|
||||
|
||||
}
|
||||
}
|
|
@ -32,24 +32,6 @@ import java.util.Set;
|
|||
public class MavenExecutionPlanTest
|
||||
extends TestCase
|
||||
{
|
||||
public void testFindFirstWithMatchingSchedule()
|
||||
throws Exception
|
||||
{
|
||||
final List<Scheduling> cycles = DefaultLifecyclesStub.getSchedulingList();
|
||||
final Schedule schedule = cycles.get( 0 ).getSchedules().get( 0 );
|
||||
assertNotNull( schedule );
|
||||
|
||||
}
|
||||
|
||||
public void testForceAllComplete()
|
||||
throws Exception
|
||||
{
|
||||
MavenExecutionPlan plan = LifecycleExecutionPlanCalculatorStub.getProjectAExceutionPlan();
|
||||
plan.forceAllComplete();
|
||||
final Iterator<ExecutionPlanItem> planItemIterator = plan.iterator();
|
||||
assertTrue( planItemIterator.next().isDone() );
|
||||
assertTrue( planItemIterator.next().isDone() );
|
||||
}
|
||||
|
||||
public void testFindLastInPhase()
|
||||
throws Exception
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
package org.apache.maven.lifecycle.internal;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
|
||||
* agreements. See the NOTICE file distributed with this work for additional information regarding
|
||||
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
||||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.maven.lifecycle.Schedule;
|
||||
import org.apache.maven.lifecycle.internal.stub.MojoExecutorStub;
|
||||
import org.apache.maven.plugin.MojoExecution;
|
||||
|
||||
/**
|
||||
* @author Kristian Rosenvold
|
||||
*/
|
||||
public class ExecutionPlanItemTest
|
||||
extends TestCase
|
||||
{
|
||||
|
||||
public void testSetComplete()
|
||||
throws Exception
|
||||
{
|
||||
ExecutionPlanItem item = createExecutionPlanItem( "testMojo", null );
|
||||
item.setComplete(); // This itself is a valid test
|
||||
assertTrue( item.isDone() );
|
||||
}
|
||||
|
||||
public void testWaitUntilDone()
|
||||
throws Exception
|
||||
{
|
||||
|
||||
final ExecutionPlanItem item =
|
||||
createExecutionPlanItem( "testMojo", createExecutionPlanItem( "testMojo2", null ) );
|
||||
new Thread( new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
item.setComplete();
|
||||
}
|
||||
} ).start();
|
||||
item.waitUntilDone();
|
||||
}
|
||||
|
||||
|
||||
public static ExecutionPlanItem createExecutionPlanItem( String mojoDescription, ExecutionPlanItem downStream )
|
||||
{
|
||||
return createExecutionPlanItem( mojoDescription, downStream, null );
|
||||
}
|
||||
|
||||
public static ExecutionPlanItem createExecutionPlanItem( String mojoDescription, ExecutionPlanItem downStream,
|
||||
Schedule schedule )
|
||||
{
|
||||
return new ExecutionPlanItem( new MojoExecution( MojoExecutorStub.createMojoDescriptor( mojoDescription ) ),
|
||||
schedule );
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -20,7 +20,6 @@ import org.apache.maven.execution.MavenSession;
|
|||
import org.apache.maven.lifecycle.MavenExecutionPlan;
|
||||
import org.apache.maven.lifecycle.internal.stub.BuildPluginManagerStub;
|
||||
import org.apache.maven.lifecycle.internal.stub.DefaultLifecyclesStub;
|
||||
import org.apache.maven.lifecycle.internal.stub.DefaultSchedulesStub;
|
||||
import org.apache.maven.lifecycle.internal.stub.PluginPrefixResolverStub;
|
||||
import org.apache.maven.lifecycle.internal.stub.PluginVersionResolverStub;
|
||||
import org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub;
|
||||
|
@ -64,8 +63,7 @@ public class LifecycleExecutionPlanCalculatorTest
|
|||
LifecyclePluginResolver lifecyclePluginResolver = new LifecyclePluginResolver( new PluginVersionResolverStub() );
|
||||
return new DefaultLifecycleExecutionPlanCalculator( new BuildPluginManagerStub(),
|
||||
DefaultLifecyclesStub.createDefaultLifecycles(),
|
||||
mojoDescriptorCreator, lifecyclePluginResolver,
|
||||
DefaultSchedulesStub.createDefaultSchedules() );
|
||||
mojoDescriptorCreator, lifecyclePluginResolver );
|
||||
}
|
||||
|
||||
public static MojoDescriptorCreator createMojoDescriptorCreator()
|
||||
|
|
|
@ -17,8 +17,6 @@ package org.apache.maven.lifecycle.internal.stub;
|
|||
|
||||
import org.apache.maven.lifecycle.DefaultLifecycles;
|
||||
import org.apache.maven.lifecycle.Lifecycle;
|
||||
import org.apache.maven.lifecycle.Schedule;
|
||||
import org.apache.maven.lifecycle.Scheduling;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
@ -62,9 +60,4 @@ public class DefaultLifecyclesStub
|
|||
return new DefaultLifecycles( lifeCycles, new LoggerStub() );
|
||||
}
|
||||
|
||||
public static List<Scheduling> getSchedulingList()
|
||||
{
|
||||
return Arrays.asList( new Scheduling( "default", Arrays.asList( new Schedule( "compile", false, false ),
|
||||
new Schedule( "test", false, true ) ) ) );
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
|
||||
* agreements. See the NOTICE file distributed with this work for additional information regarding
|
||||
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
||||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package org.apache.maven.lifecycle.internal.stub;
|
||||
|
||||
import org.apache.maven.lifecycle.DefaultSchedules;
|
||||
import org.apache.maven.lifecycle.Schedule;
|
||||
import org.apache.maven.lifecycle.Scheduling;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Kristian Rosenvold
|
||||
*/
|
||||
|
||||
public class DefaultSchedulesStub
|
||||
{
|
||||
public static DefaultSchedules createDefaultSchedules()
|
||||
{
|
||||
return new DefaultSchedules( getSchedulingList() );
|
||||
}
|
||||
|
||||
public static List<Scheduling> getSchedulingList()
|
||||
{
|
||||
return Arrays.asList( new Scheduling( "default", Arrays.asList( new Schedule( "compile", false, false ),
|
||||
new Schedule( "test", false, true ) ) ) );
|
||||
}
|
||||
}
|
|
@ -186,7 +186,7 @@ public class LifecycleExecutionPlanCalculatorStub
|
|||
LifecyclePhaseNotFoundException, LifecycleNotFoundException
|
||||
{
|
||||
final List<ExecutionPlanItem> planItemList =
|
||||
DefaultSchedulesStub.createDefaultSchedules().createExecutionPlanItem( project, mojoExecutions );
|
||||
ExecutionPlanItem.createExecutionPlanItems( project, mojoExecutions );
|
||||
return new MavenExecutionPlan( planItemList, DefaultLifecyclesStub.createDefaultLifecycles() );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue