Skip to content

Commit

Permalink
MRELEASE-909: (Re)Added workItem support.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Graham committed Dec 30, 2018
1 parent 2d03086 commit cc724a1
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,18 @@ public interface ReleaseDescriptor
*/
boolean isPushChanges();

/**
* Get default version to use for new working copy.
*
* Some SCMs may require a Work Item or a Task to allow the
* changes to be pushed or delivered.
* This field allows you to specify that Work Item
* or Task. It is optional, and only relevant if pushChanges is true.
*
* @return String
*/
String getWorkItem();

/**
* Get default version to use for new working copy.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ public void write( BuilderReleaseDescriptor config, File file )

properties.setProperty( "pushChanges", Boolean.toString( config.isPushChanges() ) );

if ( config.getWorkItem() != null )
{
properties.setProperty( "workItem", config.getWorkItem() );
}

// others boolean properties are not written to the properties file because the value from the caller is always
// used

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ public ReleaseDescriptorBuilder setPushChanges( boolean pushChanges )
return this;
}

public ReleaseDescriptorBuilder setWorkItem( String workItem )
{
releaseDescriptor.setWorkItem( workItem );
return this;
}

public ReleaseDescriptorBuilder setReleaseStrategyId( String releaseStrategyId )
{
releaseDescriptor.setReleaseStrategyId( releaseStrategyId );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ public static void copyPropertiesToReleaseDescriptor( Properties properties, Rel
String pushChanges = properties.getProperty( "pushChanges" );
builder.setPushChanges( Boolean.valueOf( pushChanges ) );
}
if ( properties.containsKey( "workItem" ) )
{
builder.setWorkItem( properties.getProperty( "workItem" ) );
}

loadResolvedDependencies( properties, builder );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ protected void performCheckins( ReleaseDescriptor releaseDescriptor, ReleaseEnvi

repository.getProviderRepository().setPushChanges( releaseDescriptor.isPushChanges() );

repository.getProviderRepository().setWorkItem( releaseDescriptor.getWorkItem() );

provider = scmRepositoryConfigurator.getRepositoryProvider( repository );
}
catch ( ScmRepositoryException e )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnviro

repository.getProviderRepository().setPushChanges( releaseDescriptor.isPushChanges() );

repository.getProviderRepository().setWorkItem( releaseDescriptor.getWorkItem() );

provider = scmRepositoryConfigurator.getRepositoryProvider( repository );

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnviro

repository.getProviderRepository().setPushChanges( releaseDescriptor.isPushChanges() );

repository.getProviderRepository().setWorkItem( releaseDescriptor.getWorkItem() );

provider = scmRepositoryConfigurator.getRepositoryProvider( repository );
}
catch ( ScmRepositoryException e )
Expand Down
17 changes: 13 additions & 4 deletions maven-release-manager/src/main/mdo/release-descriptor.mdo
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,17 @@
</description>
</field>

<field>
<name>workItem</name>
<version>3.0.0+</version>
<type>String</type>
<description>
Some SCMs may require a Work Item or a Task to allow the changes to be pushed or delivered.
This field allows you to specify that Work Item or Task. It is optional, and only relevant
if pushChanges is true.
</description>
</field>

<!-- Announcement Information
Announcement related info, this can be a second part of the process.
Expand Down Expand Up @@ -750,6 +761,7 @@
!java.util.Objects.equals( checkoutDirectory, that.getCheckoutDirectory() ) ||
!java.util.Objects.equals( performGoals, that.getPerformGoals() ) ||
!java.util.Objects.equals( defaultReleaseVersion, that.getDefaultReleaseVersion() ) ||
!java.util.Objects.equals( workItem, that.getWorkItem() ) ||
!java.util.Objects.equals( scmReleasedPomRevision, that.getScmReleasedPomRevision() )
)
{
Expand Down Expand Up @@ -861,10 +873,6 @@
{
return false;
}
if ( !java.util.Objects.equals( scmTagNameFormat, that.getScmTagNameFormat() ) )
{
return false;
}
if ( !java.util.Objects.deepEquals( projectVersions, that.getProjectVersions() ) )
{
return false;
Expand Down Expand Up @@ -989,6 +997,7 @@
result = 29 * result + java.util.Objects.hashCode( performGoals );
result = 29 * result + java.util.Objects.hashCode( defaultReleaseVersion );
result = 29 * result + java.util.Objects.hashCode( scmReleasedPomRevision );
result = 29 * result + java.util.Objects.hashCode( workItem );
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,16 @@ public abstract class AbstractScmReleaseMojo
private boolean pushChanges = true;

/**
* Add a new or overwrite the default implementation per provider.
* A workItem for SCMs like RTC, TFS etc, that may require additional
* information to perform a pushChange operation.
*
* @since 3.0.0
*/
@Parameter( property = "workItem" )
private String workItem;

/**
* Add a new or overwrite the default implementation per provider.
* The key is the scm prefix and the value is the role hint of the
* {@link org.apache.maven.scm.provider.ScmProvider}.
*
Expand Down Expand Up @@ -142,6 +151,7 @@ protected ReleaseDescriptorBuilder createReleaseDescriptor()
descriptor.setScmCommentPrefix( scmCommentPrefix );

descriptor.setPushChanges( pushChanges );
descriptor.setWorkItem( workItem );

if ( project.getScm() != null )
{
Expand Down

0 comments on commit cc724a1

Please sign in to comment.