Skip to main content
Jump to: navigation, search

How To Create Automated Build Scripts

Instructions for producing automated builds of Higgins components on the Eclipse build server

Entry conditions

Before creating automated builds scripts for Eclipse server you should have completed build scripts for your component(s) (usually build.xml and buildaux.xml). These scripts should work correctly from command line and have all necessary targets for producing jars, wars, Eclipse plugins etc. Also, no absolute build paths should be used inside build scripts. You should have an Eclipse commiter's account.

Requirements to server's side build scripts

In addition to internal component's build scripts you should create server's side scripts. These scripts should carry out the next operations: checkout from CVS repository necessary component(s) and get all required projects and libraries. execute required Ant tasks from internal component's build scripts in order to compile project(s) and produce required jars, wars, plugins, Javadocs etc.

  • copy all created files to the separated folder (folder in work directory with ${buildLabel} name).
  • copy all build logs, HTML files and any other required files to ${buildLabel} directory.
  • modify prepared index.html file using Ant 'replace' task in order to make complete HTML download page.
  • make any other required changes. E.g. add build manifest file with information about current build.
  • copy all files from ${buildLabel} directory into web-directory of this Higgins component. Usually project's web directory has the next structure:

sub folders in 'builds' directory contain results of respective build. 'lastNightlyBuild' and 'lastStableBuild' directories accordingly contain results of the last nightly build an results of the last Stable build

Except ant build scripts you should create an additional files:

  • This file required for setting necessary variables which will be used in Ant build scripts. Example of this file below:
projectTitle=Token Service
  • This one required for sending e-mails in the event that build of current component failed. Example below:
MailLogger.failure.subject=IdAS build failed 
  • This file required for triggering Ant build files. Because of using 'crontab' utility,Ant scripts should be executed using java. Example of this file below:
# !/bin/sh





usage="usage: build [-mapVersionTag HEAD|<branch name>] [-vm <url to java executable to run build>] [-bc <bootclasspath>] [-target <buildall target to execute>] [-buildID <buildID, e.g. 2.1.2>]  [-ftp <userid> <password>] I|M"

rm -rf /shared/technology/higgins/work-dir/builds
rm -rf /shared/technology/higgins/work-dir/tests
rm -rf /shared/technology/higgins/work-dir/eclipse
rm -rf /shared/technology/higgins/work-dir/workspace

mkdir /shared/technology/higgins/work-dir/logs
mkdir /shared/technology/higgins/work-dir/eclipse
mkdir /shared/technology/higgins/work-dir/builds
mkdir /shared/technology/higgins/work-dir/builds/logs
mkdir /shared/technology/higgins/work-dir/builds/fails
mkdir /shared/technology/higgins/work-dir/tests
mkdir /shared/technology/higgins/work-dir/workspace

while [ "$#" -gt 0 ]
    case "$1" in
	-mapVersionTag) mapVersionTag="$2"; shift;;
	-vm) vm="$2"; shift;;
	-bc) bootclasspath="$2"; shift;;
	-target) target="$2"; shift;;
	-buildID) buildID="$2"; shift;;
	-ftp) ftpUser="$2"; ftpPassword="$3"; shift;;
	*) buildType="$1"; shift;;

if [ "x$buildType" = "x" ]
    echo "$usage"
    exit 1

if [ "x$buildID" = "x" ]
$JAVA_HOME/bin/java -Dant.home=/shared/common/apache-ant-1.6.5 -classpath $_CLASSPATH -f $build_base/build.xml -logger -propertyfile -DbuildType=$buildType > $log_base/build.log
$JAVA_HOME/bin/java -Dant.home=/shared/common/apache-ant-1.6.5 -classpath $_CLASSPATH -f $build_base/build.xml -logger -propertyfile -DbuildType=$buildType -DbuildId=$buildID > $log_base/build.log
  • additional prepared files for web UI.

Setting up build scripts

To force created build scripts to work you should commit created build scripts into Eclipse CVS repository. Use the following parameters (you should have Eclipse committer's account):

  • Connection type: :ext:
  • Host:
  • Repository Path: /cvsroot/technology/
  • Project: org.eclipse.higgins/builds/

After that, you should login to server via ssh. Use your commiter's login and password. Change current directory to '/shared/technology/higgins/static-resources/scripts/'. There you can find 'beginBuild.xml' file. Add into targer 'N' of this file the following lines:

<exec executable="/bin/sh" dir="${basedir}/{-Your-project-path-}">
     <arg value="${basedir}/{-Your-project-name-}/"/>
     <arg value="N"/>

where {-Your-project-path-} is the path to the project which you are going to build automatically. This path is the same to path inside the package in CVS repository.

If everything is correct, your build scripts will be triggered every night automatically.

Directory structure on server

The directory we use for builds is '/shared/technology/higgins/'. This directory has next structure:

  • /static-resources - inside this directory we have all necessary archives, such as Eclipse platform and other required plugins/libraries. Also there located org.eclipse.releng.basebuilder project. You may use it to build Eclipse plugins.
    • /static-resources/stripts - In this folder are located initial (and checkouted) build scripts.
  • /work-dir - In this folder are located the temporary files required for builds. Build scripts should clean this folder before each build.
    • /work-dir/eclipse - If Eclipse runtime is required, Eclipse platform should be unpackaged into this folder.
    • /work-dir/builds - directory for temporary files of the current build
    • /work-dir/tests - directory for temporary files of the tests


Back to the top