Speed up by doing a pull and update when possible.
Added stopwatch calls to identify where the time is spent.
Re-organised to use a parameterised target to do the serious work.
<?xml version="1.0" encoding="UTF-8"?>
<project name="SF-BOOTSTRAP" default="bootstrap" xmlns:hlm="http://www.nokia.com/helium">
<property environment="env"/>
<dirname property="sf.bootstrap.dir" file="${ant.file.SF-CONFIG}"/>
<import file="${helium.dir}/helium.ant.xml" />
<!-- target dir -->
<property name="bootstrap.base.dir" value="D:\fbf_project"/> <!-- old name -->
<property name="sf.target.dir" value="${bootstrap.base.dir}"/>
<!-- config -->
<property name="sf.config.repo" value="${sf.config.repository}"/> <!-- old name -->
<property name="sf.config.rev" value="tip"/>
<property name="sf.config.dir" value=""/>
<!-- project -->
<property name="sf.project.repo" value="${platform.config.repository}"/> <!-- old name -->
<property name="sf.project.rev" value="tip"/>
<property name="sf.project.dir" value=""/>
<target name="bootstrap" depends="init,get-sf-config,get-sf-project" description="Target for executing the bootstrap">
<stopwatch name="bootstrap" action="elapsed"/>
</target>
<target name="init">
<stopwatch name="bootstrap"/>
<mkdir dir="${sf.target.dir}" />
<mkdir dir="${sf.target.dir}/build" />
<mkdir dir="${sf.target.dir}/build/config" />
<echo message="config: repo=${sf.config.repo} rev=${sf.config.rev}"/>
<echo message="project: repo=${sf.project.repo} rev=${sf.project.rev}"/>
</target>
<target name="clean-env">
<echo message="cleaning up the environment" />
<delete dir="${sf.target.dir}/" />
</target>
<target name="get-sf-config">
<antcall target="get-repo">
<param name="stopwatch.name" value="get-sf-config"/>
<param name="subdir.name" value="sf-config"/>
<param name="repo.dir" value="${sf.config.dir}"/>
<param name="repo.url" value="${sf.config.repo}"/>
<param name="repo.rev" value="${sf.config.rev}"/>
</antcall>
</target>
<target name="get-sf-project">
<antcall target="get-repo">
<param name="stopwatch.name" value="get-sf-project"/>
<param name="subdir.name" value="build/config"/>
<param name="repo.dir" value="${sf.project.dir}"/>
<param name="repo.url" value="${sf.project.repo}"/>
<param name="repo.rev" value="${sf.project.rev}"/>
</antcall>
</target>
<target name="get-repo">
<stopwatch name="${stopwatch.name}"/>
<if>
<not>
<equals arg1="${repo.dir}" arg2=""/>
</not>
<then>
<echo message="Getting FBF configuration from dir ${repo.dir}"/>
<copy todir="${sf.target.dir}/${subdir.name}">
<fileset dir="${repo.dir}"/>
</copy>
</then>
<else>
<echo message="Getting ${repo.url}"/>
<if>
<available file="${sf.target.dir}/${subdir.name}/.hg" type="dir"/>
<then>
<echo message="Updating ${sf.target.dir}/${subdir.name}"/>
<exec executable="hg" dir="${sf.target.dir}/${subdir.name}">
<arg value="pull"/>
<arg value="${repo.url}"/>
</exec>
<exec executable="hg" dir="${sf.target.dir}/${subdir.name}">
<arg value="up"/>
<arg value="${repo.rev}"/>
<arg value="-C"/>
</exec>
</then>
<else>
<hlm:scm verbose="true" scmUrl="scm:hg:${repo.url}">
<hlm:checkout basedir="${sf.target.dir}/${subdir.name}"/>
<hlm:update basedir="${sf.target.dir}/${subdir.name}">
<hlm:tag name="${repo.rev}"/>
</hlm:update>
</hlm:scm>
</else>
</if>
</else>
</if>
<stopwatch name="${stopwatch.name}" action="elapsed"/>
</target>
</project>