brett       2004/02/25 14:38:16

  Modified:    scm      plugin.jelly plugin.properties project.xml
               scm/xdocs changes.xml
  Log:
  bugfixes, improvements
  
  Revision  Changes    Path
  1.6       +64 -47    maven-plugins/scm/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/maven-plugins/scm/plugin.jelly,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- plugin.jelly      23 Feb 2004 00:45:52 -0000      1.5
  +++ plugin.jelly      25 Feb 2004 22:38:16 -0000      1.6
  @@ -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: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: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"
  +      />
  +    </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" />
  +    />
  +
  +    <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] prepare a release' project.xml"
  +    <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 ${tag_name}"
  +    <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 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"
  -      />
  +    />
     </goal>
   </project>
   
  
  
  
  1.3       +1 -1      maven-plugins/scm/plugin.properties
  
  Index: plugin.properties
  ===================================================================
  RCS file: /home/cvs/maven-plugins/scm/plugin.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- plugin.properties 31 Aug 2003 07:14:49 -0000      1.2
  +++ plugin.properties 25 Feb 2004 22:38:16 -0000      1.3
  @@ -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
   
  
  
  
  1.9       +2 -1      maven-plugins/scm/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/scm/project.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- project.xml       23 Feb 2004 00:45:52 -0000      1.8
  +++ project.xml       25 Feb 2004 22:38:16 -0000      1.9
  @@ -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>
  +
  
  
  
  1.5       +18 -0     maven-plugins/scm/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/scm/xdocs/changes.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- changes.xml       29 Sep 2003 06:27:57 -0000      1.4
  +++ changes.xml       25 Feb 2004 22:38:16 -0000      1.5
  @@ -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 ':'
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to