Permalink
Browse files

[maven-scm] copy for tag maven-release-1

  • Loading branch information...
1 parent 81dab07 commit b790f5d7cff3bdcc19d94433084019795cb4f003 Jesse McConnell committed Apr 13, 2007
View
27 maven-release-manager/pom.xml
@@ -79,52 +79,57 @@
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-api</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0-rc1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-manager-plexus</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0-rc1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-bazaar</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0-rc1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-clearcase</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0-rc1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-cvsexe</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0-rc1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-cvsjava</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0-rc1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.scm</groupId>
+ <artifactId>maven-scm-provider-hg</artifactId>
+ <version>1.0-rc1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-perforce</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0-rc1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-starteam</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0-rc1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-svnexe</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0-rc1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-synergy</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0-rc1</version>
</dependency>
<dependency>
<groupId>jdom</groupId>
@@ -164,7 +169,7 @@
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-test</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0-rc1</version>
<scope>test</scope>
</dependency>
<dependency>
View
37 ...-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java
@@ -21,6 +21,7 @@
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.ScmTag;
import org.apache.maven.scm.command.checkout.CheckOutScmResult;
import org.apache.maven.scm.manager.NoSuchScmProviderException;
import org.apache.maven.scm.provider.ScmProvider;
@@ -244,7 +245,7 @@ public void rollback( ReleaseDescriptor releaseDescriptor, Settings settings, Li
releaseDescriptor = loadReleaseDescriptor( releaseDescriptor, null );
- for( Iterator phases = rollbackPhases.iterator(); phases.hasNext(); )
+ for ( Iterator phases = rollbackPhases.iterator(); phases.hasNext(); )
{
String name = (String) phases.next();
@@ -395,8 +396,8 @@ private void perform( ReleaseDescriptor releaseDescriptor, Settings settings, Li
CheckOutScmResult scmResult;
try
{
- scmResult =
- provider.checkOut( repository, new ScmFileSet( checkoutDirectory ), config.getScmReleaseLabel() );
+ scmResult = provider.checkOut( repository, new ScmFileSet( checkoutDirectory ),
+ new ScmTag( config.getScmReleaseLabel() ) );
}
catch ( ScmException e )
{
@@ -430,7 +431,8 @@ private void perform( ReleaseDescriptor releaseDescriptor, Settings settings, Li
try
{
- mavenExecutor.executeGoals( checkoutDirectory, goals, config.isInteractive(), additionalArguments,
+ File workingDirectory = determineWorkingDirectory(checkoutDirectory, scmResult.getRelativePathProjectDirectory());
+ mavenExecutor.executeGoals( workingDirectory, goals, config.isInteractive(), additionalArguments,
config.getPomFileName(), result );
}
catch ( MavenExecutorException e )
@@ -449,7 +451,32 @@ private void perform( ReleaseDescriptor releaseDescriptor, Settings settings, Li
updateListener( listener, "perform", GOAL_END );
}
- private ReleaseDescriptor loadReleaseDescriptor( ReleaseDescriptor releaseDescriptor, ReleaseManagerListener listener )
+ /**
+ * Determines the path of the working directory. By default, this is the
+ * checkout directory. For some SCMs, the project root directory is not the
+ * checkout directory itself, but a SCM-specific subdirectory.
+ *
+ * @param checkoutDirectory
+ * The checkout directory as java.io.File
+ * @param relativePathProjectDirectory
+ * The relative path of the project directory within the checkout
+ * directory or ""
+ * @return The working directory
+ */
+ protected File determineWorkingDirectory( File checkoutDirectory, String relativePathProjectDirectory)
+ {
+ if ( StringUtils.isNotEmpty( relativePathProjectDirectory ) )
+ {
+ return new File( checkoutDirectory, relativePathProjectDirectory );
+ }
+ else
+ {
+ return checkoutDirectory;
+ }
+ }
+
+ private ReleaseDescriptor loadReleaseDescriptor( ReleaseDescriptor releaseDescriptor,
+ ReleaseManagerListener listener )
throws ReleaseExecutionException
{
try
View
3 ...n-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitPhase.java
@@ -94,7 +94,8 @@ public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, Settings sett
try
{
ScmFileSet fileSet = new ScmFileSet( new File( releaseDescriptor.getWorkingDirectory() ), files );
- result = provider.checkIn( repository, fileSet, null, createMessage( releaseDescriptor ) );
+ //TODO: Use ScmVersion instead of String for the branch/tag/revision parameter
+ result = provider.checkIn( repository, fileSet, (String) null, createMessage( releaseDescriptor ) );
}
catch ( ScmException e )
{
View
3 maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmTagPhase.java
@@ -82,7 +82,8 @@ public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, Settings sett
{
// TODO: want includes/excludes?
ScmFileSet fileSet = new ScmFileSet( new File( releaseDescriptor.getWorkingDirectory() ) );
- result = provider.tag( repository, fileSet, releaseDescriptor.getScmReleaseLabel() );
+ String tagName = releaseDescriptor.getScmReleaseLabel();
+ result = provider.tag( repository, fileSet, tagName, "[maven-release-manager] copy for tag " + tagName );
}
catch ( ScmException e )
{
View
46 ...ase-manager/src/main/java/org/apache/maven/shared/release/scm/ClearCaseScmTranslator.java
@@ -0,0 +1,46 @@
+package org.apache.maven.shared.release.scm;
+
+/*
+ * 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.
+ */
+
+/**
+ * ClearCase tag translator.
+ *
+ * @author <a href="mailto:arne@degenring.com">Arne Degenring</a>
+ */
+public class ClearCaseScmTranslator
+ implements ScmTranslator
+{
+ public String translateTagUrl( String url, String tag, String tagBase )
+ {
+ return url;
+ }
+
+ public String resolveTag( String tag )
+ {
+ if ( !"HEAD".equals( tag ) )
+ {
+ return tag;
+ }
+ else
+ {
+ return null;
+ }
+ }
+}
View
3 ...se-manager/src/main/java/org/apache/maven/shared/release/scm/SubversionScmTranslator.java
@@ -19,6 +19,7 @@
* under the License.
*/
+import org.apache.maven.scm.ScmTag;
import org.apache.maven.scm.provider.svn.SvnTagBranchUtils;
/**
@@ -31,7 +32,7 @@
{
public String translateTagUrl( String url, String tag, String tagBase )
{
- return SvnTagBranchUtils.resolveUrl( url, tagBase, SvnTagBranchUtils.SVN_TAGS, tag );
+ return SvnTagBranchUtils.resolveUrl( url, tagBase, SvnTagBranchUtils.SVN_TAGS, new ScmTag( tag ) );
}
public String resolveTag( String tag )
View
5 maven-release-manager/src/main/resources/META-INF/plexus/components.xml
@@ -266,6 +266,11 @@
<implementation>org.apache.maven.shared.release.scm.CvsScmTranslator</implementation>
</component>
<component>
+ <role>org.apache.maven.shared.release.scm.ScmTranslator</role>
+ <role-hint>clearcase</role-hint>
+ <implementation>org.apache.maven.shared.release.scm.ClearCaseScmTranslator</implementation>
+ </component>
+ <component>
<role>org.apache.maven.shared.release.exec.MavenExecutor</role>
<implementation>org.apache.maven.shared.release.exec.ForkedMavenExecutor</implementation>
<requirements>
View
39 ...ease-manager/src/test/java/org/apache/maven/shared/release/DefaultReleaseManagerTest.java
@@ -21,6 +21,7 @@
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.ScmTag;
import org.apache.maven.scm.command.checkout.CheckOutScmResult;
import org.apache.maven.scm.manager.NoSuchScmProviderException;
import org.apache.maven.scm.manager.ScmManager;
@@ -42,10 +43,12 @@
import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException;
import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator;
import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.util.FileUtils;
import org.jmock.Mock;
import org.jmock.core.Constraint;
import org.jmock.core.constraint.IsAnything;
import org.jmock.core.constraint.IsEqual;
+import org.jmock.core.constraint.IsInstanceOf;
import org.jmock.core.constraint.IsNull;
import org.jmock.core.constraint.IsSame;
import org.jmock.core.matcher.InvokeOnceMatcher;
@@ -400,7 +403,7 @@ public void testReleasePerform()
Mock scmProviderMock = new Mock( ScmProvider.class );
constraints = new Constraint[]{new IsAnything(), new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ),
- new IsNull()};
+ new IsInstanceOf( ScmTag.class )};
scmProviderMock.expects( new InvokeOnceMatcher() ).method( "checkOut" ).with( constraints ).will(
new ReturnStub( new CheckOutScmResult( "...", Collections.EMPTY_LIST ) ) );
@@ -429,7 +432,7 @@ public void testReleasePerformNoReleaseProfile()
Mock scmProviderMock = new Mock( ScmProvider.class );
constraints = new Constraint[]{new IsAnything(), new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ),
- new IsNull()};
+ new IsInstanceOf( ScmTag.class )};
scmProviderMock.expects( new InvokeOnceMatcher() ).method( "checkOut" ).with( constraints ).will(
new ReturnStub( new CheckOutScmResult( "...", Collections.EMPTY_LIST ) ) );
@@ -460,7 +463,7 @@ public void testReleasePerformWithArguments()
Mock scmProviderMock = new Mock( ScmProvider.class );
constraints = new Constraint[]{new IsAnything(), new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ),
- new IsNull()};
+ new IsInstanceOf( ScmTag.class )};
scmProviderMock.expects( new InvokeOnceMatcher() ).method( "checkOut" ).with( constraints ).will(
new ReturnStub( new CheckOutScmResult( "...", Collections.EMPTY_LIST ) ) );
@@ -490,7 +493,7 @@ public void testReleasePerformWithArgumentsNoReleaseProfile()
Mock scmProviderMock = new Mock( ScmProvider.class );
constraints = new Constraint[]{new IsAnything(), new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ),
- new IsNull()};
+ new IsInstanceOf( ScmTag.class )};
scmProviderMock.expects( new InvokeOnceMatcher() ).method( "checkOut" ).with( constraints ).will(
new ReturnStub( new CheckOutScmResult( "...", Collections.EMPTY_LIST ) ) );
@@ -519,7 +522,7 @@ public void testReleasePerformWithReleasePropertiesCompleted()
Mock scmProviderMock = new Mock( ScmProvider.class );
constraints = new Constraint[]{new IsAnything(), new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ),
- new IsNull()};
+ new IsInstanceOf( ScmTag.class )};
scmProviderMock.expects( new InvokeOnceMatcher() ).method( "checkOut" ).with( constraints ).will(
new ReturnStub( new CheckOutScmResult( "...", Collections.EMPTY_LIST ) ) );
@@ -741,7 +744,7 @@ public void testReleasePerformExecutionException()
Mock scmProviderMock = new Mock( ScmProvider.class );
constraints = new Constraint[]{new IsAnything(), new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ),
- new IsNull()};
+ new IsInstanceOf( ScmTag.class )};
scmProviderMock.expects( new InvokeOnceMatcher() ).method( "checkOut" ).with( constraints ).will(
new ReturnStub( new CheckOutScmResult( "...", Collections.EMPTY_LIST ) ) );
@@ -760,4 +763,28 @@ public void testReleasePerformExecutionException()
}
}
+ public void testDetermineWorkingDirectory()
+ throws Exception
+ {
+ DefaultReleaseManager defaultReleaseManager = new DefaultReleaseManager();
+
+ File checkoutDir = getTestFile( "target/checkout" );
+ FileUtils.forceDelete( checkoutDir );
+ checkoutDir.mkdirs();
+
+ File projectDir = getTestFile( "target/checkout/my/project" );
+ projectDir.mkdirs();
+
+ // only checkout dir
+ assertEquals( checkoutDir, defaultReleaseManager.determineWorkingDirectory( checkoutDir, "" ) );
+ assertEquals( checkoutDir, defaultReleaseManager.determineWorkingDirectory( checkoutDir, null ) );
+
+ // checkout dir and relative path project dir
+ assertEquals( projectDir, defaultReleaseManager.determineWorkingDirectory( checkoutDir, "my/project" ) );
+ assertEquals( projectDir, defaultReleaseManager.determineWorkingDirectory( checkoutDir, "my/project/" ) );
+ assertEquals( projectDir, defaultReleaseManager.determineWorkingDirectory( checkoutDir, "my"
+ + File.separator + "project" ) );
+
+ FileUtils.forceDelete( checkoutDir);
+ }
}
View
6 ...-release-manager/src/test/java/org/apache/maven/shared/release/phase/ScmTagPhaseTest.java
@@ -78,7 +78,8 @@ public void testTag()
Mock scmProviderMock = new Mock( ScmProvider.class );
Constraint[] arguments =
- new Constraint[]{new IsAnything(), new IsScmFileSetEquals( fileSet ), new IsEqual( "release-label" )};
+ new Constraint[]{new IsAnything(), new IsScmFileSetEquals( fileSet ), new IsEqual( "release-label" ),
+ new IsEqual( "[maven-release-manager] copy for tag release-label" )};
scmProviderMock.expects( new InvokeOnceMatcher() ).method( "tag" ).with( arguments ).will(
new ReturnStub( new TagScmResult( "...", Collections.singletonList( rootProject.getFile() ) ) ) );
@@ -104,7 +105,8 @@ public void testCommitMultiModule()
Mock scmProviderMock = new Mock( ScmProvider.class );
Constraint[] arguments =
- new Constraint[]{new IsAnything(), new IsScmFileSetEquals( fileSet ), new IsEqual( "release-label" )};
+ new Constraint[]{new IsAnything(), new IsScmFileSetEquals( fileSet ), new IsEqual( "release-label" ),
+ new IsEqual( "[maven-release-manager] copy for tag release-label" )};
scmProviderMock.expects( new InvokeOnceMatcher() ).method( "tag" ).with( arguments ).will(
new ReturnStub( new TagScmResult( "...", Collections.singletonList( rootProject.getFile() ) ) ) );
View
15 pom.xml
@@ -18,32 +18,33 @@
~ under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.maven</groupId>
<artifactId>maven-parent</artifactId>
- <version>4</version>
+ <version>5</version>
<relativePath>../pom/maven/pom.xml</relativePath>
</parent>
<groupId>org.apache.maven.release</groupId>
<artifactId>maven-release</artifactId>
- <version>1-SNAPSHOT</version>
+ <version>1</version>
<packaging>pom</packaging>
<name>Maven Release</name>
<issueManagement>
<system>jira</system>
<url>http://jira.codehaus.org/browse/MRELEASE</url>
</issueManagement>
<modules>
+ <!-- Commenting out to release parent pom
<module>maven-release-manager</module>
<module>maven-release-plugin</module>
+ -->
</modules>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/maven/release/trunk</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/release/trunk</developerConnection>
- <url>http://svn.apache.org/viewcvs.cgi/maven/release/trunk</url>
+ <connection>scm:svn:https://svn.apache.org/repos/asf/maven/release/tags/maven-release-1</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/release/tags/maven-release-1</developerConnection>
+ <url>https://svn.apache.org/repos/asf/maven/release/tags/maven-release-1</url>
</scm>
<build>
<pluginManagement>

0 comments on commit b790f5d

Please sign in to comment.