Working on: MNG-662

o Cleaned up resume functionality, and checkpointing for the release:prepare mojo.

TODO:

- Add testing of some sort
- Verify that maven-scm's checkin function is recursive (suspect it's not)



git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@227150 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-08-03 03:11:03 +00:00
parent 8f4b0deaaf
commit 786091aa6c
2 changed files with 22 additions and 15 deletions

View File

@ -166,7 +166,7 @@ public class PrepareReleaseMojo
getLog().warn( "Error writing checkpoint.", e );
}
if ( !getReleaseProgress().reachedCheckpoint( ReleaseProgressTracker.CP_PREPARED_RELEASE ) )
if ( !getReleaseProgress().verifyCheckpoint( ReleaseProgressTracker.CP_PREPARED_RELEASE ) )
{
checkForLocalModifications();
@ -228,7 +228,7 @@ public class PrepareReleaseMojo
private void transformPomToSnapshotVersionPom( MavenProject project )
throws MojoExecutionException
{
if ( !getReleaseProgress().reachedCheckpoint( ReleaseProgressTracker.CP_POM_TRANSORMED_FOR_DEVELOPMENT ) )
if ( !getReleaseProgress().verifyCheckpoint( ReleaseProgressTracker.CP_POM_TRANSORMED_FOR_DEVELOPMENT ) )
{
if ( isSnapshot( project.getVersion() ) )
{
@ -373,7 +373,7 @@ public class PrepareReleaseMojo
try
{
releaseProgress = ReleaseProgressTracker.load( basedir );
releaseProgress.verifyResumeCapable();
}
catch ( IOException e )
@ -395,6 +395,8 @@ public class PrepareReleaseMojo
+ ". Creating new instance." );
}
releaseProgress.setResumeAtCheckpoint( resume );
releaseProgress.setUsername( username );
if ( password != null )
@ -441,7 +443,7 @@ public class PrepareReleaseMojo
private void checkForLocalModifications()
throws MojoExecutionException
{
if ( !getReleaseProgress().reachedCheckpoint( ReleaseProgressTracker.CP_LOCAL_MODIFICATIONS_CHECKED ) )
if ( !getReleaseProgress().verifyCheckpoint( ReleaseProgressTracker.CP_LOCAL_MODIFICATIONS_CHECKED ) )
{
getLog().info( "Verifying there are no local modifications ..." );
@ -512,7 +514,7 @@ public class PrepareReleaseMojo
private void checkForPresenceOfSnapshots( MavenProject project )
throws MojoExecutionException
{
if ( !getReleaseProgress().reachedCheckpoint( ReleaseProgressTracker.CP_SNAPSHOTS_CHECKED ) )
if ( !getReleaseProgress().verifyCheckpoint( ReleaseProgressTracker.CP_SNAPSHOTS_CHECKED ) )
{
getLog().info( "Checking lineage for snapshots ..." );
@ -612,7 +614,7 @@ public class PrepareReleaseMojo
private void transformPomToReleaseVersionPom( MavenProject project )
throws MojoExecutionException
{
if ( !getReleaseProgress().reachedCheckpoint( ReleaseProgressTracker.CP_POM_TRANSFORMED_FOR_RELEASE ) )
if ( !getReleaseProgress().verifyCheckpoint( ReleaseProgressTracker.CP_POM_TRANSFORMED_FOR_RELEASE ) )
{
if ( !isSnapshot( project.getVersion() ) )
{
@ -751,7 +753,7 @@ public class PrepareReleaseMojo
private void generateReleasePom( MavenProject project )
throws MojoExecutionException
{
if ( !getReleaseProgress().reachedCheckpoint( ReleaseProgressTracker.CP_GENERATED_RELEASE_POM ) )
if ( !getReleaseProgress().verifyCheckpoint( ReleaseProgressTracker.CP_GENERATED_RELEASE_POM ) )
{
MavenProject releaseProject = new MavenProject( project );
Model releaseModel = releaseProject.getModel();
@ -947,7 +949,7 @@ public class PrepareReleaseMojo
private void checkInRelease()
throws MojoExecutionException
{
if ( !getReleaseProgress().reachedCheckpoint( ReleaseProgressTracker.CP_CHECKED_IN_RELEASE_VERSION ) )
if ( !getReleaseProgress().verifyCheckpoint( ReleaseProgressTracker.CP_CHECKED_IN_RELEASE_VERSION ) )
{
checkIn( "**/pom.xml,**/release-pom.xml", "[maven-release-plugin] prepare release" );
@ -965,7 +967,7 @@ public class PrepareReleaseMojo
private void removeReleasePoms()
throws MojoExecutionException
{
if ( !getReleaseProgress().reachedCheckpoint( ReleaseProgressTracker.CP_REMOVED_RELEASE_POM ) )
if ( !getReleaseProgress().verifyCheckpoint( ReleaseProgressTracker.CP_REMOVED_RELEASE_POM ) )
{
File currentReleasePomFile = null;
@ -1028,7 +1030,7 @@ public class PrepareReleaseMojo
private void checkInNextSnapshot()
throws MojoExecutionException
{
if ( !getReleaseProgress().reachedCheckpoint( ReleaseProgressTracker.CP_CHECKED_IN_DEVELOPMENT_VERSION ) )
if ( !getReleaseProgress().verifyCheckpoint( ReleaseProgressTracker.CP_CHECKED_IN_DEVELOPMENT_VERSION ) )
{
checkIn( "**/pom.xml", "[maven-release-plugin] prepare for next development iteration" );
@ -1113,7 +1115,7 @@ public class PrepareReleaseMojo
private void tagRelease()
throws MojoExecutionException
{
if ( !getReleaseProgress().reachedCheckpoint( ReleaseProgressTracker.CP_TAGGED_RELEASE ) )
if ( !getReleaseProgress().verifyCheckpoint( ReleaseProgressTracker.CP_TAGGED_RELEASE ) )
{
String tag = getTagLabel();

View File

@ -5,11 +5,9 @@ import org.codehaus.plexus.util.IOUtil;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Date;
import java.util.Properties;
@ -54,6 +52,8 @@ public class ReleaseProgressTracker
private Properties releaseProperties;
private boolean resumeAtCheckpoint = false;
private ReleaseProgressTracker()
{
}
@ -230,11 +230,16 @@ public class ReleaseProgressTracker
releaseProperties.setProperty( CHECKPOINT_PREFIX + pointName, "OK" );
}
public boolean reachedCheckpoint( String pointName )
public boolean verifyCheckpoint( String pointName )
{
checkLoaded();
return "OK".equals( releaseProperties.getProperty( CHECKPOINT_PREFIX + pointName ) );
return resumeAtCheckpoint && "OK".equals( releaseProperties.getProperty( CHECKPOINT_PREFIX + pointName ) );
}
public void setResumeAtCheckpoint( boolean resumeAtCheckpoint )
{
this.resumeAtCheckpoint = resumeAtCheckpoint;
}
}