bugfixes, improvements

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114746 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
brett 2004-02-25 22:38:16 +00:00
parent f7c6c104c4
commit df358002f4
4 changed files with 92 additions and 56 deletions

View File

@ -3,6 +3,8 @@
<project
xmlns:j="jelly:core"
xmlns:i="jelly:interaction"
xmlns:r="release:transform"
xmlns:c="changes:transform"
xmlns:log="jelly:log"
xmlns:ant="jelly:ant"
xmlns:doc="doc"
@ -14,7 +16,7 @@
<!--==================================================================-->
<!-- Goal to validate SCM properties -->
<!--==================================================================-->
<goal name="scm:validate">
<goal name="scm:parse-connection">
<j:set var="value" value="${maven.scm.ignore.pom.connection}"/>
<j:if test="${!value}">
<j:set var="value" value="${pom.repository.connection}"/>
@ -32,14 +34,24 @@
<j:set var="scmMethod" value="${maven.scm.method}"/>
<log:info>Using SCM method: ${scmMethod}</log:info>
<j:if test="${scmMethod == 'cvs'}">
<j:set var="maven.scm.cvs.root" value=":${tokens[2]}:${tokens[3]}:${tokens[4]}"/>
<j:set var="maven.scm.cvs.module" value="${tokens[5]}"/>
<j:choose>
<j:when test="${tokens[2] == 'local'}">
<j:set var="maven.scm.cvs.root" value=":${tokens[2]}:${tokens[3]}"/>
<j:set var="maven.scm.cvs.module" value="${tokens[4]}"/>
</j:when>
<j:otherwise>
<j:set var="maven.scm.cvs.root" value=":${tokens[2]}:${tokens[3]}:${tokens[4]}"/>
<j:set var="maven.scm.cvs.module" value="${tokens[5]}"/>
</j:otherwise>
</j:choose>
<log:info>Using CVSROOT: ${maven.scm.cvs.root}</log:info>
<log:info>Using module: ${maven.scm.cvs.module}</log:info>
</j:if>
</j:if>
</j:if>
</goal>
<goal name="scm:validate" prereqs="scm:parse-connection">
<j:choose>
<j:when test="${scmMethod == 'cvs'}">
<j:set var="cvsModule" value="${maven.scm.cvs.module}"/>
@ -104,7 +116,7 @@
<!-- TODO: we should be able to select what to deploy and so on, -->
<!-- tie in with multiproject-by-groupId idea -->
<!--==================================================================-->
<goal name="scm:perform-release"
<goal name="scm:perform-release" prereqs="scm:parse-connection"
description="Perform a release from SCM">
<!-- Setup variables -->
<j:choose>
@ -130,10 +142,7 @@
<j:if test="${empty(goals)}">
<i:ask question="What goals are you using to build?" answer="maven.scm.bootstrap.goals" default="multiproject:deploy" />
</j:if>
<!-- TODO: too slow pre-rc1!
<attainGoal name="scm:bootstrap-project" />
-->
<attainGoal name="scm:checkout-project" />
<!-- TODO: check tagged syntax ok with other SCM than CVS, including in docs -->
<j:set var="checkTagged" value="${maven.scm.check.tagged}"/>
<j:if test="${checkTagged}">
@ -151,9 +160,7 @@
<ant:fail>Cancelled by response '${ok}'</ant:fail>
</j:if>
</j:if>
<ant:exec dir="${maven.scm.checkout.dir}/${maven.scm.cvs.module}" executable="maven" failonerror="true">
<ant:arg line="${maven.scm.bootstrap.goals}"/>
</ant:exec>
<attainGoal name="scm:bootstrap-project" />
</j:if>
</goal>
@ -201,35 +208,53 @@
<!--==================================================================-->
<!-- Prepare Release - CVS -->
<!-- TODO: this should be amalgamated with release plugin -->
<!--==================================================================-->
<goal name="scm:cvs-prepare-release">
<log:info>Verifying no modifications are present</log:info>
<j:set var="changesFilename" value="${maven.docs.src}/changes.xml" />
<util:file var="file" name="${changesFilename}"/>
<j:set var="changesExists" value="${file.exists()}" />
<!-- Need to move POM out of the way as mods there are allowed -->
<ant:copy file="project.xml" tofile="temp_project.xml" />
<ant:cvs command="update -C project.xml"
quiet="${maven.scm.cvs.quiet}"
cvsRsh="${maven.scm.cvs.rsh}"
cvsRoot="${maven.scm.cvs.root}"
failonerror="true"
<ant:move file="project.xml" tofile="project.xml.SCM.temp" />
<j:set var="documents" value="project.xml" />
<j:if test="${changesExists}">
<maven:makeRelativePath basedir="${basedir}" path="${changesFilename}" var="changesFilename" />
<util:replace var="changesFilename" value="${changesFilename}" oldChar="\\" newChar="/" />
<j:set var="documents" value="${documents} ${changesFilename}" />
<ant:move file="${changesFilename}" tofile="${changesFilename}.SCM.temp" />
</j:if>
<j:catch var="exception">
<ant:cvs command="update ${documents}"
quiet="${maven.scm.cvs.quiet}"
cvsRsh="${maven.scm.cvs.rsh}"
cvsRoot="${maven.scm.cvs.root}"
failonerror="true"
/>
<ant:cvs command="tag -c dummy_tag"
noexec="true"
quiet="${maven.scm.cvs.quiet}"
cvsRsh="${maven.scm.cvs.rsh}"
cvsRoot="${maven.scm.cvs.root}"
failonerror="true"
<ant:cvs command="tag -c dummy_tag"
noexec="true"
quiet="${maven.scm.cvs.quiet}"
cvsRsh="${maven.scm.cvs.rsh}"
cvsRoot="${maven.scm.cvs.root}"
failonerror="true"
/>
</j:catch>
<ant:move file="project.xml.SCM.temp" tofile="project.xml" />
<j:if test="${changesExists}">
<ant:move file="${changesFilename}.SCM.temp" tofile="${changesFilename}" />
</j:if>
<j:if test="${exception != null}">
<ant:fail>${exception}</ant:fail>
</j:if>
<i:ask
question="What is the new tag name?"
answer="tag_name"
default="${tag_name}"
/>
/>
<i:ask
question="What is the new version?"
answer="version_name"
default="${tag_name}"
/>
/>
<log:info>Verifying valid tag name</log:info>
<ant:cvs command="tag ${tag_name} project.xml"
noexec="true"
@ -237,35 +262,27 @@
cvsRsh="${maven.scm.cvs.rsh}"
cvsRoot="${maven.scm.cvs.root}"
failonerror="true"
/>
<ant:move file="temp_project.xml" tofile="project.xml" />
<log:info>Modifying POM with tag = ${tag_name}; version = ${version_name}</log:info>
<attainGoal name="scm:update-pom" />
<log:info>Committing new POM</log:info>
<ant:cvs command="commit -m '[maven-scm] prepare a release' project.xml"
quiet="${maven.scm.cvs.quiet}"
cvsRsh="${maven.scm.cvs.rsh}"
cvsRoot="${maven.scm.cvs.root}"
failonerror="true"
/>
<log:info>Tagging source tree</log:info>
<ant:cvs command="tag ${tag_name}"
quiet="${maven.scm.cvs.quiet}"
cvsRsh="${maven.scm.cvs.rsh}"
cvsRoot="${maven.scm.cvs.root}"
failonerror="true"
/>
</goal>
/>
<goal name="scm:update-pom">
<doc:jslFile
input="${basedir}/project.xml"
output="${basedir}/project.xml"
stylesheet="${plugin.resources}/pom-release.jsl"
outputMode="xml"
omitXmlDeclaration="false"
prettyPrint="false"
/>
<r:release-version version="${version_name}" tag="${tag_name}" />
<j:if test="${changesExists}">
<c:release-version version="${version_name}" />
</j:if>
<log:info>Committing new POM</log:info>
<ant:cvs command="commit -m '[maven-scm-plugin] prepare release ${version_name}' ${documents}"
quiet="${maven.scm.cvs.quiet}"
cvsRsh="${maven.scm.cvs.rsh}"
cvsRoot="${maven.scm.cvs.root}"
failonerror="true"
/>
<log:info>Tagging source tree</log:info>
<ant:cvs command="tag -F ${tag_name}"
quiet="${maven.scm.cvs.quiet}"
cvsRsh="${maven.scm.cvs.rsh}"
cvsRoot="${maven.scm.cvs.root}"
failonerror="true"
/>
</goal>
</project>

View File

@ -1,7 +1,7 @@
# Available settings currently only CVS
maven.scm.method=
# Directory to checkout to
maven.scm.checkout.dir=${basedir}/checkouts
maven.scm.checkout.dir=${maven.build.dir}/checkouts
# Set to true if you want to ignore the connection parameter in the POM
maven.scm.ignore.pom.connection=false

View File

@ -6,7 +6,7 @@
<name>Maven Source Control Management Plug-in</name>
<currentVersion>1.2-SNAPSHOT</currentVersion>
<description>A plugin for SCM tasks, currently CVS.</description>
<shortDescription>SCM Plugin for Maven</shortDescription>
<shortDescription>SCM Plugin for Maven. Requires Maven 1.0 RC2.</shortDescription>
<url>http://maven.apache.org/reference/plugins/scm/</url>
<siteDirectory>/www/maven.apache.org/reference/plugins/scm/</siteDirectory>
<repository>
@ -50,3 +50,4 @@
</dependency>
</dependencies>
</project>

View File

@ -6,6 +6,24 @@
</properties>
<body>
<release version="1.2-SNAPSHOT" date="in CVS">
<action dev="brett" type="fix">
Don't use -C - Mac OS X doesn't recognise it
</action>
<action dev="brett" type="fix" issue="MPSCM-3">
Catch exceptions to make sure files don't get moved permanently.
</action>
<action dev="brett" type="fix" issue="MPSCM-4">
Update POM using dom4j instead of JSL - no more formatting issues.
</action>
<action dev="brett" type="fix">
Support :local: CVS paths
</action>
<action dev="brett" type="add">
Update changes.xml version and release date on prepare.
</action>
</release>
<release version="1.1" date="2003-09-29">
<action dev="dion" type="update">
Apply MAVEN-834. Support for scm delimiters other than ':'