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

View File

@ -1,7 +1,7 @@
# Available settings currently only CVS # Available settings currently only CVS
maven.scm.method= maven.scm.method=
# Directory to checkout to # 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 # Set to true if you want to ignore the connection parameter in the POM
maven.scm.ignore.pom.connection=false maven.scm.ignore.pom.connection=false

View File

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

View File

@ -6,6 +6,24 @@
</properties> </properties>
<body> <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"> <release version="1.1" date="2003-09-29">
<action dev="dion" type="update"> <action dev="dion" type="update">
Apply MAVEN-834. Support for scm delimiters other than ':' Apply MAVEN-834. Support for scm delimiters other than ':'