Scheduling Automatic Builds
It's time to add some automation to the build process.
When you're working alone, you probably won't need to automate nightly
builds, but as part of a team, it's a good idea. Larger projects
typically have nightly builds posted to a web site, and using various
automation tools and tasks like ftp,
that's no problem. I'll take a look at various options here.
Unix
You can schedule recurring builds with Unix utilies like
crontab, which you use to configure
the cron daemon. For example, say
you have a shell script that runs your nightly build,
dobuild.sh, something like this:
export ANT_HOME=/usr/local/ant
export JAVA_HOME=/usr/local/jdk1.4
export PATH=${PATH}:${ANT_HOME}/bin
cd /home/work
ant -f nightlybuild.xmlYou can schedule that build to happen at various times
with crontab by starting its
editing mode:
-bash-2.05b$ crontab -e
Edit the crontab file
to include this line:
run at 00:01 every day 30 0 * * * $HOME/work/dobuild.sh
That makes your build run every night at 12:01 A.M. Easy enough.
Windows
The Windows at
command schedules commands to run in Windows at specific times. For
example, say you had a batch file, dobuild.bat,
which runs your nightly build:
set ANT_HOME=C:\ant\apache-ant-1.6.1 set JAVA_HOME=C:\jdk1.4 set PATH=%PATH%;%ANT_HOME%\bin cd C:\work call %ANT_HOME%\bin\ant.bat -f nightlybuild.xml
You can schedule that build for every night with the
Windows at command:
C:\ant>at 00:01 /every:M,T,W,Th,F "C:\work\dobuild.bat" Added a new job with job ID ...