CVS Support Module

Public Targets

TargetDescription
checkoutCVS: checkout new package or module
updateCVS: get latest code updates
checkinCVS: checkin and release all checked out code
cvspassCVS: place cvs.passowrd in .cvspass file

Source: cvs.xml

				<?xml version="1.0" encoding="UTF-8"?>
<project name="cvs" basedir=".">
	<description>
  + ==\_/============J=A=V=A=G=E=N===A=N=T===M=O=D=U=L=E=S================= +
  +  \(_)/                                                                  +
  +  -(_)-                   CVS Support Module                             +
  +  /(_)\                                                                  +
  + ======================================================================= +
  +    Copyright (c) 2002-2005 Outsource Cafe, Inc.  All rights reserved.   +
  + ======================================================================= +
  +
  + CVS support.
  +
  + Public targets:
  +  checkout - checkout new package or module
  +  update   - get latest code updates
  +  checkin  - checkin and release all checked out code
  +
  + Public properties (see source for others):
  +  cvs.root    - cvs protocol/username/host/path string
  +  cvs.package - package or module to checkout
  +  cvs.dir     - directory to run cvs from, usually basedir/..
  +
  + Notes:
  +  Requires 'cvs' client in the path.  Confirm by typing 'cvs' in the shell.
  +
  +  When using a pserver, run cvspass target once before using the other cvs
  +  commands to set the passowrd for a given cvs root in the .cvspass file:
  +    ant -Dcvs.password=secret cvspass
  +
  +  If you try to run checkout target for the first time from within your
  +  project, you will soon discover that the build file does not yet exist!
  +  The checkout target is more useful for automated testing and task initiated
  +  outside of the project.  update and checkin can be used within a project.
  +
  +  The 'tag' attribute is not supported because it has no valid default value.
  +  If anyone knows a solution for this in macros, please let me know.  You
  +  can get around it in cvs.marco by using the commandline.tag in the body,
  +  see example below.
  +
  + developer: RichardEasterling@OutsourceCafe.com
  + ======================================================================= +
  + Licensed 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.
  + =J=A=M===========================================J=A=V=A=G=E=N=.=C=O=M= +
	</description>
	<!-- example usage:
	Assume these properties:
	  <property name="cvs.root" value=":pserver:anonymous@cvs.sourceforge.net:/cvsroot/javagen"/>
	  <property name="cvs.package" value="jam"/>
	
	CVS: cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/javagen checkout jam 
	JAM: <cvs.macro command="checkout" root=":pserver:anonymous@cvs.sourceforge.net:/cvsroot/javagen" package="jam" compressionlevel="3"/>
	or   <cvs.macro command="checkout" compressionlevel="3"/>
        
   CVS: cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/javagen commit jam
   JAM: <cvs.macro command="checkin"/>
   
   CVS: cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/javagen update jam
   JAM: <cvs.macro command="update"/>

   CVS: cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/javagen checkout -r jam-2_0 jam
   JAM: <cvs.macro command="checkout">
			  <commandline.tag>
			    <commandline>
				   <argument line="-r jam-2_0"/>
				 </commandline>
			  </commandline.tag>
        </cvs.macro>

   
	-->
	<property name="CVS.PRESENT" value="true"></property>
	<!-- =================================================================== -->
	<!-- public targets -->
	<!-- =================================================================== -->
	<target name="checkout" depends="cvs.checkout" description="CVS: checkout new package or module"></target>
	<target name="update" depends="cvs.update" description="CVS: get latest code updates"></target>
	<target name="checkin" depends="cvs.commit" description="CVS: checkin and release all checked out code"></target>
	<!-- =================================================================== -->
	<!-- input properties - these properties should be set for your server -->
	<!-- =================================================================== 
	<property name="cvs.username" value="${user.name}"/>
	<property name="cvs.host" value="localhost"/>
	<property name="root.dir" location="${env.TEMP}"/>
	-->
	<property name="cvs.username" value="${user.name}"></property>
	<property name="cvs.host" value="localhost"></property>
	<property name="cvs.path" value="/cvsroot"></property>
	<property name="cvs.package" value=""></property>
	<property name="cvs.root" value=":pserver:${cvs.username}@${cvs.host}:${cvs.path}"></property>
	<property name="cvs.password" value=""></property>
	<property name="cvs.passfile" location="${user.home}/.cvspass"></property>
	<property name="cvs.dir" location="${basedir}"></property>
	<property name="cvs.changelog" value="cvs-changelog"></property>
	<property name="cvs.report.dir" location="${basedir}"></property>
	<property name="cvs.web" value=""></property>
	<!-- =================================================================== -->
	<!-- CVS checkout,update,commit - support for public targets-->
	<!-- =================================================================== -->
	<target name="cvs.checkout" depends="">
		<cvs.macro command="checkout"></cvs.macro>
	</target>
	<target name="cvs.update" depends="">
		<cvs.macro command="update" dest=".."></cvs.macro>
	</target>
	<target name="cvs.commit" depends="">
		<cvs.macro command="commit" dest=".."></cvs.macro>
	</target>
	<!-- =================================================================== -->
	<!-- add cvs.password to CVS password file, run this once for each root: -->
	<!-- ant -Dcvs.password=secret cvspass -->
	<!-- =================================================================== -->
	<target name="cvspass" depends="" description="CVS: place cvs.passowrd in .cvspass file">
		<cvspass cvsroot="${cvs.root}" password="${cvs.password}"></cvspass>
	</target>
	<!-- =================================================================== -->
	<!-- CVS marcro -->
	<!-- =================================================================== -->
	<macrodef name="cvs.macro">
		<attribute name="command" default="update"></attribute>
		<attribute name="root" default="${cvs.root}"></attribute>
		<attribute name="package" default="${cvs.package}"></attribute>
		<attribute name="dest" default="${cvs.dir}"></attribute>
		<attribute name="passfile" default="${cvs.passfile}"></attribute>
		<attribute name="failonerror" default="false"></attribute>
		<attribute name="compression" default="false"></attribute>
		<attribute name="compressionlevel" default="0"></attribute>
		<attribute name="quiet" default="false"></attribute>
		<attribute name="reallyquiet" default="false"></attribute>
		<attribute name="noexec" default="false"></attribute>
		<attribute name="port" default="2401"></attribute>
		<attribute name="append" default="false"></attribute>
		<attribute name="cvsRsh" default="${env.CVS_RSH}"></attribute>
		<!-- can't make these work :( - must be a valid default value
		<attribute name="tag" default="HEAD"/>
		<attribute name="date"/>
		<attribute name="output"/>
		<attribute name="error"/>
		-->
		<element name="commandline.tag" optional="yes"></element>
		<sequential>
			<echo>cvs =@{root} @{command} @{package}</echo>
			<echo>dir =@{dest}</echo>
			<cvs cvsRoot="@{root}" command="@{command}" dest="@{dest}" package="@{package}" passfile="@{passfile}" compression="@{compression}" compressionlevel="@{compressionlevel}" failonerror="@{failonerror}" quiet="@{quiet}" reallyquiet="@{reallyquiet}" noexec="@{noexec}" port="@{port}" append="@{append}" cvsRsh="@{cvsRsh}">
				<commandline.tag></commandline.tag>
			</cvs>
		</sequential>
	</macrodef>
	<!-- =================================================================== -->
	<!-- CVS change-log marcro -->
	<!-- =================================================================== -->
	<macrodef name="cvschangelog.macro">
		<attribute name="root" default="${cvs.root}"></attribute>
		<attribute name="package" default="${cvs.package}"></attribute>
		<attribute name="passfile" default="${cvs.passfile}"></attribute>
		<attribute name="dir" default="${cvs.dir}"></attribute>
		<attribute name="failonerror" default="false"></attribute>
		<attribute name="port" default="2401"></attribute>
		<attribute name="report.dir" default="${cvs.report.dir}"></attribute>
		<attribute name="report.name" default="${cvs.changelog}"></attribute>
		<attribute name="daysinpast"></attribute>
		<attribute name="cvsRsh" default="${env.CVS_RSH}"></attribute>
		<attribute name="cvsweb" default="${cvs.web}"></attribute>
		<attribute name="title" default="${cvs.package} CVS Change Log"></attribute>
		<!-- can't make these work :( - must be a valid default value
		<attribute name="tag" default="HEAD"/>
		-->
		<sequential>
			<echo>cvs      =@{root} @{command} @{package}</echo>
			<echo>destfile =@{report.dir}/@{report.name}.html</echo>
			<mkdir dir="@{report.dir}"></mkdir>
			<cvschangelog cvsRoot="@{root}" dir="@{dir}" package="@{package}" destfile="@{report.dir}/@{report.name}.xml" daysinpast="@{daysinpast}" cvsRsh="@{cvsRsh}" passfile="@{passfile}" failonerror="@{failonerror}" port="@{port}"></cvschangelog>
			<style in="@{report.dir}/@{report.name}.xml" out="@{report.dir}/@{report.name}.html" style="${ant.home}/etc/changelog.xsl">
				<param name="title" expression="@{title}"></param>
				<param name="cvsweb" expression="@{cvsweb}"></param>
			</style>
		</sequential>
	</macrodef>
</project>