ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Donie <>
Subject RE: [Cruisecontrol-user] how to ?
Date Fri, 27 Apr 2001 15:41:01 GMT
I have been using a pre-release version of CC, so things may be a bit
different for y'all, but here is what I have in my setup. I have simplified
it a lot, but it should show what's needed. 

First, I have a directory structure like this:


The build.xml,, and masterbuild.bat files are in the
tools directory. On the build machine, the base directory is
d:\TahoeBuild\tahoe, so you'll see that hard-coded into the .properties
file. I am using a custom label incrementer that is based on the date. On
the build machine, I have set things up so there is a scheduled task every
night at midnight that just runs "Ant allclean". This is so that the whole
team gets build mail daily (to keep everyone confident that everything is

Benoit's questions have been about the logfiles directory, and about the
property ${lastgoodbuildtime}. 

The logfiles directory is where modificationset.xml, and build.xml (the
build log) are written - I also have my junit output writing to the same
place. Note that in the TARGET where the modificationset task is running,
you should set a property ${modificationset.file} so that the task knows
where to write the file. 

lastgoodbuildtime is initially set (the very first time you run CC) with the
command-line flag. After that, it is updated automatically while CC
continues to run. If you need to stop the CC process, then it should usually
be read from the buildcycleinfo file. I have a batch file I use to set the
classpath, then run CC, and I have set it up so I can:
 - give it 2 arguments for lastgoodbuildtime and label
 - give it no arguments, in which case it uses a lastgoodbuildtime of today
at midnight, and a label based on today's date
 - give it an argument "restart", which causes the build info to be read
from the buildcyleinfo file

Hope this is helpful.


========= build.xml =============
<project name="Tahoe" default="build" basedir="..">
  <!-- set global properties for this build -->
  <!-- first, names of directories that are used -->
  <property name="masterbuild.logdir" value="logs" />
  <property name="src" value="src" />
  <property name="jar" value="jar" />
  <property name="bin" value="bin" />
  <property name="javadocs" value="javadocs" />
  <property name="tools" value="tools" />
  <property name="classes" value="classes" />
  <property name="build" value="build" />
  <property name="dist"  value="dist" />
  <property name="scripts"  value="scripts" />

  <!-- this is the name of the file generated (if above is true) when
running the JUnit target -->
  <property name="JUnit.OutputFile" value="TestAllResults" />
  <property name="JUnit.XMLFileName" value="logs/${JUnit.OutputFile}.xml" />

<!-- ----- 'meta' targets ----- -->
  <target name="allclean" depends="clean,all" description="Builds everything
  <target name="all" depends="init,version,junit,dist" description="Builds
everything, not clean"/>
  <target name="build" depends="init,version,compile,junit"
description="Runs compile and JUnit - default target"/>
  <target name="rebuild" depends="clean,build" description="Runs clean,
compile and JUnit"/>

  <target name="masterbuild" depends="modificationset,cleanclasses,all"
description="Build used for masterbuild." />
  <target name="masterclean" depends="modificationset,allclean"
description="Build used for masterbuild, clean." />

<!-- ----- targets ----- -->
  <target name="modificationset">
    <property name="modificationset.file" value="logs/modificationset.xml"
    <modificationset lastbuild="${lastGoodBuildTime}" 
                     dateformat="yy-MM-dd hh:mm:ss a z" 
      <cvselement localworkingcopy="."
" />

  <target name="init">
    <!-- Create the time stamp -->
    	<format property="TIME_NOW" pattern="hh:mm:ss a z" />
    <echo message="Building ${} on ${Machine} in ${basedir}
starting at ${TIME_NOW} on ${TODAY}" />
    <echo file="header.log">Building ${} on ${Machine} in
${basedir} starting at ${TIME_NOW} on ${TODAY}

================ masterbuild.bat ======================
@echo off
title MasterBuild

echo Starting MasterBuild:
date /t
time /t
set ANT_HOME=%DS_HOME%\tools\ant

REM this sets the MasterBuildLabel and MasterBuildTime based on todays date
call %DS_HOME%\tools\SetMasterBuildData.bat

if .%1.==.restart. goto RESTART

if NOT .%1.==.. set MasterBuildTime=%1
if NOT .%2.==.. set MasterBuildLabel=%2

if not defined MasterBuildTime echo MasterBuildTime not defined&goto :EOF
if not defined MasterBuildLabel echo MasterBuildLabel not defined&goto :EOF

echo MasterBuildTime  %MasterBuildTime%
echo MasterBuildLabel %MasterBuildLabel%
echo use MasterBuild.bat restart to re-start MasterBuild.
tools\choice /T:Y,30 Ready to start? (starts automatically in 30 seconds) 
if errorlevel 2 goto :EOF

java -DDS_HOME=%DS_HOME% -DMachine=%COMPUTERNAME% -lastbuild %MasterBuildTime% -label
%MasterBuildLabel% -properties %DS_HOME%\tools\ 
goto :EOF

echo restarting, using buildcycleinfo
REM this just uses the file buildcycleinfo to read in the last good build
time and label
java -DDS_HOME=%DS_HOME% -DMachine=%COMPUTERNAME% -properties

====================== SetMasterBuildData.bat ===================
@echo off
REM How this works:
REM first FOR command splits the output of the date /t command which looks
like Tue 02/06/2001 into
REM 2 tokens: 1="Tue", 2="02/06/2001".
REM Then the second FOR command splits the 2nd token (%%j) into 3 tokens:
1="02", 2="06", 3="2001"
REM Finally, the Year, month, and day are set based on those tokens.

for /F "tokens=1,2,*" %%i in ('date /T') do for /F "tokens=1,2,3,* delims=/"
%%s in ("%%j") do set MBMonth=%%s&set MBDay=%%t&set MBYear=%%u

set MasterBuildLabel=%MBMonth%%MBDay%.1
set MasterBuildTime=%MBYear%%MBMonth%%MBDay%000100

================ =====================

# file that contains the time that the current build started.  this will be
picked up by the servlet to display that a build is
# currently running/not running
currentBuildStatusFile = d:\\TahoeBuild\\tahoe\\logs\\currentbuild.txt

# directory where logs should be created.

# ant file to execute
antfile = tools/build.xml

# target that the ant file should run.  maybe should just be the default
target of the project and not specified here?
target = masterbuild

# clean target (should also include building, but just unconditionally clean
first) this is the target that will be run every n builds,
# so that we can ensure that we have no integration issues, but generally
keep build times down.
# NOTE: Because the nightly build does a clean, masterbuild does not.
cleantarget = masterclean

# comma delimited list of ant property names that refer to files to be
# into the xml specified by the ant property XmlLogger.file
auxlogfiles = modificationset.file,JUnit.XMLFileName

# multiple to force a clean build
cleanBuildEvery = 99

# Label Incrementer 

View raw message