Difference between revisions of "Common Build Infrastructure/Getting Started/Build In Hudson/Ant Job Distributed"

From Eclipsepedia

Jump to: navigation, search
Line 122: Line 122:
  
 
</project>
 
</project>
 +
 +
</pre>
 +
 +
'''bootstrap.xml'''
 +
<pre>
 +
&lt;!--
 +
  This script is completely boilerplate, and is used to bootstrap before building.
 +
 
 +
  To use it, call it like this from within your build.xml's run target:
 +
 
 +
&lt;project default="run">
 +
  &lt;target name="run">
 +
      &lt;ant antfile="bootstrap.xml" target="init">
 +
        &lt;property name="basebuilderTag" value="r35x_v20090811" />
 +
        &lt;property name="commonrelengTag" value="HEAD" />
 +
        &lt;property name="ANTCONTRIB_VERSION" value="1.0b2" />
 +
        &lt;property name="ANT4ECLIPSE_VERSION" value="1.0.0.M3" />
 +
        &lt;property name="build.properties" value="build.properties" />
 +
      &lt;/ant>
 +
      ...
 +
      &lt;condition property="JAVA_HOME" value="${java.home}" else="${java.home}/..">
 +
        &lt;available file="${java.home}/bin/javac" type="file" />
 +
      &lt;/condition>
 +
      ...
 +
      &lt;property name="build.properties" value="build.properties" />
 +
      &lt;property file="${build.properties}" />
 +
      &lt;ant antfile="${relengCommonBuilderDir}/build.xml" />
 +
  &lt;/target>
 +
&lt;/project>
 +
-->
 +
 +
&lt;project default="init">
 +
  &lt;condition property="isInHudson" value="true">
 +
      &lt;or>
 +
        &lt;contains string="${user.dir}" substring="hudson" />
 +
        &lt;contains string="${user.name}" substring="hudson" />
 +
        &lt;contains string="${user.home}" substring="hudson" />
 +
      &lt;/or>
 +
  &lt;/condition>
 +
  &lt;target name="local" unless="isInHudson">
 +
      &lt;property name="WORKINGDIR" value="${basedir}/.." />
 +
      &lt;property name="COMMON_TOOLS" value="${java.io.tmpdir}/build/downloads" />
 +
      &lt;property name="writableBuildRoot" value="${WORKSPACE}/build" />
 +
  &lt;/target>
 +
 +
  &lt;!-- if required: use a newer version -->
 +
  &lt;target name="get.ant-contrib" unless="ant-contrib.jar.exists">
 +
      &lt;property name="ANTCONTRIB_VERSION" value="1.0b2" />
 +
      &lt;property name="ANTCONTRIB_MIRROR" value="http://downloads.sourceforge.net/ant-contrib/" />
 +
      &lt;get usetimestamp="true"
 +
          dest="${COMMON_TOOLS}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip"
 +
          src="${ANTCONTRIB_MIRROR}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip"
 +
      />
 +
      &lt;touch file="${COMMON_TOOLS}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip" />
 +
      &lt;mkdir dir="${java.io.tmpdir}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip_" />
 +
      &lt;unzip src="${COMMON_TOOLS}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip"
 +
            dest="${java.io.tmpdir}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip_"
 +
            overwrite="true"
 +
      />
 +
      &lt;copy file="${java.io.tmpdir}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip_/ant-contrib/lib/ant-contrib.jar"
 +
            tofile="${COMMON_TOOLS}/ant-contrib.jar"
 +
            failonerror="true"
 +
      />
 +
      &lt;delete dir="${java.io.tmpdir}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip_"
 +
              includeemptydirs="true"
 +
              quiet="true"
 +
      />
 +
  &lt;/target>
 +
 +
  &lt;!-- if required: use a newer version -->
 +
  &lt;target name="get.ant4eclipse" unless="ant4eclipse.jar.exists">
 +
      &lt;property name="ANT4ECLIPSE_VERSION" value="1.0.0.M3" />
 +
      &lt;property name="ANT4ECLIPSE_MIRROR" value="http://downloads.sourceforge.net/ant4eclipse/" />
 +
      &lt;get usetimestamp="true"
 +
          dest="${COMMON_TOOLS}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip"
 +
          src="${ANT4ECLIPSE_MIRROR}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip"
 +
      />
 +
      &lt;touch file="${COMMON_TOOLS}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip" />
 +
      &lt;mkdir dir="${java.io.tmpdir}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip_" />
 +
      &lt;unzip src="${COMMON_TOOLS}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip"
 +
            dest="${java.io.tmpdir}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip_"
 +
            overwrite="true"
 +
      />
 +
      &lt;copy file="${java.io.tmpdir}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip_/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.jar"
 +
            tofile="${COMMON_TOOLS}/ant4eclipse.jar"
 +
            failonerror="true"
 +
      />
 +
      &lt;delete dir="${java.io.tmpdir}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip_"
 +
              includeemptydirs="true"
 +
              quiet="true"
 +
      />
 +
  &lt;/target>
 +
 +
  &lt;target name="get.athena.common.releng.and.releng.basebuilder">
 +
      &lt;!-- find relengCommonBuilderDir and relengBaseBuilderDir -->
 +
      &lt;for param="dir" list="${COMMON_TOOLS}, ${basedir}/../.., ${basedir}/.." delimiter=", ">
 +
        &lt;sequential>
 +
            &lt;if>
 +
              &lt;available file="@{dir}/org.eclipse.dash.common.releng" type="dir" />
 +
              &lt;then>
 +
                  &lt;property name="relengCommonBuilderDir" value="@{dir}/org.eclipse.dash.common.releng" />
 +
              &lt;/then>
 +
            &lt;/if>
 +
            &lt;if>
 +
              &lt;available file="@{dir}/org.eclipse.releng.basebuilder" type="dir" />
 +
              &lt;then>
 +
                  &lt;property name="relengBaseBuilderDir" value="@{dir}/org.eclipse.releng.basebuilder" />
 +
              &lt;/then>
 +
            &lt;/if>
 +
 +
        &lt;/sequential>
 +
      &lt;/for>
 +
 +
      &lt;if>
 +
        &lt;or>
 +
            &lt;not>
 +
              &lt;isset property="relengCommonBuilderDir" />
 +
            &lt;/not>
 +
            &lt;not>
 +
              &lt;isset property="relengBaseBuilderDir" />
 +
            &lt;/not>
 +
        &lt;/or>
 +
        &lt;then>
 +
            &lt;!-- fetch projects using psf file; create it if needed -->
 +
            &lt;if>
 +
              &lt;not>
 +
                  &lt;available file="${COMMON_TOOLS}/psfs/athena.psf" type="file" />
 +
              &lt;/not>
 +
              &lt;then>
 +
                  &lt;!-- if required: use a different tag/branch -->
 +
                  &lt;property name="basebuilderTag" value="r35x_v20090811" />
 +
                  &lt;property name="commonrelengTag" value="HEAD" />
 +
 +
                  &lt;echo>Create ${COMMON_TOOLS}/psfs/athena.psf file&lt;/echo>
 +
                  &lt;mkdir dir="${COMMON_TOOLS}/psfs" />
 +
                  &lt;echo file="${COMMON_TOOLS}/psfs/athena.psf">&lt;?xml version="1.0" encoding="UTF-8"?>
 +
&lt;psf version="2.0">
 +
&lt;provider id="org.eclipse.team.cvs.core.cvsnature">
 +
&lt;project reference="1.0,:pserver:anonymous@dev.eclipse.org:/cvsroot/technology,org.eclipse.dash/athena/org.eclipse.dash.commonbuilder/org.eclipse.dash.commonbuilder.releng,org.eclipse.dash.common.releng,${commonrelengTag}"/>
 +
&lt;project reference="1.0,:pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse,org.eclipse.releng.basebuilder,org.eclipse.releng.basebuilder,${basebuilderTag}"/>
 +
&lt;/provider>
 +
&lt;/psf>&lt;/echo>
 +
              &lt;/then>
 +
            &lt;/if>
 +
            &lt;echo>Fetch projects from athena.psf into ${COMMON_TOOLS}&lt;/echo>
 +
            &lt;cvsGetProjectSet cvsreallyquiet="true"
 +
                              cvsUser="anonymous"
 +
                              cvsPwd=""
 +
                              command="checkout"
 +
                              projectSet="${COMMON_TOOLS}/psfs/athena.psf"
 +
                              destination="${COMMON_TOOLS}"
 +
            />
 +
            &lt;property name="relengCommonBuilderDir" value="${COMMON_TOOLS}/org.eclipse.dash.common.releng" />
 +
            &lt;property name="relengBaseBuilderDir" value="${COMMON_TOOLS}/org.eclipse.releng.basebuilder" />
 +
        &lt;/then>
 +
      &lt;/if>
 +
  &lt;/target>
 +
 +
  &lt;target name="init" depends="local">
 +
      &lt;property name="WORKINGDIR" value="${basedir}/.." />
 +
      &lt;property name="COMMON_TOOLS" value="${basedir}/../tools" />
 +
      &lt;mkdir dir="${COMMON_TOOLS}" />
 +
 +
      &lt;available file="${COMMON_TOOLS}/ant-contrib.jar" type="file" property="ant-contrib.jar.exists" />
 +
      &lt;antcall target="get.ant-contrib" />
 +
      &lt;taskdef resource="net/sf/antcontrib/antlib.xml">
 +
        &lt;classpath>
 +
            &lt;pathelement location="${COMMON_TOOLS}/ant-contrib.jar" />
 +
        &lt;/classpath>
 +
      &lt;/taskdef>
 +
 +
      &lt;available file="${COMMON_TOOLS}/ant4eclipse.jar" type="file" property="ant4eclipse.jar.exists" />
 +
      &lt;antcall target="get.ant4eclipse" />
 +
      &lt;taskdef resource="org/ant4eclipse/antlib.xml">
 +
        &lt;classpath>
 +
            &lt;pathelement location="${COMMON_TOOLS}/ant4eclipse.jar" />
 +
        &lt;/classpath>
 +
      &lt;/taskdef>
 +
 +
      &lt;antcallback target="get.athena.common.releng.and.releng.basebuilder"
 +
                  return="relengCommonBuilderDir, relengBaseBuilderDir"
 +
      />
 +
 +
      &lt;if>
 +
        &lt;or>
 +
            &lt;not>
 +
              &lt;isset property="relengCommonBuilderDir" />
 +
            &lt;/not>
 +
            &lt;not>
 +
              &lt;isset property="relengBaseBuilderDir" />
 +
            &lt;/not>
 +
        &lt;/or>
 +
        &lt;then>
 +
            &lt;fail>Error!
 +
  $${relengBaseBuilderDir} or $${relengCommonBuilderDir} could not be found!
 +
 +
  Try checking out manually using psfs/athena.psf
 +
&lt;/fail>
 +
        &lt;/then>
 +
      &lt;/if>
 +
&lt;!--   
 +
      &lt;property name="build.properties" value="build.properties" />
 +
      &lt;echo file="${build.properties}" append="true">
 +
 +
#bootstrap.xml properties
 +
WORKINGDIR=${WORKINGDIR}
 +
COMMON_TOOLS=${COMMON_TOOLS}
 +
relengCommonBuilderDir=${relengCommonBuilderDir}
 +
relengBaseBuilderDir=${relengBaseBuilderDir}
 +
&lt;/echo>
 +
      &lt;if>
 +
        &lt;isset property="writableBuildRoot" />
 +
        &lt;then>
 +
            &lt;echo file="${build.properties}" append="true">writableBuildRoot=${writableBuildRoot}
 +
&lt;/echo>
 +
        &lt;/then>
 +
      &lt;/if>
 +
-->
 +
  &lt;/target>
 +
 +
&lt;/project>
 +
  
 
</pre>
 
</pre>

Revision as of 15:31, 28 September 2010

To have Athena based Ant Job builds work on any machine and not just a particular node, you need to use the an UpdateSite/Repository based build. This will have Athena get the correct target platform SDK and install it.

The following is an example from the Vex project which will run on either master or build2.

build.properties

## BEGIN PROJECT BUILD PROPERTIES ##

# default settings for all this project's builds, for this branch; see also o.e.d.common.releng/build.properties for more overrideable defaults

# To permit automatic downloads of non-EPL compatible code, set this to property to "I accept"
thirdPartyDownloadLicenseAcceptance="I accept"

# MUST BE SET #
projectid=webtools.vex
zipPrefix=wtp-xml-vex
incubation=-Incubation
version=0.5.0
buildType=N
mainFeatureToBuildID=org.eclipse.wst.xml.vex.feature
testFeatureToBuildID=org.eclipse.wst.xml.vex_tests.feature

# MUST BE SET #
JAVA50_HOME=${JAVA_HOME}
JAVA14_HOME=${JAVA_HOME}
dependencyURLs=http://download.eclipse.org/tools/orbit/downloads/drops/R20100114021427/orbit-R20100114021427.zip
repositoryURLs=http://download.eclipse.org/athena/repos/eclipse-Update-S-3.6M5-201001291300.zip,http://download.eclipse.org/releases/helios,http://download.eclipse.org/tools/orbit/downloads/drops/R20100114021427/updateSite
IUsToInstall=org.eclipse.sdk.feature.group+org.eclipse.sdk.ide+org.eclipse.wst.xml_ui.feature.feature.group

#what steps should we do? default: build.steps=buildUpdate,buildZips,buildTests,generateDigests,test,publish,cleanup
#build.steps=buildUpdate,buildZips,buildTests,generateDigests,test,publish,cleanup
build.steps=buildUpdate,buildZips,buildTests,generateDigests,testLocal,map2psf,publish

compilerArg=-enableJavadoc -encoding ISO-8859-1
flattenDependencies=true
parallelCompilation=true
generateFeatureVersionSuffix=true
individualSourceBundles=true

writableBuildRoot=${WORKSPACE}/build
## END PROJECT BUILD PROPERTIES ##

The key is repositoryURL and IUsToInstall. Note that you CAN NOT mix in a featureIDsToInstall, as this will confuse athena and you will not get the necessary product information installed.

The build itself uses the new self provisioning mechanism for Athena:

build.xml

<project default="run" name="org.eclipse.wst.xml.xpath2.releng/build.xml - Run a PsychoPath build using the Athena CBI">
	<!-- load properties and set timestamp for the build -->

	<property environment="env" />
	<property name="WORKSPACE" location="${env.WORKSPACE}" />

	<ant antfile="bootstrap.xml" target="init">
		<property name="basebuilderTag" value="r35x_v20090811" />
		<property name="commonrelengTag" value="HEAD" />
		<property name="ANTCONTRIB_VERSION" value="1.0b2" />
		<property name="ANT4ECLIPSE_VERSION" value="1.0.0.M3" />
		<property name="build.properties" value="build.properties" />
	</ant>

	<!-- FIXME if required: Set a valid path to JAVA_HOME, if Eclipse's ${java.home}/../bin/javac cannot be found -->
	<condition property="JAVA_HOME" value="${java.home}" else="${java.home}/..">
		<available file="${java.home}/bin/javac" type="file" />
	</condition>

	<!-- FIXME if required: if not using this type of qualifier, comment next 4 lines -->
	<tstamp>
		<format property="buildTimestamp" pattern="yyyyMMddHHmm" />
	</tstamp>

	<!-- 1. To build from sources using information in the ./maps/*.map files, comment these next two properties
				 2. Or, to build from sources in the workspace, use these properties. You can also use absolute paths if needed.
			-->
	<!-- <property name="localSourceCheckoutDir" value="${basedir}/.." />
			<property name="relengBuilderDir" value="${basedir}" /> -->

	<property name="build.properties" value="build.properties" />
	<property file="${build.properties}" />

	<property name="forceContextQualifier" value="v${buildTimestamp}" />
	<property name="fetchTag" value="HEAD" />

	<!-- calculate workspaceDir as parent of this folder, the project's .releng folder (relengBuilderDir) -->
	<import file="findbugs.xml" />
	<import file="pmd.xml" />
	<dirname file="${relengBuilderDir}" property="workspaceDir" />

	<!-- 
		can build in /tmp, eg., in /tmp/build, or in workspace, eg.,
		${WORKSPACE}/build
	-->
	<property name="writableBuildRoot" value="/tmp/build" />

	<!-- 
		can be simple path, eg., 
		${writableBuildRoot}/${buildType}${buildTimestamp} or longer, eg.,
		${writableBuildRoot}/${topprojectName}/${projectName}/downloads/drops/${version}/${buildType}${buildTimestamp} or
		${writableBuildRoot}/${topprojectName}/${projectName}/${subprojectName}/downloads/drops/${version}/${buildType}${buildTimestamp}
	-->
	<property name="buildDir" value="${writableBuildRoot}/athena" />

	<target name="init">
		<delete dir="${buildDir}" failonerror="false" />
	</target>

	<target name="run" depends="init">
		<echo message="Workspace: ${WORKSPACE}" />
		<echo message="Writable Build Root: ${writableBuildRoot}" />
		<mkdir dir="${writableBuildRoot}" />
		<!-- invoke a new Eclipse process and launch the build from the common.releng folder -->
		<!--<property name="relengCommonBuilderDir" value="${workspaceDir}/org.eclipse.dash.common.releng" />-->

		<condition property="JAVA_HOME" value="${java.home}" else="${java.home}/..">
			<available file="${java.home}/bin/javac" type="file" />
		</condition>

		<!-- <ant antfile="${relengCommonBuilderDir}/buildAll.xml" target="runEclipse" dir="${relengCommonBuilderDir}" />-->
		<ant antfile="${relengCommonBuilderDir}/build.xml" />

	</target>

</project>

bootstrap.xml

<!-- 
   This script is completely boilerplate, and is used to bootstrap before building.
   
   To use it, call it like this from within your build.xml's run target:
   
<project default="run">
   <target name="run">
      <ant antfile="bootstrap.xml" target="init">
         <property name="basebuilderTag" value="r35x_v20090811" />
         <property name="commonrelengTag" value="HEAD" />
         <property name="ANTCONTRIB_VERSION" value="1.0b2" />
         <property name="ANT4ECLIPSE_VERSION" value="1.0.0.M3" />
         <property name="build.properties" value="build.properties" />
      </ant>
      ...
      <condition property="JAVA_HOME" value="${java.home}" else="${java.home}/..">
         <available file="${java.home}/bin/javac" type="file" />
      </condition>
      ...
      <property name="build.properties" value="build.properties" />
      <property file="${build.properties}" />
      <ant antfile="${relengCommonBuilderDir}/build.xml" />
   </target>
</project>
-->

<project default="init">
   <condition property="isInHudson" value="true">
      <or>
         <contains string="${user.dir}" substring="hudson" />
         <contains string="${user.name}" substring="hudson" />
         <contains string="${user.home}" substring="hudson" />
      </or>
   </condition>
   <target name="local" unless="isInHudson">
      <property name="WORKINGDIR" value="${basedir}/.." />
      <property name="COMMON_TOOLS" value="${java.io.tmpdir}/build/downloads" />
      <property name="writableBuildRoot" value="${WORKSPACE}/build" />
   </target>

   <!-- if required: use a newer version -->
   <target name="get.ant-contrib" unless="ant-contrib.jar.exists">
      <property name="ANTCONTRIB_VERSION" value="1.0b2" />
      <property name="ANTCONTRIB_MIRROR" value="http://downloads.sourceforge.net/ant-contrib/" />
      <get usetimestamp="true"
           dest="${COMMON_TOOLS}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip"
           src="${ANTCONTRIB_MIRROR}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip"
      />
      <touch file="${COMMON_TOOLS}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip" />
      <mkdir dir="${java.io.tmpdir}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip_" />
      <unzip src="${COMMON_TOOLS}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip"
             dest="${java.io.tmpdir}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip_"
             overwrite="true"
      />
      <copy file="${java.io.tmpdir}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip_/ant-contrib/lib/ant-contrib.jar"
            tofile="${COMMON_TOOLS}/ant-contrib.jar"
            failonerror="true"
      />
      <delete dir="${java.io.tmpdir}/ant-contrib-${ANTCONTRIB_VERSION}-bin.zip_"
              includeemptydirs="true"
              quiet="true"
      />
   </target>

   <!-- if required: use a newer version -->
   <target name="get.ant4eclipse" unless="ant4eclipse.jar.exists">
      <property name="ANT4ECLIPSE_VERSION" value="1.0.0.M3" />
      <property name="ANT4ECLIPSE_MIRROR" value="http://downloads.sourceforge.net/ant4eclipse/" />
      <get usetimestamp="true"
           dest="${COMMON_TOOLS}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip"
           src="${ANT4ECLIPSE_MIRROR}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip"
      />
      <touch file="${COMMON_TOOLS}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip" />
      <mkdir dir="${java.io.tmpdir}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip_" />
      <unzip src="${COMMON_TOOLS}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip"
             dest="${java.io.tmpdir}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip_"
             overwrite="true"
      />
      <copy file="${java.io.tmpdir}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip_/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.jar"
            tofile="${COMMON_TOOLS}/ant4eclipse.jar"
            failonerror="true"
      />
      <delete dir="${java.io.tmpdir}/org.ant4eclipse_${ANT4ECLIPSE_VERSION}.zip_"
              includeemptydirs="true"
              quiet="true"
      />
   </target>

   <target name="get.athena.common.releng.and.releng.basebuilder">
      <!-- find relengCommonBuilderDir and relengBaseBuilderDir -->
      <for param="dir" list="${COMMON_TOOLS}, ${basedir}/../.., ${basedir}/.." delimiter=", ">
         <sequential>
            <if>
               <available file="@{dir}/org.eclipse.dash.common.releng" type="dir" />
               <then>
                  <property name="relengCommonBuilderDir" value="@{dir}/org.eclipse.dash.common.releng" />
               </then>
            </if>
            <if>
               <available file="@{dir}/org.eclipse.releng.basebuilder" type="dir" />
               <then>
                  <property name="relengBaseBuilderDir" value="@{dir}/org.eclipse.releng.basebuilder" />
               </then>
            </if>

         </sequential>
      </for>

      <if>
         <or>
            <not>
               <isset property="relengCommonBuilderDir" />
            </not>
            <not>
               <isset property="relengBaseBuilderDir" />
            </not>
         </or>
         <then>
            <!-- fetch projects using psf file; create it if needed -->
            <if>
               <not>
                  <available file="${COMMON_TOOLS}/psfs/athena.psf" type="file" />
               </not>
               <then>
                  <!-- if required: use a different tag/branch -->
                  <property name="basebuilderTag" value="r35x_v20090811" />
                  <property name="commonrelengTag" value="HEAD" />

                  <echo>Create ${COMMON_TOOLS}/psfs/athena.psf file</echo>
                  <mkdir dir="${COMMON_TOOLS}/psfs" />
                  <echo file="${COMMON_TOOLS}/psfs/athena.psf"><?xml version="1.0" encoding="UTF-8"?>
<psf version="2.0">
<provider id="org.eclipse.team.cvs.core.cvsnature">
<project reference="1.0,:pserver:anonymous@dev.eclipse.org:/cvsroot/technology,org.eclipse.dash/athena/org.eclipse.dash.commonbuilder/org.eclipse.dash.commonbuilder.releng,org.eclipse.dash.common.releng,${commonrelengTag}"/>
<project reference="1.0,:pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse,org.eclipse.releng.basebuilder,org.eclipse.releng.basebuilder,${basebuilderTag}"/>
</provider>
</psf></echo>
               </then>
            </if>
            <echo>Fetch projects from athena.psf into ${COMMON_TOOLS}</echo>
            <cvsGetProjectSet cvsreallyquiet="true"
                              cvsUser="anonymous"
                              cvsPwd=""
                              command="checkout"
                              projectSet="${COMMON_TOOLS}/psfs/athena.psf"
                              destination="${COMMON_TOOLS}"
            />
            <property name="relengCommonBuilderDir" value="${COMMON_TOOLS}/org.eclipse.dash.common.releng" />
            <property name="relengBaseBuilderDir" value="${COMMON_TOOLS}/org.eclipse.releng.basebuilder" />
         </then>
      </if>
   </target>

   <target name="init" depends="local">
      <property name="WORKINGDIR" value="${basedir}/.." />
      <property name="COMMON_TOOLS" value="${basedir}/../tools" />
      <mkdir dir="${COMMON_TOOLS}" />

      <available file="${COMMON_TOOLS}/ant-contrib.jar" type="file" property="ant-contrib.jar.exists" />
      <antcall target="get.ant-contrib" />
      <taskdef resource="net/sf/antcontrib/antlib.xml">
         <classpath>
            <pathelement location="${COMMON_TOOLS}/ant-contrib.jar" />
         </classpath>
      </taskdef>

      <available file="${COMMON_TOOLS}/ant4eclipse.jar" type="file" property="ant4eclipse.jar.exists" />
      <antcall target="get.ant4eclipse" />
      <taskdef resource="org/ant4eclipse/antlib.xml">
         <classpath>
            <pathelement location="${COMMON_TOOLS}/ant4eclipse.jar" />
         </classpath>
      </taskdef>

      <antcallback target="get.athena.common.releng.and.releng.basebuilder"
                   return="relengCommonBuilderDir, relengBaseBuilderDir"
      />

      <if>
         <or>
            <not>
               <isset property="relengCommonBuilderDir" />
            </not>
            <not>
               <isset property="relengBaseBuilderDir" />
            </not>
         </or>
         <then>
            <fail>Error!
   $${relengBaseBuilderDir} or $${relengCommonBuilderDir} could not be found!

   Try checking out manually using psfs/athena.psf
</fail>
         </then>
      </if>
<!--     
      <property name="build.properties" value="build.properties" />
      <echo file="${build.properties}" append="true">

#bootstrap.xml properties
WORKINGDIR=${WORKINGDIR}
COMMON_TOOLS=${COMMON_TOOLS}
relengCommonBuilderDir=${relengCommonBuilderDir}
relengBaseBuilderDir=${relengBaseBuilderDir}
</echo>
      <if>
         <isset property="writableBuildRoot" />
         <then>
            <echo file="${build.properties}" append="true">writableBuildRoot=${writableBuildRoot}
</echo>
         </then>
      </if>
-->
   </target>

</project>


This build script will provision the necessary files into the workspace to run the build. It does not depend on hard coded paths or other server specific items. JDK Home directory is provided by the environment variable set by Hudson.