org.eclipse.dash/athena/org.eclipse.dash.commonbuilder/org.eclipse.dash.common.releng/tools/scripts/buildAllHelper.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.140 - (download) (as text) (annotate)
Sat Nov 21 20:21:50 2009 UTC (25 hours, 11 minutes ago) by nickb
Branch: MAIN
CVS Tags: HEAD
Changes since 1.139: +3 -13 lines
https://bugs.eclipse.org/bugs/show_bug.cgi?id=295773
<project name="buildAllHelper.xml : helpful methods for signing, packing and all kinds of crazy crap">

	<target name="initCommandlineArgsList">
		<!-- These variables can be set via commandline (Ant -Dflag) or in project's .releng/build.properties as 
			 overrides for default values in .common.releng/build.properties or .common.releng/server.properties.
			 See buildAll.xml#runEclipse and buildAllHelper.xml#createBuildConfigFile for usage
			 Note that these will be loaded IN ORDER LISTED so for variables that depend on other variables, MUST list in 
			 proper order (eg., if thirdPartyJarsDir = ${writableBuildRoot}/3rdPartyJars, must list writableBuildRoot first)
		-->
		<property name="commandlineArgsList"
		          value="
		version
		projectid
		topprojectName
		projectName
		subprojectName

		buildType
		buildTimestamp
		buildAlias
		zipPrefix
		incubation

		build.steps
		packageFeaturesIncludedBinaries
		failBuildIfTestFailuresOrErrors
		forceContextQualifier

		JAVA_HOME
		PACK200_JAVA_HOME
		writableBuildRoot
		thirdPartyJarsDir
		downloadsDir
		buildDir
		relengBuilderDir
		relengBaseBuilderDir
		relengCommonBuilderDir
		relengCommonScriptsDir

		localSourceCheckoutDir
		localSourceCheckoutDirExcludes

		branch
		projRelengBranch
		commonRelengBranch
		basebuilderBranch
		fetchTag

		noclean
		buildcfg

		dependencyURLs
		repositoryURLs
		featureIDsToInstall
		pluginIDsToInstall
		IUsToInstall
		projectSetFiles"
		/>
	</target>

	<target name="init">

		<property name="writableBuildRoot" value="/opt/public/cbi/build" />
		<property name="thirdPartyJarsDir" value="${writableBuildRoot}/3rdPartyJars" />

		<taskdef resource="net/sf/antcontrib/antlib.xml">
			<classpath>
				<pathelement path="${classpath}" />
				<pathelement location="${relengCommonBuilderDir}/lib/ant-contrib.jar" />
				<pathelement location="${relengBuilderDir}/lib/ant-contrib.jar" />
				<pathelement location="${thirdPartyJarsDir}/ant-contrib.jar" />
				<pathelement location="/usr/share/java/ant-contrib.jar" />
			</classpath>
		</taskdef>
	</target>

	<target name="get.pde.build.svn" description="make sure SVN mapfile support is available">
		<if>
			<not>
				<available file="${relengBaseBuilderDir}/plugins/org.eclipse.pde.build.svn_1.0.1.v20070222.jar" type="file" />
			</not>
			<then>
				<if>
					<available file="${downloadsDir}/org.eclipse.pde.build.svn-1.0.1RC2.zip" />
					<then>
						<echo>Found ${downloadsDir}/org.eclipse.pde.build.svn-1.0.1RC2.zip</echo>
					</then>
					<else>
						<!-- download the requirement, if permitted by license agreement -->
						<echo>Third Party Download License Agreement: ${thirdPartyDownloadLicenseAcceptance}</echo>
						<if>
							<and>
								<isset property="thirdPartyDownloadLicenseAcceptance" />
								<equals arg1="${thirdPartyDownloadLicenseAcceptance}" arg2="&quot;I accept&quot;" />
							</and>
							<then>
								<get src="http://downloads.sourceforge.net/svn-pde-build/org.eclipse.pde.build.svn-1.0.1RC2.zip"
								     dest="${downloadsDir}/org.eclipse.pde.build.svn-1.0.1RC2.zip"
								     usetimestamp="true"
								/>
								<touch file="${downloadsDir}/org.eclipse.pde.build.svn-1.0.1RC2.zip" />
							</then>
						</if>
					</else>
				</if>
				<if>
					<available file="${downloadsDir}/org.eclipse.pde.build.svn-1.0.1RC2.zip" />
					<then>
						<!--
							Note that ${relengBaseBuilderDir} must be writable for this to be updated automatically. If running in Hudson
							and ${relengBaseBuilderDir} is a symlink to a read-only dir, this will fail. You will need to update this by hand.
						-->
						<mkdir dir="/tmp/org.eclipse.pde.build.svn" />
						<unzip src="${downloadsDir}/org.eclipse.pde.build.svn-1.0.1RC2.zip" dest="/tmp/org.eclipse.pde.build.svn" overwrite="true" />
						<if>
							<available file="/tmp/org.eclipse.pde.build.svn/org.eclipse.releng.basebuilder/features" type="dir" />
							<then>
								<mkdir dir="${relengBaseBuilderDir}/features" />
								<move todir="${relengBaseBuilderDir}/features">
									<fileset dir="/tmp/org.eclipse.pde.build.svn/org.eclipse.releng.basebuilder/features" />
								</move>
							</then>
						</if>
						<mkdir dir="${relengBaseBuilderDir}/plugins" />
						<move todir="${relengBaseBuilderDir}/plugins">
							<fileset dir="/tmp/org.eclipse.pde.build.svn/org.eclipse.releng.basebuilder/plugins" />
						</move>
						<delete dir="/tmp/org.eclipse.pde.build.svn" />
					</then>
					<else>
						<echo>Warning!
Cannot find org.eclipse.pde.build.svn-1.0.1RC2.zip.
If your build depends on sources in an SVN repository, it will fail.
You can manually download this zip into ${downloadsDir} from http://downloads.sourceforge.net/svn-pde-build/org.eclipse.pde.build.svn-1.0.1RC2.zip
Or, to download this automatically, see ${relengCommonBuilderDir}/build.properties#thirdPartyDownloadLicenseAcceptance.
</echo>
					</else>
				</if>
			</then>
		</if>
	</target>
	<target name="get.ant4eclipse" description="make sure ant4eclipse support is available">
		<if>
			<not>
				<available file="${relengCommonBuilderDir}/lib/ant4eclipse.jar" type="file" />
			</not>
			<then>
				<if>
					<available file="${downloadsDir}/ant4eclipse-0.5.0.rc1.zip" />
					<then>
						<echo>Found ${downloadsDir}/ant4eclipse-0.5.0.rc1.zip</echo>
					</then>
					<else>
						<!-- download the requirement, if permitted by license agreement -->
						<echo>Third Party Download License Agreement: ${thirdPartyDownloadLicenseAcceptance}</echo>
						<if>
							<and>
								<isset property="thirdPartyDownloadLicenseAcceptance" />
								<or>
									<equals arg1="${thirdPartyDownloadLicenseAcceptance}" arg2="Y" />
									<equals arg1="${thirdPartyDownloadLicenseAcceptance}" arg2="I accept" />
									<equals arg1="${thirdPartyDownloadLicenseAcceptance}" arg2="&quot;I accept&quot;" />
								</or>
							</and>
							<then>
								<get src="http://downloads.sourceforge.net/sourceforge/ant4eclipse/ant4eclipse-0.5.0.rc1.zip"
								     dest="${downloadsDir}/ant4eclipse-0.5.0.rc1.zip"
								     usetimestamp="true"
								/>
								<touch file="${downloadsDir}/ant4eclipse-0.5.0.rc1.zip" />
							</then>
						</if>
					</else>
				</if>
				<if>
					<available file="${downloadsDir}/ant4eclipse-0.5.0.rc1.zip" />
					<then>
						<!--
							Note that ${relengCommonBuilderDir} must be writable for this to be updated automatically. If running in Hudson
							and ${relengCommonBuilderDir} is a symlink to a read-only dir, this will fail. You will need to update this by hand.
						-->
						<mkdir dir="/tmp/net.sf.ant4eclipse" />
						<unzip src="${downloadsDir}/ant4eclipse-0.5.0.rc1.zip" dest="/tmp/net.sf.ant4eclipse" overwrite="true" />
						<move file="/tmp/net.sf.ant4eclipse/ant4eclipse-0.5.0.rc1.jar" tofile="${relengCommonBuilderDir}/lib/ant4eclipse.jar" />
						<delete dir="/tmp/net.sf.ant4eclipse" />
					</then>
					<else>
						<echo>Warning!
Cannot find ant4eclipse-0.5.0.rc1.zip.
If your build depends on fetching sources from a .psf file, it will fail.
You can manually download this zip into ${downloadsDir} from http://downloads.sourceforge.net/sourceforge/ant4eclipse/ant4eclipse-0.5.0.rc1.zip, 
then place the renamed jar (ant4eclipse.jar) into ${relengCommonBuilderDir}/lib.
Or, to download this automatically, see ${relengCommonBuilderDir}/build.properties#thirdPartyDownloadLicenseAcceptance.
</echo>
					</else>
				</if>
			</then>
		</if>
	</target>

	<target name="copyJars">
		<!--
			must load a properties file first, eg.
			<property file="${buildDirectory}/../${projRelengName}/builder/sdk/extraJars.properties" />
		-->
		<echo message="Copy ${jars} ..." />
		<mkdir dir="${buildDirectory}/${dir}" />
		<copy todir="${buildDirectory}/${dir}" failonerror="true" verbose="true">
			<fileset dir="${thirdPartyJarsDir}" includes="${jars}" />
			<mapper type="flatten" />
		</copy>
	</target>

	<!-- echo timestamp into log: format can be "MM/dd/yyyy hh:mm:ss aa" or "hh:mm:ss" -->
	<target name="-timestamp">
		<tstamp>
			<format property="-timestamp" pattern="hh:mm:ss" />
		</tstamp>
		<echo>${-timestamp}</echo>
	</target>

	<target name="unpackUpdateJarsAndRepack"
	        description="Use this in to convert a Master zip (with jarred features and plugins) to an SDK zip (with unpacked features and mix of jarred/unpacked plugins)."
	>
		<!-- must be set when called: should be masterZip containing features and plugins as ONLY jars, no folders -->
		<property name="sourceZip" value="${buildDirectory}/${buildLabel}/${archiveName}" />
		<!-- must be set when called; could be sdkZip, allZip, etc; by default, useful in customTargets.xml#postBuild (see gmf.releng) -->
		<property name="targetZip" value="${buildDirectory}/${buildLabel}/${archiveName}" />

		<property name="tmpsite" value="${buildDirectory}/unpacktmp" />
		<mkdir dir="${tmpsite}/new/eclipse/features" />
		<mkdir dir="${tmpsite}/new/eclipse/plugins" />
		<unzip src="${sourceZip}" dest="${tmpsite}" />
		<unpackUpdateJars site="${tmpsite}/eclipse" output="${tmpsite}/new/eclipse" />
		<!-- copy root files (if applicable?) -->
		<copy todir="${tmpsite}/new/eclipse">
			<fileset dir="${tmpsite}/eclipse">
				<include name="*" />
			</fileset>
		</copy>
		<zip destfile="${targetZip}" basedir="${tmpsite}/new" />
		<delete dir="${tmpsite}" />
	</target>

	<target name="removeRootFilesFromMaster"
	        description="Use this to purge any rootfiles from the Master zip, and either create a new zip or replace an existing one"
	>
		<property name="sourceZip" value="${buildDirectory}/${buildLabel}/${masterZip}" />
		<!-- can override defaults here -->
		<property name="targetZip" value="${buildDirectory}/${buildLabel}/${masterZip}" />
		<!-- can override defaults here -->
		<zip destfile="${sourceZip}_" update="true">
			<zipfileset src="${sourceZip}" dirmode="775" filemode="664" includes="**/*.jar, **/*.jar.pack.gz, **/pack.properties, *.jar, site.xml" />
		</zip>
		<move file="${sourceZip}_" tofile="${targetZip}" overwrite="true" verbose="false" failonerror="true" />
	</target>

	<!-- remove all but *.jar & *.jar.pack.gz from Master zip so it can be used for Update site generation -->
	<target name="removeFeatureAndPluginFoldersFromMasterZip">
		<zip destfile="${buildDirectory}/${buildLabel}/${masterZip}.tmp" update="true">
			<zipfileset src="${buildDirectory}/${buildLabel}/${masterZip}"
			            dirmode="775"
			            filemode="664"
			            includes="**/plugins/*.jar, **/plugins/*.jar.pack.gz, **/features/*.jar, **/features/*.jar.pack.gz"
			/>
		</zip>
		<move file="${buildDirectory}/${buildLabel}/${masterZip}.tmp" tofile="${buildDirectory}/${buildLabel}/${masterZip}" overwrite="true" />
	</target>

	<!--poll file for change in attributes: while running /usr/bin/sign, you can watch /tmp/jarsigner for progress -->
	<target name="checkForSignedZip">
		<if>
			<equals arg1="${buildServerUser}" arg2="" />
			<then>
				<exec dir="${buildDirectory}" executable="ls" outputProperty="-checkResults">
					<arg line="${execline}" />
				</exec>
			</then>
			<else>
				<exec dir="${buildDirectory}" executable="ssh" outputProperty="-checkResults">
					<arg line="${execline}" />
				</exec>
			</else>
		</if>

		<if>
			<or>
				<!-- failure conditions -->
				<contains string="${-checkResults}" substring="Host key verification failed." casesensitive="no" />
				<contains string="${-checkResults}" substring="Permission denied, please try again." casesensitive="no" />
				<contains string="${-checkResults}" substring="Received disconnect from " casesensitive="no" />
				<contains string="${-checkResults}" substring="Too many authentication failures for" casesensitive="no" />
				<contains string="${-checkResults}" substring="ssh: dashBuild: Name or service not known" casesensitive="no" />
			</or>
			<then>
				<fail>Error!
Build cannot connect to ${buildServerUser}:
----------
${-checkresults}
----------
Check your ssh keys and ensure you are authorized to connect as ${buildServerUser}.
You can also set a different default value in build.properties for buildServerUser if needed.
 
</fail>
			</then>
		</if>
		<echo>${-checkResults}</echo>
		<condition property="-foundSignedZip">
			<or>
				<not>
					<contains string="${-checkResults}" substring="No such file or directory" casesensitive="no" />
				</not>
				<contains string="${-checkResults}" substring="bash: line 0: cd:" casesensitive="no" />
			</or>
		</condition>
	</target>

	<target name="signMasterZip" if="sign" unless="skipSign">
		<antcall target="-timestamp" inheritAll="false" />
		<!-- if running as hudson, use simple path in workspace; if running commandline, connect over ssh to remote staging.priv dir -->
		<if>
			<or>
				<contains string="${user.name}" substring="hudson" />
				<contains string="${user.home}" substring="hudson" />
			</or>
			<then>
				<property name="buildServerUser" value="" />
				<property name="signingDir" value="${writableBuildRoot}/signing" />
				<mkdir dir="${signingDir}" />
			</then>
			<else>
				<!-- user with write perms in staging dir & permission to run /usr/bin/sign -->
				<property name="buildServerUser" value="dashBuild@build.eclipse.org" />
				<property name="signingDir" value="/home/data/httpd/download-staging.priv/commonBuild" />
			</else>
		</if>

		<property name="packtmp" value="${buildDirectory}/packtmp" />
		<!-- eg., /home/data/httpd/download-staging.priv/commonBuild/I200902091923-out -->
		<property name="signingDirOutput" value="${signingDir}/${buildId}-out" />
		<property name="outputFile" value="${signingDirOutput}/${masterZip}" />
		<!-- valid values are mail|nomail -->
		<property name="mailStatus" value="nomail" />


		<antcall target="-timestamp" inheritAll="false" />
		<mkdir dir="${packtmp}" />
		<move file="${buildDirectory}/${buildLabel}/${masterZip}" tofile="${packtmp}/${masterZip}" />
		<!-- add pack.properties file that specifies effort level -->
		<zip destfile="${packtmp}/${masterZip}" update="true">
			<fileset dir="${relengCommonScriptsDir}" includes="pack.properties" />
		</zip>

		<if>
			<equals arg1="${buildServerUser}" arg2="" />
			<then>
				<echo message="Signing ${masterZip} in ${signingDir} on localhost ..." />
			</then>
			<else>
				<echo message="Signing ${masterZip} as ${buildServerUser} in ${signingDir} ..." />
			</else>
		</if>

		<!--push drop to staging directory-->
		<antcall target="-timestamp" inheritAll="false" />
		<echo message="Push ${masterZip} to staging directory" />
		<if>
			<equals arg1="${buildServerUser}" arg2="" />
			<then>
				<copy file="${packtmp}/${masterZip}" todir="${signingDir}" />
				<chmod perm="ugo+rw" file="${signingDir}/${masterZip}" output="${buildDirectory}/signing.txt" append="true" />
			</then>
			<else>
				<exec dir="${packtmp}" executable="scp" output="${buildDirectory}/signing.txt">
					<arg line="${masterZip} ${buildServerUser}:${signingDir}" />
				</exec>
				<exec dir="${buildDirectory}" executable="ssh" output="${buildDirectory}/signing.txt" append="true">
					<arg line="${buildServerUser} &quot;/bin/chmod ugo+rw ${signingDir}/${masterZip}&quot;" />
				</exec>
			</else>
		</if>

		<property name="signed.zip.check.interval.seconds" value="180" />
		<property name="signed.zip.check.limit" value="15" />

		<!--invoke sign script and wait-->
		<antcall target="-timestamp" inheritAll="false" />
		<echo>Invoke sign script and wait ${signed.zip.check.limit} x ${signed.zip.check.interval.seconds} seconds</echo>
		<if>
			<and>
				<equals arg1="${buildServerUser}" arg2="" />
				<available file="/usr/bin/sign" type="file" />
			</and>
			<then>
				<exec dir="${signingDir}" executable="/usr/bin/sign" output="${buildDirectory}/signing.txt" append="true">
					<arg line="${signingDir}/${masterZip} ${mailStatus} ${signingDirOutput}" />
				</exec>
			</then>
			<else>
				<exec dir="." executable="ssh" output="${buildDirectory}/signing.txt" append="true">
					<arg line="${buildServerUser} &quot;cd ${signingDir}; /usr/bin/sign ${signingDir}/${masterZip} ${mailStatus} ${signingDirOutput}&quot;"
					/>
				</exec>
			</else>
		</if>

		<if>
			<available file="${buildDirectory}/signing.txt" type="file" />
			<then>
				<loadfile property="signing.log" srcfile="${buildDirectory}/signing.txt" failonerror="false" />
				<if>
					<contains string="${signing.log}" substring="Permission denied" />
					<then>
						<echo>Error!
Signing process has returned a Permission denied error:
----------
${signing.log}
----------	
Please report a bug to webmaster@eclipse.org quoting this message.
 
</echo>
						<antcall target="signMasterZipHasFailed" />
					</then>
					<else>

						<!-- Wait for signed build to be available -->
						<trycatch>
							<try>
								<retry retrycount="${signed.zip.check.limit}">
									<sequential>
										<echo>Sleep for ${signed.zip.check.interval.seconds} seconds...</echo>
										<sleep seconds="${signed.zip.check.interval.seconds}" />
										<antcall target="-timestamp" inheritAll="false" />
										<if>
											<equals arg1="${buildServerUser}" arg2="" />
											<then>
												<antcallback target="checkForSignedZip" return="-foundSignedZip">
													<param name="execline" value="${outputFile}" />
												</antcallback>
											</then>
											<else>
												<antcallback target="checkForSignedZip" return="-foundSignedZip">
													<param name="execline" value="${buildServerUser} &quot;ls ${outputFile}&quot;" />
												</antcallback>
											</else>
										</if>
										<if>
											<not>
												<isset property="-foundSignedZip" />
											</not>
											<then>
												<!-- Force the <retry> to loop -->
												<fail>Zip unavailable - will try again in ${signed.zip.check.interval.seconds} seconds...</fail>
											</then>
										</if>
									</sequential>
								</retry>
							</try>
							<!-- catch BuildException and throw it away -->
							<catch />
						</trycatch>
						<if>
							<isset property="-foundSignedZip" />
							<then>
								<!-- if we got the ${outputFile}, retrieve it via copy or scp, then clean up -->
								<if>
									<equals arg1="${buildServerUser}" arg2="" />
									<then>
										<copy file="${outputFile}" todir="${buildDirectory}/${buildLabel}" />
										<delete includeEmptyDirs="true">
											<fileset dir="${signingDirOutput}" />
											<fileset file="${signingDir}/${masterZip}" />
										</delete>
									</then>
									<else>
										<exec dir="." executable="scp" output="${buildDirectory}/signing.txt" append="true">
											<arg line="${buildServerUser}:${outputFile} ${buildDirectory}/${buildLabel}" />
										</exec>
										<exec dir="." executable="ssh" output="${buildDirectory}/signing.txt" append="true">
											<arg line="${buildServerUser} &quot;/bin/rm -rf ${signingDirOutput} ${signingDir}/${masterZip}&quot;" />
										</exec>
									</else>
								</if>
							</then>
							<else>
								<echo>Warning!
Signed zip check failed after ${signed.zip.check.limit} checks every ${signed.zip.check.interval.seconds} seconds.
Check ${buildDirectory}/signing.txt for any signs of error which might explain this failure.
</echo>
								<antcall target="signMasterZipHasFailed" />
							</else>
						</if>

					</else>
				</if>
			</then>
		</if>
	</target>

	<target name="signMasterZipHasFailed">
		<echo>Build will proceed w/ unsigned, unprocessed Master zip, ${masterZip}</echo>
		<!-- get an unsigned Master zip where we need it -->
		<copy file="${packtmp}/${masterZip}" todir="${buildDirectory}/${buildLabel}" />
		<!-- cleanup -->
		<if>
			<equals arg1="${buildServerUser}" arg2="" />
			<then>
				<delete includeEmptyDirs="true">
					<fileset dir="${signingDirOutput}" />
					<fileset file="${signingDir}/${masterZip}" />
				</delete>
			</then>
			<else>
				<exec dir="." executable="ssh" output="${buildDirectory}/signing.txt" append="true">
					<arg line="${buildServerUser} &quot;/bin/rm -rf ${signingDirOutput} ${signingDir}/${masterZip}&quot;" />
				</exec>
			</else>
		</if>
	</target>

	<target name="get.PACK200_JAVA_HOME">
		<!-- update location of jvm arguments: use JAVA60_HOME or JAVA50_HOME if running w/ a 1.4 JDK; else use JAVA_HOME -->
		<for param="pack200home"
		     list=" ${JAVA50_HOME}/jre,	${JAVA50_HOME}, ${JAVA60_HOME}/jre,	${JAVA60_HOME}, ${JAVA_HOME}/jre, ${JAVA_HOME}"
		     delimiter=", "
		>
			<sequential>
				<if>
					<or>
						<available file="@{pack200home}/bin/pack200" type="file" />
						<available file="@{pack200home}/bin/pack200.exe" type="file" />
					</or>
					<then>
						<property name="PACK200_JAVA_HOME" value="@{pack200home}" />
					</then>
				</if>
			</sequential>
		</for>
	</target>

	<target name="packMasterZip" unless="skipPack">
		<if>
			<os family="windows" />
			<then>
				<echo>
** Sorry, pack200 processing is not yet supported on Windows. See http://bugs.eclipse.org/268405 **
</echo>
			</then>
			<else>
				<property name="packtmp" value="${buildDirectory}/packtmp" />
				<delete dir="${packtmp}" quiet="true" />
				<mkdir dir="${packtmp}" />
				<move file="${buildDirectory}/${buildLabel}/${masterZip}" tofile="${packtmp}/${masterZip}" />

				<!-- copy pack200 script into ${buildDirectory}/pack200tmp -->
				<property name="pack200tmp" value="${buildDirectory}/pack200tmp" />
				<delete dir="${pack200tmp}" quiet="true" />
				<mkdir dir="${pack200tmp}" />
				<copy file="${relengCommonScriptsDir}/pack200" tofile="${pack200tmp}/pack200" />

				<!-- use default pack.properties if not exist in project's releng -->
				<if>
					<not>
						<available file="${pack200tmp}/pack.properties" type="file" />
					</not>
					<then>
						<copy file="${relengCommonScriptsDir}/pack.properties" todir="${pack200tmp}" />
					</then>
				</if>

				<antcallback target="get.PACK200_JAVA_HOME" return="PACK200_JAVA_HOME" />

				<if>
					<and>
						<isset property="PACK200_JAVA_HOME" />
					</and>
					<then>
						<echo>Pack with ${PACK200_JAVA_HOME}/bin/pack200</echo>
						<replace file="${pack200tmp}/pack200" token="@pack200@" value="${PACK200_JAVA_HOME}/bin/pack200" />
						<chmod file="${pack200tmp}/pack200" perm="755" />

						<!--condition jar if it is not pushed to eclipse.org for signing-->
						<condition property="repack" value="-repack">
							<or>
								<not>
									<isset property="sign" />
								</not>
								<isset property="skipSign" />
							</or>
						</condition>
						<property name="repack" value="" />

						<!--pack200-->
						<java jar="${eclipse.home}/plugins/org.eclipse.equinox.launcher.jar"
						      fork="true"
						      timeout="10800000"
						      jvm="${PACK200_JAVA_HOME}/bin/java"
						      failonerror="true"
						      maxmemory="768m"
						      error="${buildDirectory}/errorlog.txt"
						      dir="${buildDirectory}"
						      output="${buildDirectory}/jarprocessorlog.txt"
						>
							<jvmarg value="-showversion" />
							<jvmarg value="-Dorg.eclipse.update.jarprocessor.pack200=${pack200tmp}" />
							<arg line="-consolelog -application org.eclipse.update.core.siteOptimizer" />
							<arg line="-jarProcessor -verbose -outputDir ${buildLabel} -processAll -pack ${repack} ${packtmp}/${masterZip}" />
						</java>

						<delete dir="${packtmp}" />
						<delete dir="${pack200tmp}" />
					</then>
					<else>
						<echo>Warning!
Could not find pack200 executable
	in ${JAVA_HOME},
	in ${JAVA60_HOME} or
	in ${JAVA50_HOME}

No packed jars (.jar.pack.gz) will be produced for this build.
</echo>
					</else>
				</if>
			</else>
		</if>
	</target>

	<!-- generate a p2 repo / update site from Master zip; if packed jars available, use those; if not, use normal jars -->
	<target name="buildUpdate" description="Generate or reuse site.xml + p2 metadata for update site; package site as archived p2 repo (zip)">
		<antcall target="buildMasterZip" />
		<antcall target="processMasterZip" />

		<propertyregex property="updateZip"
		               input="${masterZip}"
		               defaultvalue="${masterZip}"
		               regexp="-Master-"
		               replace="-Update-"
		               casesensitive="false"
		               override="true"
		/>

		<!-- because buildZips depends on buildUpdate, we only want to do this once; if the output updateZip already exists, don't redo this step -->
		<if>
			<not>
				<available file="${buildDirectory}/${buildLabel}/${updateZip}" type="file" />
			</not>
			<then>
				<property name="p2tmp" value="${buildDirectory}/p2tmp" />
				<mkdir dir="${p2tmp}" />
				<unzip src="${buildDirectory}/${buildLabel}/${masterZip}" dest="${p2tmp}" overwrite="true" />
				<var name="updateSiteJarDir" value="${p2tmp}/eclipse" />

				<!-- [275202] TODO: support injecting other jars into the update site -->

				<!-- determine if the update site will contain .jar.pack.gz or .jar -->
				<var name="pack200Files" value="" />
				<for param="packedJar">
					<path>
						<fileset dir="${updateSiteJarDir}" includes="**/*.jar.pack.gz" />
					</path>
					<sequential>
						<if>
							<available file="@{packedJar}" type="file" />
							<then>
								<var name="pack200Files" value="-reusePack200Files" />
								<!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=272109#c13 :: remove the plugin jars from the site so they won't be in the metadata
									only problem w/ this approach is that any jars which were NOT packed by an exclusion rule will be deleted w/o a packed counterpart 
								-->
								<!-- tests failed to run (p2.director install fail) with this change -->
								<!-- <delete dir="${updateSiteJarDir}/plugins" includes="*.jar"/> -->
							</then>
						</if>
					</sequential>
				</for>

				<!-- allow user-defined category.xml with expandable featureid.version variables -->
				<if>
					<available file="${relengBuilderDir}/category.xml" type="file" />
					<then>
						<echo>Using ${relengBuilderDir}/category.xml template for p2 repo / update site categories...</echo>
						<for param="featureJar">
							<path>
								<fileset dir="${updateSiteJarDir}/features" includes="*.jar" />
							</path>
							<sequential>
								<var name="feature.jarfile" unset="true" />
								<var name="feature.id" unset="true" />
								<var name="feature.version" unset="true" />
								<propertyregex property="feature.jarfile"
								               defaultvalue="@{featureJar}"
								               input="@{featureJar}"
								               regexp=".+/features/([^/]+\.jar)"
								               replace="\1"
								               override="true"
								/>
								<propertyregex property="feature.id"
								               defaultvalue="${feature.jarfile}"
								               input="${feature.jarfile}"
								               regexp="([^_]+)_(\d+\.\d+\.\d+\..+)\.jar"
								               replace="\1"
								               override="true"
								/>
								<propertyregex property="feature.version"
								               defaultvalue="${feature.jarfile}"
								               input="${feature.jarfile}"
								               regexp="([^_]+)_(\d+\.\d+\.\d+\..+)\.jar"
								               replace="\2"
								               override="true"
								/>
								<property name="${feature.id}.version" value="${feature.version}" />
								<var name="feature.jarfile" unset="true" />
								<var name="feature.id" unset="true" />
								<var name="feature.version" unset="true" />
							</sequential>
						</for>
						<if>
							<equals arg1="${buildAlias}" arg2="${buildID}" />
							<then>
								<property name="category.name" value="${zipPrefix} ${version} ${buildID}" />
							</then>
							<else>
								<property name="category.name" value="${zipPrefix} ${buildAlias} ${buildID}" />
							</else>
						</if>
						<loadfile property="site.xml.transformed" srcfile="${relengBuilderDir}/category.xml">
							<filterchain>
								<expandproperties />
							</filterchain>
						</loadfile>
						<echo file="${updateSiteJarDir}/site.xml" message="${site.xml.transformed}" />
					</then>
					<else>
						<antcall target="buildSiteXml" />
					</else>
				</if>

				<!-- use unpacked features due to bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=269199, 273519 -->
				<copy todir="${buildDirectory}/${buildLabel}/${updateZip}_tmp">
					<fileset dir="${updateSiteJarDir}" includes="features/*.jar, site.xml" />
				</copy>
				<for param="jarfile">
					<path>
						<fileset dir="${updateSiteJarDir}" includes="plugins/*.jar" />
					</path>
					<sequential>
						<var name="jarname" unset="true" />
						<basename property="jarname" file="@{jarfile}" />
						<if>
							<!-- add the jar.pack.gz if it exists; otherwise add the unpacked jar -->
							<available file="@{jarfile}.pack.gz" type="file" />
							<then>
								<copy todir="${buildDirectory}/${buildLabel}/${updateZip}_tmp">
									<fileset dir="${updateSiteJarDir}" includes="plugins/${jarname}.pack.gz" />
								</copy>
							</then>
							<else>
								<copy todir="${buildDirectory}/${buildLabel}/${updateZip}_tmp">
									<fileset dir="${updateSiteJarDir}" includes="plugins/${jarname}" />
								</copy>
							</else>
						</if>
					</sequential>
				</for>

				<antcall target="p2.meta">
					<param name="updateSiteDir" value="${updateSiteJarDir}" />
				</antcall>

				<zip destfile="${buildDirectory}/${buildLabel}/${updateZip}" update="true">
					<fileset dir="${buildDirectory}/${buildLabel}/${updateZip}_tmp" includes="features/*.jar, plugins/*.jar*, site.xml" />
					<fileset dir="${updateSiteJarDir}" includes="artifacts.jar, content.jar" />
				</zip>

				<delete dir="${buildDirectory}/${buildLabel}/${updateZip}_tmp" quiet="true" />
			</then>
		</if>
	</target>

	<target name="p2.meta" description="Generate p2 metadata for a folder w/ site.xml and features/ plugins/">
		<!-- must be set when calling this task-->
		<property name="updateSiteDir" value="" />

		<!--  debugging
		<echoproperties format="text" destfile="${updateSiteJarDir}/echoproperties.txt" />
		<exec executable="/usr/bin/find"
	    	  failifexecutionfails="false"
	      	append="true"
	      	output="${updateSiteJarDir}/find.all.files.txt"
	      	dir="${updateSiteJarDir}"
	      	error="${updateSiteJarDir}/find.all.files.txt"
		/>
		debugging -->

		<antcallback target="get.PACK200_JAVA_HOME" return="PACK200_JAVA_HOME" />
		<for param="launcherjar">
			<path>
				<fileset dir="${relengBaseBuilderDir}/plugins" includes="org.eclipse.equinox.launcher_*.jar" />
			</path>
			<sequential>
				<!-- See http://wiki.eclipse.org/Equinox_p2_Metadata_Generator -->
				<echo>Run p2 metadata generator with ${PACK200_JAVA_HOME}</echo>
				<java jar="@{launcherjar}"
				      fork="true"
				      timeout="10800000"
				      jvm="${PACK200_JAVA_HOME}/bin/java"
				      failonerror="false"
				      maxmemory="256m"
				      taskname="p2.meta"
				>
					<classpath>
						<fileset dir="${relengBaseBuilderDir}/plugins" includes="org.eclipse.equinox.launcher_*.jar" />
						<pathelement location="${relengBaseBuilderDir}/plugins" />
					</classpath>
					<arg line=" org.eclipse.equinox.launcher.Main -application org.eclipse.equinox.p2.metadata.generator.EclipseGenerator" />
					<arg line=" -updateSite ${updateSiteDir}/ -site file:${updateSiteDir}/site.xml" />
					<arg line=" -metadataRepository file:${updateSiteDir}/ -metadataRepositoryName &quot;${projectid} Update Site&quot;" />
					<arg line=" -artifactRepository file:${updateSiteDir}/ -artifactRepositoryName &quot;${projectid} Artifacts&quot;" />
					<arg line=" -compress -noDefaultIUs -reusePack200Files" />
				</java>
			</sequential>
		</for>
	</target>

	<target name="buildSiteXml" description="Generate a site.xml to contain the features in a category">
		<!-- TODO: given a list of features, produce site.xml so they're contained in a default category (or, fix bug 269226 so we don't need this) -->
		<!-- TODO: support <site mirrorsURL="" associatedSites="" etc.> ? -->
		<echo>Generating site.xml for use with p2 repo / update site categories...</echo>
		<echo file="${updateSiteJarDir}/site.xml">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</echo>
		<if>
			<equals arg1="${pack200Files}" arg2="-reusePack200Files" />
			<then>
				<echo append="true" file="${updateSiteJarDir}/site.xml">&lt;site pack200="true"&gt;</echo>
			</then>
			<else>
				<echo append="true" file="${updateSiteJarDir}/site.xml">&lt;site&gt;</echo>
			</else>
		</if>

		<if>
			<or>
				<equals arg1="${buildAlias}" arg2="${buildID}" />
				<contains string="${buildAlias}" substring="-SNAPSHOT" />
			</or>
			<then>
				<property name="category.name" value="${zipPrefix} ${version} ${buildID}" />
			</then>
			<else>
				<property name="category.name" value="${zipPrefix} ${buildAlias} ${buildID}" />
			</else>
		</if>

		<echo append="true" file="${updateSiteJarDir}/site.xml">	&lt;description&gt;To install these features, point Eclipse at this site.&lt;/description&gt;

	&lt;!-- ${category.name} --&gt;
	&lt;category-def label="${category.name}" name="${category.name}"&gt;
		&lt;description&gt;${category.name}: contains all features in this build.&lt;/description&gt;
	&lt;/category-def&gt;
</echo>

		<for param="featureJar">
			<path>
				<fileset dir="${updateSiteJarDir}/features" includes="*.jar" />
			</path>
			<sequential>
				<var name="feature.jarfile" unset="true" />
				<var name="feature.id" unset="true" />
				<var name="feature.version" unset="true" />
				<propertyregex property="feature.jarfile"
				               defaultvalue="@{featureJar}"
				               input="@{featureJar}"
				               regexp=".+/features/([^/]+\.jar)"
				               replace="\1"
				               override="true"
				/>
				<propertyregex property="feature.id"
				               defaultvalue="${feature.jarfile}"
				               input="${feature.jarfile}"
				               regexp="([^_]+)_(\d+\.\d+\.\d+\..+)\.jar"
				               replace="\1"
				               override="true"
				/>
				<propertyregex property="feature.version"
				               defaultvalue="${feature.jarfile}"
				               input="${feature.jarfile}"
				               regexp="([^_]+)_(\d+\.\d+\.\d+\..+)\.jar"
				               replace="\2"
				               override="true"
				/>
				<echo append="true" file="${updateSiteJarDir}/site.xml">	&lt;feature id="${feature.id}" version="${feature.version}" url="features/${feature.jarfile}" patch="false"&gt;
		&lt;category name="${category.name}"/&gt;
	&lt;/feature&gt;
</echo>
				<var name="feature.jarfile" unset="true" />
				<var name="feature.id" unset="true" />
				<var name="feature.version" unset="true" />
			</sequential>
		</for>
		<echo append="true" file="${updateSiteJarDir}/site.xml">
&lt;/site&gt;
</echo>
	</target>

	<target name="buildMasterZip" description="only do this step if there's no Master zip already created; called by buildZips and buildUpdate">
		<if>
			<not>
				<available file="${buildDirectory}/${buildLabel}/${masterZip}" type="file" />
			</not>
			<then>
				<antcall target="-timestamp" inheritall="false" />

				<!-- build Master Zip using "outputUpdateJars=true" in build.properties so we get ONLY jars, not mix of folders & jars -->
				<ant antfile="${relengCommonBuilderDir}/build.xml" target="main">
					<property name="component" value="builder/all" />
				</ant>

				<antcall target="-timestamp" inheritall="false" />

				<echo>Signing control properties:
	sign = ${sign}
	skipSign = ${skipSign}
	domainNamespace = ${domainNamespace}</echo>
				<antcall target="signMasterZip">
					<param name="mailStatus" value="nomail" />
				</antcall>

				<!-- Unpack jars to ALL zip with mix of folders & jars -->
				<antcall target="unpackUpdateJarsAndRepack">
					<param name="sourceZip" value="${buildDirectory}/${buildLabel}/${masterZip}" />
					<param name="targetZip" value="${buildDirectory}/${buildLabel}/${allZip}" />
				</antcall>
			</then>
		</if>
	</target>

	<target name="processMasterZip" description="only do this step once">
		<if>
			<not>
				<available file="${buildDirectory}/processMasterZip.done" type="file" />
			</not>
			<then>
				<antcall target="-timestamp" inheritall="false" />

				<!-- pack the master zip: to skip this step, set skipPack=true in your .releng/build.properties -->
				<antcall target="packMasterZip" />

				<antcall target="-timestamp" inheritall="false" />
				<echo file="${buildDirectory}/processMasterZip.done" message="processMasterZip.done=true" />
			</then>
		</if>
	</target>

	<!-- [248509, 271851] use p2 publisher to create SDKs once it's ready & documented -->
	<target name="run.publisher">
	</target>

	<!-- Required properties are:
			p2.director.installIU [csv list], p2.director.input.repo [csv list], and p2.director.destination [directory]
		 Optional properties are:  
		 	p2.director.bundlepool, p2.director.extraArgs
	-->
	<!-- 
	TODO: install from update site zips: need to fetch them, unzip them, install from them, and clean up
	repositoryURLs=\
	http://www.eclipse.org/modeling/download.php?r=1&amp;file=/modeling/emf/emf/downloads/drops/2.4.2/R200902171115/emf-sdo-xsd-Update-2.4.2.zip,\
	http://www.eclipse.org/gef/download.php?r=1&amp;file=/tools/gef/downloads/drops/3.4.2/R200902171642/GEF-Update-3.4.2.zip
	featureIDsToInstall=org.eclipse.emf,org.eclipse.gef
	-->
	<target name="run.director" description="install from p2 repos">
		<!-- installType = feature or plugin -->
		<property name="p2.director.installType" value="feature" />
		<property name="p2.director.installIU" value="${mainFeatureToBuildID}" />
		<property name="p2.director.input.repo" value="jar:file:${buildDirectory}/${buildLabel}/${updateZip}!/" />
		<property name="p2.director.destination" value="${install}/eclipse" />
		<property name="p2.director.bundlepool" value="${p2.director.destination}" />
		<!-- Eclipse 3.4: use deprecated org.eclipse.equinox.p2.director.app.application; 
			 Eclipse 3.5 (osgi.framework.version=3.5+): use org.eclipse.equinox.p2.director to allow installing multiple IUs in a single operation -->
		<if>
			<contains string="${osgi.framework.version}" substring="3.4." />
			<then>
				<echo>Using deprecated Eclipse 3.4 org.eclipse.equinox.p2.director.app.application</echo>
				<property name="p2.director.application" value="org.eclipse.equinox.p2.director.app.application" />
			</then>
			<else>
				<property name="p2.director.application" value="org.eclipse.equinox.p2.director" />
			</else>
		</if>

		<!-- could pass in args such as '-p2.os linux -p2.ws gtk -p2.arch x86' -->
		<property name="p2.director.extraArgs" value="" />
		<!-- to avoid using mirrors when fetching, use -Declipse.p2.mirrors=false -->
		<property name="p2.director.extraVmArgs" value="" />

		<!-- verify that the URLs are valid - for zips, need to fetch them & unzip them, then clean up after -->
		<property name="p2repoZipsTmp" value="${buildDirectory}/p2repoZipsTmp" />
		<mkdir dir="${p2repoZipsTmp}" />
		<var name="p2.director.input.repo.cleaned" value="" />
		<for param="repoURL" delimiter=", " list="${p2.director.input.repo}">
			<sequential>
				<if>
					<!-- prefetch remote repo zips and treat them as local repos -->
					<and>
						<contains string="@{repoURL}" substring=".zip" />
						<or>
							<contains string="@{repoURL}" substring="http://" />
							<contains string="@{repoURL}" substring="https://" />
							<contains string="@{repoURL}" substring="ftp://" />
						</or>
					</and>
					<then>
						<propertyregex property="repoFile"
						               input="@{repoURL}"
						               defaultvalue="@{repoURL}"
						               regexp=".+/([^/]+.zip)"
						               replace="\1"
						               casesensitive="false"
						               override="true"
						/>
						<ant target="getDep" antfile="${relengCommonBuilderDir}/tools/scripts/getDependencies.xml">
							<property name="url" value="@{repoURL}" />
							<property name="file" value="${repoFile}" />
							<property name="unpackDest" value="${p2repoZipsTmp}/${repoFile}_" />
						</ant>
						<if>
							<not>
								<and>
									<or>
										<available file="${p2repoZipsTmp}/${repoFile}_/artifacts.jar" type="file" />
										<available file="${p2repoZipsTmp}/${repoFile}_/artifacts.xml" type="file" />
									</or>
									<or>
										<available file="${p2repoZipsTmp}/${repoFile}_/content.jar" type="file" />
										<available file="${p2repoZipsTmp}/${repoFile}_/content.xml" type="file" />
									</or>
								</and>
							</not>
							<then>
								<if>
									<available file="${p2repoZipsTmp}/${repoFile}_/site.xml" type="file" />
									<then>
										<echo>Generating metadata for this update site</echo>
										<antcall target="p2.meta">
											<param name="updateSiteDir" value="${p2repoZipsTmp}/${repoFile}_" />
											<param name="projectid" value="${repoFile}" />
										</antcall>
									</then>
									<else>
										<fail>Update site in ${repoFile} contains no site.xml and no p2 metadata. Cannot proceed.</fail>
									</else>
								</if>
							</then>
						</if>
						<zip destfile="${p2repoZipsTmp}/${repoFile}" update="false" basedir="${p2repoZipsTmp}/${repoFile}_" />
						<delete dir="${p2repoZipsTmp}/${repoFile}_" includeemptydirs="true" quiet="true" />
						<var name="p2.director.input.repo.cleaned"
						     value="${p2.director.input.repo.cleaned},jar:file:${p2repoZipsTmp}/${repoFile}!/"
						/>
					</then>
					<elseif>
						<or>
							<contains string="@{repoURL}" substring="http://" />
							<contains string="@{repoURL}" substring="https://" />
							<contains string="@{repoURL}" substring="ftp://" />
							<contains string="@{repoURL}" substring="file:" />
						</or>
						<then>
							<var name="p2.director.input.repo.cleaned" value="${p2.director.input.repo.cleaned},@{repoURL}" />
						</then>
					</elseif>
					<else>
						<var name="p2.director.input.repo.cleaned" value="${p2.director.input.repo.cleaned},file:@{repoURL}" />
					</else>
				</if>
			</sequential>
		</for>
		<!-- trim prefix "," -->
		<propertyregex property="p2.director.input.repo.cleaned"
		               input="${p2.director.input.repo.cleaned}"
		               defaultvalue="${p2.director.input.repo.cleaned}"
		               regexp=",(.+)"
		               replace="\1"
		               override="true"
		/>
		<mkdir dir="${p2.director.bundlepool}" />
		<!-- See http://wiki.eclipse.org/Equinox_p2_director_application/Examples/Install_into_eclipse_using_SDKProfile -->
		<if>
			<equals arg1="${p2.director.installType}" arg2="feature" />
			<then>
				<property name="p2.director.installIU.cmd" value="-installIU ${p2.director.installIU}.feature.group" />
			</then>
			<else>
				<property name="p2.director.installIU.cmd" value="-installIU ${p2.director.installIU}" />
			</else>
		</if>

		<antcallback target="get.PACK200_JAVA_HOME" return="PACK200_JAVA_HOME" />

		<!-- find launcher jar: if eclipse unpacked from SDK zip, use that launcher; if not available, fall back to basebuilder's launcher -->
		<mkdir dir="${p2.director.destination}/plugins" />
		<for param="launcherjar">
			<path>
				<fileset dir="${relengBaseBuilderDir}/plugins" includes="org.eclipse.equinox.launcher_*.jar" />
				<fileset dir="${p2.director.destination}/plugins" includes="org.eclipse.equinox.launcher_*.jar" />
			</path>
			<sequential>
				<if>
					<available file="@{launcherjar}" type="file" />
					<then>
						<var name="p2.director.launcher.jar" value="@{launcherjar}" />
						<var name="p2.director.launcher.jar.dir" unset="true" />
						<dirname property="p2.director.launcher.jar.dir" file="@{launcherjar}" />
					</then>
				</if>
			</sequential>
		</for>

		<!-- collect all available pre-existing repos for on-disk reuse -->
		<var name="p2.director.metadataRepository" value="" />
		<var name="p2.director.artifactRepository" value="" />
		<!-- ${install}/eclipse,  -->
		<for param="sourcedir" list="${p2.director.destination}, ${relengBaseBuilderDir}, ${buildDirectory}" delimiter=", ">
			<sequential>
				<if>
					<and>
						<not>
							<contains string="${p2.director.input.repo.cleaned}"
							          substring="@{sourcedir}/p2/org.eclipse.equinox.p2.engine/profileRegistry/SDKProfile.profile"
							/>
						</not>
						<not>
							<contains string="${p2.director.metadataRepository}"
							          substring="@{sourcedir}/p2/org.eclipse.equinox.p2.engine/profileRegistry/SDKProfile.profile"
							/>
						</not>
						<available file="@{sourcedir}/p2/org.eclipse.equinox.p2.engine/profileRegistry/SDKProfile.profile" type="dir" />
					</and>
					<then>
						<var name="p2.director.metadataRepository"
						     value="${p2.director.metadataRepository},file:@{sourcedir}/p2/org.eclipse.equinox.p2.engine/profileRegistry/SDKProfile.profile"
						/>
					</then>
				</if>
				<if>
					<and>
						<not>
							<contains string="${p2.director.input.repo.cleaned}" substring="@{sourcedir}" />
						</not>
						<not>
							<contains string="${p2.director.artifactRepository}" substring="@{sourcedir}" />
						</not>
						<or>
							<available file="@{sourcedir}/artifacts.xml" type="dir" />
							<available file="@{sourcedir}/artifacts.jar" type="dir" />
						</or>
					</and>
					<then>
						<var name="p2.director.artifactRepository" value="${p2.director.artifactRepository},file:@{sourcedir}" />
					</then>
				</if>
			</sequential>
		</for>
		<!-- trim prefix "," -->
		<propertyregex property="p2.director.artifactRepository"
		               defaultvalue="${p2.director.artifactRepository}"
		               input="${p2.director.artifactRepository}"
		               regexp=",(.+)"
		               replace="\1"
		               override="true"
		/>
		<propertyregex property="p2.director.metadataRepository"
		               defaultvalue="${p2.director.metadataRepository}"
		               input="${p2.director.metadataRepository}"
		               regexp=",(.+)"
		               replace="\1"
		               override="true"
		/>

		<!-- 
	p2.director.application        = ${p2.director.application}
	p2.director.installIU.cmd      = ${p2.director.installIU.cmd}
	p2.director.launcher.jar       = ${p2.director.launcher.jar}
	p2.director.launcher.jar.dir   = ${p2.director.launcher.jar.dir}
	p2.director.metadataRepository = ${p2.director.metadataRepository}
	p2.director.artifactRepository = ${p2.director.artifactRepository}
-->
		<echo>
	p2.director.input.repo.cleaned = ${p2.director.input.repo.cleaned}
	p2.director.destination        = ${p2.director.destination} 

</echo>

		<java jar="${p2.director.launcher.jar}"
		      fork="true"
		      timeout="900000"
		      jvm="${PACK200_JAVA_HOME}/bin/java"
		      failonerror="true"
		      maxmemory="256m"
		      taskname="p2.dir"
		>
			<classpath>
				<fileset dir="${p2.director.launcher.jar.dir}" includes="org.eclipse.equinox.launcher_*.jar" />
				<pathelement location="${p2.director.launcher.jar.dir}" />
			</classpath>
			<arg line=" -application ${p2.director.application}" />
			<arg line=" -nosplash -consoleLog" />
			<arg line=" -flavor tooling -roaming -profile SDKProfile ${p2.director.installIU.cmd}" />
			<arg line=" -destination ${p2.director.destination} -bundlepool ${p2.director.bundlepool}" />
			<arg line=" -metadataRepository ${p2.director.input.repo.cleaned},${p2.director.metadataRepository}" />
			<arg line=" -artifactRepository ${p2.director.input.repo.cleaned},${p2.director.artifactRepository}" />
			<arg line=" -profileProperties org.eclipse.update.install.features=true" />
			<arg line=" ${p2.director.extraArgs}" />
			<arg line=" -vmargs -Declipse.p2.data.area=${p2.director.destination}/p2 -Declipse.p2.MD5Check=false" />
			<arg line=" ${p2.director.extraVmArgs}" />
		</java>

		<!-- cleanup temp dir -->
		<delete dir="${p2repoZipsTmp}" />

	</target>

	<target name="buildZips" depends="buildUpdate">
		<antcall target="buildMasterZip" />

		<antcall target="-timestamp" inheritall="false" />

		<property name="ziptmp" value="${buildDirectory}/ziptmp" />

		<!-- build SDK -->
		<zip destfile="${buildDirectory}/${buildLabel}/${SDKZip}" update="true">
			<zipfileset src="${buildDirectory}/${buildLabel}/${allZip}"
			            dirmode="775"
			            filemode="664"
			            excludes="**/*.pack.gz, **/pack.properties, **/features/*.jar, **/${domainNamespace}.*.all*, **/${domainNamespace}.*.all*/**"
			/>
		</zip>

		<!-- build runtime from SDK -->
		<zip destfile="${buildDirectory}/${buildLabel}/${zipPrefix}-runtime${incubation}-${buildAlias}.zip" update="true">
			<zipfileset src="${buildDirectory}/${buildLabel}/${SDKZip}"
			            dirmode="775"
			            filemode="664"
			            excludes="**/${domainNamespace}.*.examples*, **/${domainNamespace}.*.examples*/**, **/${domainNamespace}.*.sdk*, **/${domainNamespace}.*.sdk*/**, **/${domainNamespace}.*.all*, **/${domainNamespace}.*.all*/**, **/${domainNamespace}.*.doc*, **/${domainNamespace}.*.doc*/**, **/${domainNamespace}.*.source*, **/${domainNamespace}.*.source*/**, **/*src.zip"
			>
				<include name="**/${projNamespace}*" />
				<include name="**/${projNamespace}*/**" />
			</zipfileset>
			<zipfileset src="${buildDirectory}/${buildLabel}/${allZip}"
			            dirmode="775"
			            filemode="664"
			            id="rootfiles"
			            includes="**/eclipse/epl-v10.html, **/eclipse/notice.html"
			/>
		</zip>

		<!-- build examples from ALL zip -->
		<zip destfile="${buildDirectory}/${buildLabel}/${zipPrefix}-examples${incubation}-${buildAlias}.zip" update="true">
			<zipfileset src="${buildDirectory}/${buildLabel}/${allZip}" dirmode="775" filemode="664">
				<include name="**/${domainNamespace}.*.example*" />
				<include name="**/${domainNamespace}.*.example*/**" />
			</zipfileset>
			<zipfileset refid="rootfiles" />
		</zip>

		<!--
			to do other non-standard packaging (or to clean out third party stuff) 
			use buildExtra.xml#extraPackaging
		-->
		<antcall target="buildExtra.xml">
			<param name="theTarget" value="extraPackaging" />
			<param name="showWarning" value="true" />
		</antcall>

		<antcall target="processMasterZip" />
	</target>

	<target name="buildExtra.xml" description="call buildExtra.xml and run a specific target if it exists; fail silently if showWarning not true">
		<property name="theTarget" value="getDependencies" />
		<property name="showWarning" value="false" />
		<if>
			<available file="${relengBuilderDir}/buildExtra.xml" type="file" />
			<then>
				<var name="buildExtra.xml.file" unset="true" />
				<loadfile property="buildExtra.xml.file" srcFile="${relengBuilderDir}/buildExtra.xml" />
				<if>
					<contains string="${buildExtra.xml.file}" substring="target name=&quot;${theTarget}&quot;" />
					<then>
						<subant target="${theTarget}"
						        description="Run project's ${relengBuilderDir}/buildExtra.xml#${theTarget}"
						        antfile="buildExtra.xml"
						        buildpath="${relengBuilderDir}"
						        inheritAll="true"
						        failOnError="false"
						/>
						<var name="buildExtra.xml.file" unset="true" />
					</then>
					<else>
						<if>
							<equals arg1="${showWarning}" arg2="true" />
							<then>
								<echo>Note:
Found buildExtra.xml but no ${theTarget} task. Nothing to do!
</echo>
							</then>
						</if>
					</else>
				</if>
			</then>
		</if>
	</target>

	<target name="buildTests">
		<ant antfile="${relengCommonBuilderDir}/build.xml" target="main">
			<property name="component" value="builder/tests" />
		</ant>
	</target>

	<target name="create.label.properties" unless="label.properties.exists">
		<mkdir dir="${buildDirectory}" />
		<!--store the build label information in a file-->
		<echo file="${buildDirectory}/label.properties" append="true">buildType=${buildType}
</echo>
		<echo file="${buildDirectory}/label.properties" append="true">buildId=${buildId}
</echo>
		<echo file="${buildDirectory}/label.properties" append="true">timestamp=${timestamp}
</echo>
		<echo file="${buildDirectory}/label.properties" append="true">buildLabel=${buildLabel}
</echo>
		<echo file="${buildDirectory}/label.properties" append="true">buildAlias=${buildAlias}
</echo>
		<if>
			<isset property="forceContextQualifier" />
			<then>
				<echo file="${buildDirectory}/label.properties" append="true">forceContextQualifier=${forceContextQualifier}
</echo>
			</then>
		</if>
	</target>

	<target name="cleanup">
		<if>

			<!-- if noclean property is true, don't clean up.
				 or, if noclean file exists (tests failed), and noclean 
				 property is either not set or is true, don't clean up
			-->
			<or>
				<istrue value="${noclean}" />
				<and>
					<available file="${buildDir}/noclean" type="file" />
					<or>
						<not>
							<isset property="noclean" />
						</not>
						<istrue value="${noclean}" />
					</or>
				</and>
			</or>
			<then>
				<echo>The follow temporary files/folders should be deleted from your build:
	${buildDir}/*-AllFeaturesAndPlugins-*.zip*
	${buildDir}/*-Master-*.zip*
	${buildDir}/eclipse
	${buildDir}/testing</echo>
			</then>
			<else>
				<echo>Remove temp dirs in ${buildDir}</echo>
				<delete dir="${buildDir}/eclipse" followsymlinks="false" includeemptydirs="true" defaultexcludes="false" />
				<delete dir="${buildDir}/testing" followsymlinks="false" includeemptydirs="true" defaultexcludes="false" />
				<delete>
					<fileset dir="${buildDir}" includes="*-Master-*.zip*, *-AllFeaturesAndPlugins-*.zip*" />
				</delete>
			</else>
		</if>
	</target>

	<target name="test">
		<property name="test.xml" value="../org.eclipse.releng.basebuilder/plugins/org.eclipse.build.tools/scripts/test.xml" />
		<if>
			<or>
				<equals arg1="${baseos}" arg2="linux" />
				<equals arg1="${baseos}" arg2="macosx" />
			</or>
			<then>
				<antcall target="test-nix-local" />
			</then>
			<elseif>
				<contains string="${baseos}" substring="win" />
				<then>
					<echo>
** Sorry, running headless JUnit tests is not yet supported on Windows. See http://bugs.eclipse.org/268420 **
</echo>
					<!-- <antcall target="test-win-local" /> -->
				</then>
			</elseif>
			<else>
				<echo>
** Sorry, running headless JUnit tests is not yet supported on your platform, ${baseos}.${basews}. See http://bugs.eclipse.org/268420
</echo>
			</else>
		</if>
	</target>

	<target name="test-nix-local">
		<if>
			<equals arg1="${baseos}" arg2="macosx" />
			<then>
				<echo>
** Sorry, running headless JUnit tests is not yet supported on Mac OS X. See http://bugs.eclipse.org/268420 **
</echo>
			</then>
			<else>
				<ant antfile="${test.xml}">
					<property name="shell" value="runtests.sh" />
					<property name="tester" value="${basedir}/builder/tests" />
				</ant>
			</else>
		</if>
	</target>

	<target name="test-win-local">
		<ant antfile="${test.xml}">
			<property name="shell" value="runtests.cmd" />
			<property name="tester" value="${basedir}/builder/tests" />
		</ant>
	</target>

	<target name="publish">
		<echo message="Copy static files to build root folder" />
		<copy todir="${buildDirectory}/${buildLabel}" overwrite="true">
			<fileset dir="${relengCommonBuilderDir}/staticDropFiles" />
		</copy>

		<echo message="Move generated zips to build root folder" />
		<move todir="${buildDirectory}/.." failonerror="false" overwrite="true">
			<fileset dir="${buildDirectory}/${buildLabel}" />
		</move>

		<!-- generate a log of any compiler problems, warnings, errors, or failures -->
		<echo>Generate compilelogs/summary.txt</echo>
		<if>
			<available file="${buildDir}/compilelogs" type="dir" />
			<then>
				<exec executable="bash" output="${buildDir}/compilelogs/summary.txt">
					<arg line="${relengCommonScriptsDir}/getCompilerResults.sh ${buildDir}/compilelogs" />
				</exec>
			</then>
		</if>

		<!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=266374#c4: create index files for subdirs -->
		<for param="dir" list="testresults, compilelogs" delimiter=", ">
			<sequential>
				<if>
					<available file="${buildDir}/@{dir}" type="dir" />
					<then>
						<for param="subdir">
							<path>
								<dirset dir="${buildDir}/@{dir}" />
							</path>
							<sequential>
								<copy file="${buildDir}/index.php" todir="@{subdir}" />
							</sequential>
						</for>
					</then>
				</if>
			</sequential>
		</for>
	</target>

	<target name="generateDigests">
		<!-- Ant 1.7.x required for format="MD5SUM" -->
		<for param="zip">
			<path>
				<fileset dir="${buildDirectory}/${buildLabel}">
					<include name="*.zip" />
				</fileset>
			</path>
			<sequential>
				<checksum file="@{zip}" format="MD5SUM" fileext=".md5" />
			</sequential>
		</for>
	</target>

	<!--
		given a list of platforms & dependencies, assemble one or more all in ones
		by copying the eclipse zip/tar.gz, then adding deps + SDK into it
	-->
	<target name="packAllInOnes" depends="init" description="create one or more all-in-one archives">
		<antcall target="-timestamp" inheritAll="false" />
		<!-- defaults, if not set in buildAll.xml -->
		<if>
			<not>
				<isset property="allInOnePrefix" />
			</not>
			<then>
				<property name="allInOnePrefix" value="${projectName}-all-in-one" />
			</then>
		</if>
		<if>
			<not>
				<isset property="allInOnePlatforms" />
			</not>
			<then>
				<property name="allInOnePlatforms" value="linux-gtk,win32,macosx-carbon" />
			</then>
		</if>
		<if>
			<not>
				<isset property="allInOneEclipseBase" />
			</not>
			<then>
				<property name="allInOneEclipseBase" value="SDK" />
			</then>
		</if>
		<if>
			<not>
				<isset property="allInOneInputs" />
			</not>
			<then>
				<property name="allInOneInputs" value="${allZip}" />
			</then>
		</if>
		<if>
			<not>
				<isset property="allInOneInputExtras" />
			</not>
			<then>
				<property name="allInOneInputExtras" value="" />
			</then>
		</if>
		<if>
			<not>
				<isset property="allInOneBuildTypes" />
			</not>
			<then>
				<property name="allInOneBuildTypes" value="S,R" />
			</then>
		</if>

		<if>
			<not>
				<isset property="incubation" />
			</not>
			<then>
				<property name="incubation" value="" />
			</then>
		</if>

		<for param="allInOneBuildType" list="${allInOneBuildTypes}">
			<sequential>
				<if>
					<equals arg1="${buildType}" arg2="@{allInOneBuildType}" />
					<then>
						<echo message="Generating type ${buildType} All-In-One archive(s) ..." />
						<var name="allInOneArchiveTmp" value="${buildDirectory}/${buildLabel}/allInOneArchiveTmp" />

						<!-- for all the platform suffixes to build... -->
						<for param="platformSuffix" list="${allInOnePlatforms}">
							<sequential>
								<if>
									<equals arg1="@{platformSuffix}" arg2="win32" />
									<then>
										<var name="allInOneArchiveSuffix" value=".zip" />
									</then>
									<else>
										<var name="allInOneArchiveSuffix" value=".tar" />
									</else>
								</if>
								<if>
									<equals arg1="@{platformSuffix}" arg2="win32" />
									<then>
										<var name="eclipseSuffix" value=".zip" />
									</then>
									<else>
										<var name="eclipseSuffix" value=".tar.gz" />
									</else>
								</if>
								<var name="allInOneArchive"
								     value="${allInOnePrefix}-@{platformSuffix}${incubation}-${buildAlias}${allInOneArchiveSuffix}"
								/>
								<var name="allInOneArchivePath" value="${buildDirectory}/${buildLabel}/${allInOneArchive}" />

								<!-- get the Eclipse bundle if not already downloaded: only need linux-gtk to build, but need others to package up all-in-ones -->
								<!-- <echo message="orig eclipse.base.file = ${eclipse.base.file}" /> -->
								<propertyregex property="thisEclipseFile"
								               input="${eclipse.base.file}"
								               regexp="(eclipse-)(SDK-)(.+)(-linux-gtk\.tar\.gz)"
								               replace="\1${allInOneEclipseBase}-\3-@{platformSuffix}${eclipseSuffix}"
								               casesensitive="false"
								/>
								<!-- <echo message="this eclipse.base.file = ${thisEclipseFile}" /> -->
								<if>
									<not>
										<available file="${downloadsDir}/${thisEclipseFile}" type="file" />
									</not>
									<then>
										<!-- <echo message="orig eclipse.base.url = ${eclipse.base.url}" /> -->
										<propertyregex property="thisEclipseURL"
										               input="${eclipse.base.url}"
										               regexp="(.+eclipse-)(SDK-)(.+)(-linux-gtk\.tar\.gz)"
										               replace="\1${allInOneEclipseBase}-\3-@{platformSuffix}${eclipseSuffix}"
										               casesensitive="false"
										/>
										<!-- <echo message="this eclipse.base.url = ${thisEclipseURL}" /> -->
										<antcall target="-timestamp" inheritAll="false" />
										<get src="${thisEclipseURL}" dest="${downloadsDir}/${thisEclipseFile}" usetimestamp="true" />
										<touch file="${downloadsDir}/${thisEclipseFile}" />
									</then>
								</if>

								<antcall target="-timestamp" inheritAll="false" />

								<!-- unpack project's SDK and/or ALL zip  -->
								<for param="allInOneInput" list="${allInOneInputs}">
									<sequential>
										<antcall target="-timestamp" inheritAll="false" />
										<!-- <echo message="Add @{allInOneInput} into ${allInOneArchiveTmp} ..." /> -->
										<unzip src="${buildDirectory}/${buildLabel}/@{allInOneInput}" dest="${allInOneArchiveTmp}/eclipse/dropins/" />
									</sequential>
								</for>
								<!-- unpack each dep -->
								<for param="dependency.file" list="${required.dependency.files}">
									<sequential>
										<antcall target="-timestamp" inheritAll="false" />
										<!-- <echo message="Add @{dependency.file} into ${allInOneArchiveTmp} ..." /> -->
										<unzip src="${downloadsDir}/@{dependency.file}" dest="${allInOneArchiveTmp}/eclipse/dropins/" />
									</sequential>
								</for>
								<!-- unpack extra deps (if any) -->
								<for param="extra.dependency.file" list="${allInOneInputExtras}">
									<sequential>
										<antcall target="-timestamp" inheritAll="false" />
										<!-- <echo message="Add @{extra.dependency.file} into ${allInOneArchiveTmp} ..." /> -->
										<unzip src="${downloadsDir}/@{extra.dependency.file}" dest="${allInOneArchiveTmp}/eclipse/dropins/" />
									</sequential>
								</for>

								<antcall target="-timestamp" inheritAll="false" />
								<!-- <echo message="Create ${allInOneArchive} from ${thisEclipseFile} ..." /> -->
								<if>
									<equals arg1="@{platformSuffix}" arg2="win32" />
									<then>
										<!-- copy & rename the Eclipse SDK -->
										<copy file="${downloadsDir}/${thisEclipseFile}" tofile="${allInOneArchivePath}" />

										<!-- add deps + project files -->
										<zip destfile="${allInOneArchivePath}" update="true">
											<fileset dir="${allInOneArchiveTmp}" />
										</zip>
									</then>
									<else>
										<!-- copy & rename the Eclipse SDK -->
										<gunzip src="${downloadsDir}/${thisEclipseFile}" dest="${allInOneArchivePath}" />
										<exec executable="/bin/tar" dir="${allInOneArchiveTmp}" failonerror="true">
											<arg line="upf ${allInOneArchivePath} eclipse" />
										</exec>
										<gzip src="${allInOneArchivePath}" destfile="${allInOneArchivePath}.gz" />
										<delete file="${allInOneArchivePath}" />
									</else>
								</if>
								<var name="thisEclipseFile" unset="true" />
								<var name="thisEclipseURL" unset="true" />
							</sequential>
						</for>
						<antcall target="-timestamp" inheritAll="false" />
						<delete dir="${allInOneArchiveTmp}" includeemptydirs="true" quiet="true" failonerror="false" />
					</then>
				</if>
			</sequential>
		</for>
	</target>

	<!-- DEBUG:  
		 To test this script locally to see what output it will generate (particularly re: URL parsing) in build.cfg, 
		 set "localtest" = "true" in "genBuildCfgInit" target, then run the "genBuildCfg" target and watch console output
	-->
	<target name="genBuildCfgInit" depends="init">
		<!--
			INPUTS:

			for overall start.sh / buildAll.xml

			+ cvs/svn details for .releng project
								(must be set, but can be a local dir rather than VCS path)
			+ projectid			(must be set, eg., modeling.emf.cdo or tools.gef)
			buildTimestamp 		(opt, will generate)
			buildType 			(opt, def N)
			buildAlias 			(opt, for specially-named milestones & RC builds, eg., "1.0.0M7")
			writableBuildRoot   (eg., ${WORKSPACE} for Hudson builds, or if non-standard value used)
			version 			(if not set in build.properties)
			basebuilderBranch 	(if not set in build.properties)
			javaHome 			(if not set in build.properties)
			downloadsDir 		(if not set in build.properties)

			for buildAllHelper.xml#genBuildCfg, only need three values

			projectid
			relengBuilderDir (OR buildDir)
			dependencyURLs (comma-separated list of required dependencies, if not set in project's build.properties)
		-->

		<property name="localtest" value="false" />
		<if>
			<istrue value="${localtest}" />
			<then>
				<property name="debug" value="true" />
				<property name="downloadZipsIfNotFound" value="false" />
			</then>
			<else>
				<property name="debug" value="false" />
				<property name="downloadZipsIfNotFound" value="true" />
			</else>
		</if>

		<!-- MUST BE SET COMMANDLINE if not already defined in project's releng/build.properties
			-Dprojectid=top.proj.sub (modeling.emf.cdo) or proj.sub (tools.myproject) -->
		<property name="projectid" value="tools.myproject" />
		<antcallback target="projectid2names" return="topprojectName, projectName, subprojectName" />

		<if>
			<not>
				<isset property="buildTimestamp" />
			</not>
			<then>
				<if>
					<isset property="buildDir" />
					<then>
						<!-- generate buildTimestamp as last folder in buildDir's path -->
						<propertyregex property="buildTimestamp"
						               defaultvalue="NONE"
						               input="${buildDir}"
						               casesensitive=""
						               regexp="(.+)/([NIMSR])([^/]+)"
						               replace="\3"
						               override="true"
						/>
						<if>
							<equals arg1="${buildTimestamp}" arg2="NONE" />
							<then>
								<var name="buildTimestamp" unset="true" />
								<tstamp>
									<format property="buildTimestamp" pattern="yyyyMMddHHmm" />
								</tstamp>
								<echo>Ant generated: buildTimestamp=${buildTimestamp}</echo>
							</then>
						</if>
					</then>
					<else>
						<tstamp>
							<format property="buildTimestamp" pattern="yyyyMMddHHmm" />
						</tstamp>
						<echo>Ant generated: buildTimestamp=${buildTimestamp}</echo>
					</else>
				</if>
			</then>
		</if>

		<if>
			<not>
				<isset property="buildType" />
			</not>
			<then>
				<if>
					<isset property="buildDir" />
					<then>
						<!-- generate buildType as first letter of last folder in buildDir's path -->
						<propertyregex property="buildType"
						               defaultvalue="${buildDir}"
						               input="${buildDir}"
						               casesensitive=""
						               regexp="(.+)/([NIMSR])([^/]+)"
						               replace="\2"
						               override="true"
						/>
					</then>
					<else>
						<property name="buildType" value="N" />
					</else>
				</if>
			</then>
		</if>

		<if>
			<not>
				<isset property="buildDir" />
			</not>
			<then>
				<if>
					<isset property="relengBuilderDir" />
					<then>
						<!-- generate buildDir as relengBuilderDir's parent -->
						<propertyregex property="buildDir"
						               defaultvalue="${relengBuilderDir}"
						               input="${relengBuilderDir}"
						               casesensitive=""
						               regexp="(.+)/([^/]+)"
						               replace="\1"
						               override="true"
						/>
					</then>
					<else>
						<!-- convert projectid to path -->
						<propertyregex property="projectPath"
						               defaultValue="${projectid}"
						               input="${projectid}"
						               casesensitive="false"
						               regexp="\."
						               replace="/"
						               override="true"
						/>
						<property name="buildDir"
						          value="${writableBuildRoot}/${projectPath}/downloads/drops/${version}/${buildType}${buildTimestamp}"
						/>
					</else>
				</if>
			</then>
		</if>
		<mkdir dir="${buildDir}" />

		<!-- CAN BE SET COMMANDLINE: -Dbuildcfg=/path/to/build.cfg -->
		<if>
			<not>
				<isset property="buildcfg" />
			</not>
			<then>
				<if>
					<isset property="buildDir" />
					<then>
						<property name="buildcfg" value="${buildDir}/build.cfg" />
					</then>
					<else>
						<property name="buildcfg" value="${basedir}/build.cfg" />
					</else>
				</if>
			</then>
		</if>

		<!-- start with a clean file every time -->
		<if>
			<available file="${buildcfg}" type="file" />
			<then>
				<delete file="${buildcfg}" />
			</then>
		</if>

	</target>

	<!-- DEBUG:  
		 To test this script locally to see what output it will generate (particularly re: URL parsing) in build.cfg, 
		 set "localtest" = "true" in "genBuildCfgInit" target, then run the "genBuildCfg" target and watch console output
	-->
	<target name="genBuildCfg" depends="genBuildCfgInit" description="Create build.cfg file">

		<antcallback target="createBuildConfigFile" return="buildcfg" />
		<echo>Created ${buildcfg}</echo>
		<property file="${buildcfg}" />
		<mkdir dir="${downloadsDir}" />
		<mkdir dir="${buildDir}" />

		<if>
			<isfalse value="${localtest}" />
			<then>
				<!-- determine the type of maps used in the build -->
				<antcallback target="collectMapTypes" return="mapTypes" />
				<echo>Found these map entry types: ${mapTypes}</echo>
			</then>
		</if>

		<!-- generate URL-related properties -->
		<antcallback target="collectURLs" return="numURLs" />
		<echo>Found ${numURLs} dependency URLs</echo>

	</target>

	<target name="createBuildConfigFile">

		<!-- dump all commandline vars set above as they should override anything set in .properties files below: see also buildAll.xml#runEclipse -->
		<antcallback return="commandlineArgsList" target="initCommandlineArgsList" />
		<echo file="${buildcfg}" append="true">
# Commandline variables override default values set below

# Note that this file is meant to be read by Ant, not shell,
# so only the first assignment of a variable will stick
# If parsing this file, make sure to stop after the first
# variable is found.

</echo>
		<for param="clv" list="${commandlineArgsList}" delimiter=", 
			">
			<sequential>
				<if>
					<isset property="@{clv}" />
					<then>
						<echo file="${buildcfg}" append="true">@{clv}=${@{clv}}
</echo>
					</then>
				</if>
			</sequential>
		</for>

		<if>
			<isset property="localSourceCheckoutDir" />
			<then>
				<echo file="${buildcfg}" append="true">

# build from local source instead of VCS repo?
skipFetch=true
localSourceCheckoutDir=${localSourceCheckoutDir}
</echo>
				<property name="forceContextQualifier" value="v${buildTimestamp}" />
			</then>
		</if>

		<if>
			<isset property="forceContextQualifier" />
			<then>
				<echo file="${buildcfg}" append="true">
forceContextQualifier=${forceContextQualifier}
</echo>
			</then>
		</if>

		<if>
			<or>
				<not>
					<isset property="packageFeaturesIncludedBinaries" />
				</not>
				<istrue value="${packageFeaturesIncludedBinaries}" />
			</or>
			<then>
				<echo file="${buildcfg}" append="true">
runPackager=true
</echo>
			</then>
		</if>

		<if>
			<isset property="fetchTag" />
			<then>
				<echo file="${buildcfg}" append="true">
fetchTag=${fetchTag}
</echo>
			</then>
		</if>

		<!-- linux + windows, want parent of .../jre or ...\jre
			 mac, just use ${java.home}
		-->
		<propertyregex property="JAVA_HOME_PARENT"
		               defaultvalue="${java.home}"
		               input="${java.home}"
		               casesensitive="false"
		               regexp="(.+)([^/\\]+)(/|\\)jre"
		               replace="\1\2"
		               override="true"
		/>

		<echo file="${buildcfg}" append="true">

# Environment variables
HOME=${user.home}
JAVA_HOME=${JAVA_HOME_PARENT}
java.home=${JAVA_HOME}
ANT_HOME=${ant.home}
ANT=${ant.home}/bin/ant

#Platform details
</echo>

		<!-- TODO: is this redundant to what's in buildAll.xml? -->

		<!-- os name -->
		<if>
			<equals arg1="${os.name}" arg2="linux" casesensitive="false" />
			<then>
				<echo file="${buildcfg}" append="true">baseos=linux
</echo>
			</then>
			<elseif>
				<and>
					<contains string="${os.name}" substring="64" casesensitive="false" />
					<contains string="${os.name}" substring="win" casesensitive="false" />
				</and>
				<then>
					<echo file="${buildcfg}" append="true">baseos=win64
</echo>
				</then>
			</elseif>
			<elseif>
				<contains string="${os.name}" substring="win" casesensitive="false" />
				<then>
					<echo file="${buildcfg}" append="true">baseos=win32
</echo>
				</then>
			</elseif>
			<elseif>
				<contains string="${os.name}" substring="mac" casesensitive="false" />
				<then>
					<echo file="${buildcfg}" append="true">baseos=macosx
</echo>
				</then>
			</elseif>
			<else>
				<echo file="${buildcfg}" append="true">baseos=${os.name}
</echo>
			</else>
		</if>

		<!-- architecture -->
		<if>
			<or>
				<equals arg1="${os.arch}" arg2="i386" />
				<equals arg1="${os.arch}" arg2="i486" />
				<equals arg1="${os.arch}" arg2="i586" />
				<equals arg1="${os.arch}" arg2="i686" />
			</or>
			<then>
				<echo file="${buildcfg}" append="true">basearch=x86
</echo>
			</then>
			<elseif>
				<equals arg1="${os.arch}" arg2="amd64" />
				<then>
					<echo file="${buildcfg}" append="true">basearch=x86_64
</echo>
				</then>
			</elseif>
			<elseif>
				<equals arg1="${os.arch}" arg2="ppc64" />
				<then>
					<echo file="${buildcfg}" append="true">basearch=ppc64
</echo>
				</then>
			</elseif>
			<else>
				<echo file="${buildcfg}" append="true">basearch=${os.arch}
</echo>
			</else>
		</if>

		<!-- window system -->
		<if>
			<equals arg1="${os.name}" arg2="linux" casesensitive="false" />
			<then>
				<echo file="${buildcfg}" append="true">basews=gtk
</echo>
			</then>
			<elseif>
				<and>
					<contains string="${os.name}" substring="64" casesensitive="false" />
					<contains string="${os.name}" substring="win" casesensitive="false" />
				</and>
				<then>
					<echo file="${buildcfg}" append="true">basews=win64
</echo>
				</then>
			</elseif>
			<elseif>
				<contains string="${os.name}" substring="win" casesensitive="false" />
				<then>
					<echo file="${buildcfg}" append="true">basews=win32
</echo>
				</then>
			</elseif>
			<elseif>
				<contains string="${os.name}" substring="mac" casesensitive="false" />
				<then>
					<!-- should this be carbon? -->
					<echo file="${buildcfg}" append="true">basews=cocoa
</echo>
				</then>
			</elseif>
		</if>

		<!-- merge other properties files into build.cfg so in order of override priority, and expand variables -->
		<if>
			<isfalse value="${localtest}" />
			<then>

				<loadfile property="builder.build.properties.file" srcFile="${relengBuilderDir}/build.properties">
					<filterchain>
						<expandproperties />
					</filterchain>
				</loadfile>
				<property file="${relengBuilderDir}/build.properties" />
				<loadfile property="common.build.properties.file" srcFile="${relengCommonBuilderDir}/build.properties">
					<filterchain>
						<expandproperties />
					</filterchain>
				</loadfile>
				<property file="${relengCommonBuilderDir}/build.properties" />
				<loadfile property="server.properties.file" srcFile="${relengCommonBuilderDir}/server.properties">
					<filterchain>
						<expandproperties />
					</filterchain>
				</loadfile>
				<property file="${relengCommonBuilderDir}/server.properties" />
			</then>
		</if>
		<echo file="${buildcfg}" append="true">

## Load ${relengBuilderDir}/build.properties ##
${builder.build.properties.file}

## Load ${relengCommonBuilderDir}/build.properties ##
${common.build.properties.file}

## Load ${relengCommonBuilderDir}/server.properties ##
${server.properties.file}

</echo>

		<echo file="${buildcfg}" append="true">
# yet more path variables
baseLocation=${buildDir}/eclipse
testBase=${buildDir}/testing

# label.properties variables
buildId=${buildType}${buildTimestamp}
buildID=${buildType}${buildTimestamp}
timestamp=${buildTimestamp}
buildDateStamp=${buildTimestamp}
buildLabel=${buildType}${buildTimestamp}
</echo>

		<if>
			<isset property="buildAlias" />
			<then>
				<echo file="${buildcfg}" append="true">buildAlias=${buildAlias}</echo>
			</then>
			<else>
				<echo file="${buildcfg}" append="true">buildAlias=${buildType}${buildTimestamp}</echo>
			</else>
		</if>
	</target>

	<target name="collectURLs">
		<!-- TODO: allow override for projects that use Google Analytics to track downloads; eg., /modeling/download.php?file= -->
		<echo file="${buildcfg}" append="true">

#Base download URL
eclipse.download.url=http://www.eclipse.org/downloads/download.php?file=

</echo>

		<var name="requirement.type" value="" />
		<var name="requirement.dropfile" value="" />
		<var name="required.dependency.files" value="" />

		<if>
			<istrue value="${localtest}" />
			<then>
				<!-- some sample URLs for testing; real build must pass in actual values as one long space separated string -->

				<property name="dependencyURLs"
				          value="
					http://ftp.osuosl.org/pub/eclipse/eclipse/downloads/drops/R-3.5.1-200909170800/eclipse-RCP-3.5.1-win32.zip
					http://www.eclipse.org/downloads/download.php?r=1&amp;file=/eclipse/downloads/drops/R-3.5-200906111540/eclipse-SDK-3.5-linux-gtk.tar.gz
				"
				/>
				<property name="dependencyURLs"
				          value="
					---------,
				http://www.eclipse.org/downloads/download.php?r=1&amp;file=/eclipse/downloads/drops/R-3.5-200906111540/eclipse-SDK-3.5-linux-gtk.tar.gz
					---------,
				http://anonsvn.jboss.org/repos/repository.jboss.org/eclipse/galileo/emf-runtime-2.5.0RC2.zip,
				http://anonsvn.jboss.org/repos/repository.jboss.org/eclipse/galileo/xsd-runtime-2.5.0RC2.zip,
				http://anonsvn.jboss.org/repos/repository.jboss.org/eclipse/galileo/wtp-S-3.1RC2-20090526075706.zip,
				http://anonsvn.jboss.org/repos/repository.jboss.org/eclipse/galileo/eclipse-SDK-3.5RC3-linux-gtk.tar.gz,
					---------,
				http://repository.jboss.org/eclipse/galileo/eclipse-SDK-3.5-linux-gtk.tar.gz,
				http://repository.jboss.org/eclipse/galileo/GEF-runtime-3.5.0.zip,
					---------,
				ftp://ftp.ussg.iu.edu/pub/eclipse/eclipse/downloads/drops/S-3.5M7-200904302300/eclipse-SDK-3.5M7-linux-gtk.tar.gz,
				http://download.eclipse.org/eclipse/downloads/drops/R-3.4.1-200809111700/eclipse-SDK-3.4.1-linux-gtk.tar.gz,
					---------,
				http://ftp.ussg.iu.edu/eclipse/modeling/emf/emf/downloads/drops/2.5.0/S200905041408/emf-runtime-2.5.0M7.zip,
				http://download.eclipse.org/modeling/emf/emf/downloads/drops/2.4.1/R200808251517/emf-runtime-2.4.1.zip,
					---------,
				http://ftp.ussg.iu.edu/eclipse/modeling/emf/emf/downloads/drops/2.5.0/S200905041408/xsd-runtime-2.5.0M7.zip,
				http://download.eclipse.org/modeling/emf/emf/downloads/drops/2.4.1/R200808251517/xsd-runtime-2.4.1.zip,
					---------,
				http://ftp.ussg.iu.edu/eclipse/tools/gef/downloads/drops/3.5.0/S200905011522/GEF-SDK-3.5.0M7.zip,
				http://download.eclipse.org/tools/gef/downloads/drops/3.4.1/R200809101400/GEF-SDK-3.4.1.zip,
					---------,
				http://ftp.ussg.iu.edu/eclipse/webtools/downloads/drops/R3.1/S-3.1M7-20090505073946/wtp-wst-sdk-S-3.1M7-20090505073946.zip,
				http://download.eclipse.org/webtools/downloads/drops/R3.0/R-3.0.3-20081113203138/wtp-wst-sdk-R-3.0.3-20081113203138.zip,
					---------,
				http://www.eclipse.org/downloads/download.php?r=1&amp;file=/eclipse/downloads/drops/S-3.5M7-200904302300/eclipse-SDK-3.5M7-linux-gtk.tar.gz,
					---------,
				http://download.eclipse.org/eclipse/downloads/drops/R-3.4-200806172000/eclipse-SDK-3.4.1-linux-gtk-ppc.tar.gz,
				http://download.eclipse.org/eclipse/downloads/drops/R-3.4.1-200809111700/eclipse-SDK-3.4.1-linux-gtk.tar.gz,
				http://download.eclipse.org/eclipse/downloads/drops/R-3.4.2-200902111700/eclipse-platform-3.4.2-win32.zip,
				http://download.eclipse.org/eclipse/downloads/drops/R-3.4.2-200902111700/swt-3.4.2-win32-win32-x86.zip,
					---------,
				http://www.eclipse.org/modeling/download.php?file=/modeling/emf/emf/downloads/drops/2.5.0/S200902031500/emf-xsd-SDK-2.5.0M5.zip,
				http://download.eclipse.org/modeling/emf/emf/downloads/drops/2.4.0/R200806091234/emf-sdo-xsd-Examples-2.4.0.zip,
				http://download.eclipse.org/modeling/emf/emf/downloads/drops/2.4.1/R200808251517/emf-runtime-2.4.1.zip,
				http://download.eclipse.org/modeling/emf/emf/downloads/drops/2.4.1/R200808251517/xsd-runtime-2.4.1.zip,
					---------,
				http://download.eclipse.org/tools/gef/downloads/drops/3.4.1/R200809101400/GEF-runtime-3.4.1.zip,
					---------,
				http://download.eclipse.org/modeling/mdt/uml2/downloads/drops/2.2.0/R200806091546/mdt-uml2-SDK-2.2.0.zip,
				http://download.eclipse.org/modeling/mdt/ocl/downloads/drops/1.2.0/R200806091714/mdt-ocl-SDK-1.2.0.zip,
				http://download.eclipse.org/modeling/emf/validation/downloads/drops/1.2.0/R200806091804/emf-validation-SDK-1.2.0.zip,
					---------,
				http://download.eclipse.org/webtools/downloads/drops/R3.0/R-3.0.3-20081113203138/wtp-wst-R-3.0.3-20081113203138.zip,
				http://download.eclipse.org/webtools/downloads/drops/R3.0/R-3.0.4-20090213193639/wtp-jst-R-3.0.4-20090213193639.zip,
				http://download.eclipse.org/webtools/downloads/drops/R3.0/R-3.0.4-20090213193639/wtp-jst-Automated-Tests-R-3.0.4-20090213193639.zip,
					---------,
				http://download.eclipse.org/technology/dltk/downloads/drops/R1.0/S-1.0M4-200812290249/dltk-rse-S-1.0M4-200812290249-incubation.zip,
				http://download.eclipse.org/technology/dltk/downloads/drops/R1.0/S-1.0M4-200812290249/dltk-core-S-1.0M4-200812290249-incubation.zip,
					---------,
				http://download.eclipse.org/tools/orbit/downloads/drops/R20080611105805/orbitBundles-R20080611105805.map,
				http://download.eclipse.org/tools/cdt/releases/ganymede/dist/cdt-master-5.0.0.zip,
					---------,
				http://download.eclipse.org/eclipse/downloads/drops/R-3.4-200806172000/eclipse-SDK-3.4.1-linux-gtk-ppc.tar.gz,
				http://download.eclipse.org/tools/cdt/releases/ganymede/dist/cdt-master-5.0.0.zip,
					---------,
				http://download.eclipse.org/eclipse/downloads/drops/S-3.5M5-200902021535/eclipse-SDK-3.5M5-linux-gtk-ppc.tar.gz
				http://download.eclipse.org/tools/cdt/builds/6.0.0/I.I200902031437/cdt-master-6.0.0-I200902031437.zip,
				http://download.eclipse.org/birt/downloads/drops/M-R1-2.5M5-200902101827/birt-report-framework-2.5M5.zip,
				http://download.eclipse.org/modeling/emf/emf/downloads/drops/2.5.0/S200902031500/emf-runtime-2.5.0M5.zip,
				"
				/>
			</then>

			<elseif>
				<not>
					<!-- commandline -->
					<isset property="dependencyURLs" />
				</not>
				<then>
					<!-- load defined values in project's build.properties -->
					<property file="${relengBuilderDir}/build.properties" />
				</then>
			</elseif>
		</if>

		<var name="numURLs" value="0" />
		<property name="dependencyURLs" value="" />
		<for param="URL" list="${dependencyURLs}" delimiter=", ">
			<!-- check each URL to determine what type of req it is, and collect variables -->
			<sequential>
				<if>
					<istrue value="${localtest}" />
					<then>
						<echo>@{URL}</echo>
					</then>
				</if>
				<if>
					<not>
						<equals arg1="@{URL}" arg2="---------" />
					</not>
					<then>

						<!-- trim off everything before ?file=/ and hostname -->
						<propertyregex property="requirement.dropfile"
						               defaultvalue="@{URL}"
						               input="@{URL}"
						               casesensitive="false"
						               regexp="((.+\?file=/|.+\&amp;file=/|.+\&amp;amp;file=/|.+/pub/)|(.+://[^/]+/))(.+)"
						               replace="\4"
						               override="true"
						/>
						<!-- remove downloads/drops/version/buildID & file suffix, -->
						<propertyregex property="requirement.type.tmp"
						               defaultvalue="${requirement.dropfile}"
						               input="${requirement.dropfile}"
						               casesensitive="true"
						               regexp="(.+)(/downloads/drops/.+/|/releases/.+/|/builds/.+/)([^/]+)"
						               select="\1-\3"
						               override="true"
						/>

						<!-- <echo>0 ${requirement.type.tmp}</echo> -->
						<!-- extra cleanup for WTP, DLTK, CDT -->
						<propertyregex property="requirement.type.tmp"
						               defaultvalue="${requirement.type.tmp}"
						               input="${requirement.type.tmp}"
						               casesensitive="true"
						               regexp="(.+)-([\d\.NIMSR-]+).+"
						               select="\1"
						               override="true"
						/>
						<!-- <echo>1 ${requirement.type.tmp}</echo> -->
						<if>
							<or>
								<contains string="${requirement.type.tmp}" substring="-RCP" casesensitive="false" />
								<contains string="${requirement.type.tmp}" substring="-platform" casesensitive="false" />
								<contains string="${requirement.type.tmp}" substring="-SDK" casesensitive="false" />
							</or>
							<then>
								<var name="requirement.type.suffix" value=".base" />
							</then>
						</if>

						<propertyregex property="requirement.type.tmp"
						               defaultvalue="${requirement.type.tmp}"
						               input="${requirement.type.tmp}"
						               casesensitive="true"
						               regexp="(.+)-([\d\.NIMSR-]+)"
						               select="\1"
						               override="true"
						/>
						<!-- <echo>2 ${requirement.type.tmp}</echo> -->
						<propertyregex property="requirement.type.tmp"
						               defaultvalue="${requirement.type.tmp}"
						               input="${requirement.type.tmp}"
						               casesensitive="true"
						               regexp="(.+)-([\d\.NIMSR]+)"
						               select="\1"
						               override="true"
						/>
						<!-- <echo>3 ${requirement.type.tmp}</echo> -->
						<!-- switch / and - to . -->
						<propertyregex property="requirement.type.tmp"
						               defaultvalue="${requirement.type.tmp}"
						               input="${requirement.type.tmp}"
						               casesensitive="false"
						               regexp="[/-]+"
						               replace="\."
						               override="true"
						/>
						<!-- <echo>4 ${requirement.type.tmp}</echo> -->
						<!-- trim prefix "repos.repository.jboss.org.eclipse.galileo." -->
						<propertyregex property="requirement.type.tmp"
						               defaultvalue="${requirement.type.tmp}"
						               input="${requirement.type.tmp}"
						               casesensitive=""
						               regexp="(repos\.repository\.jboss\.org\.eclipse\.galileo|eclipse\.galileo)\.(.+)"
						               replace="\2"
						               override="true"
						/>
						<!-- <echo>5 ${requirement.type.tmp}</echo> -->
						<!-- trim prefix "eclipse." -->
						<propertyregex property="requirement.type.tmp"
						               defaultvalue="${requirement.type.tmp}"
						               input="${requirement.type.tmp}"
						               casesensitive=""
						               regexp="eclipse\.(.+)"
						               replace="\1"
						               override="true"
						/>
						<!-- dedupe: eclipse.eclipse.SDK ==> eclipse.SDK; modeling.emf.emf.emf.xsd.SDK ==> modeling.emf.xsd.SDK -->
						<var name="requirement.type" value="" />
						<for param="bit" list="${requirement.type.tmp}" delimiter=".">
							<sequential>
								<if>
									<not>
										<contains string="${requirement.type}" substring="@{bit}" casesensitive="false" />
									</not>
									<then>
										<var name="requirement.type" value="${requirement.type}.@{bit}" />
									</then>
								</if>
							</sequential>
						</for>
						<!-- trim prefix "." -->
						<propertyregex property="requirement.type"
						               defaultvalue="${requirement.type}"
						               input="${requirement.type}"
						               casesensitive=""
						               regexp="\.(.+)"
						               replace="\1"
						               override="true"
						/>
						<!-- add suffix -->
						<if>
							<isset property="requirement.type.suffix" />
							<then>
								<propertyregex property="requirement.type"
								               defaultvalue="${requirement.type}"
								               input="${requirement.type}"
								               casesensitive=""
								               regexp="(.+)"
								               replace="\1${requirement.type.suffix}"
								               override="true"
								/>
							</then>
						</if>

						<propertyregex property="requirement.file"
						               defaultvalue="@{URL}"
						               input="@{URL}"
						               casesensitive=""
						               regexp=".+/([^\/]+)"
						               replace="\1"
						               override="true"
						/>
						<propertyregex property="requirement.dir"
						               defaultvalue="@{URL}"
						               input="@{URL}"
						               casesensitive=""
						               regexp=".+/([^\/]+)"
						               replace="\1"
						               override="true"
						/>
						<propertyregex property="requirement.buildurl"
						               defaultvalue="${requirement.dropfile}"
						               input="${requirement.dropfile}"
						               casesensitive=""
						               regexp="(.+)/([^\/]+)"
						               replace="\1"
						               override="true"
						/>

						<!-- define list of dependency files for use with buildAllHelper.xml#packAllInOnes; csv list called ${required.dependency.files} -->
						<if>
							<not>
								<contains string="${required.dependency.files}" substring="${requirement.file}" casesensitive="true" />
							</not>
							<then>
								<var name="required.dependency.files" value="${required.dependency.files},${requirement.file}" />
							</then>
						</if>
						<if>
							<equals arg1="${debug}" arg2="true" />
							<then>
								<echo># ${requirement.type}</echo>
							</then>
						</if>

						<echo file="${buildcfg}" append="true">
# ${requirement.type}
${requirement.type}.url=@{URL}
${requirement.type}.file=${requirement.file}
${requirement.type}.dropfile=/${requirement.dropfile}
${requirement.type}.buildurl=/${requirement.buildurl}

</echo>
						<if>
							<equals arg1="${downloadZipsIfNotFound}" arg2="true" />
							<then>
								<antcall target="getZip">
									<param name="downloadsDir" value="${downloadsDir}" />
									<param name="theFile" value="${requirement.file}" />
									<param name="theURL" value="@{URL}" />
								</antcall>
							</then>
						</if>
						<var name="requirement.type.suffix" unset="true" />

						<math result="numURLs" operand1="${numURLs}" operation="+" operand2="1" datatype="int" />
					</then>
				</if>
			</sequential>
		</for>

		<!-- define list of dependency files for use with buildAllHelper.xml#packAllInOnes; csv list called ${required.dependency.files} -->
		<!-- trim prefix "," -->
		<propertyregex property="required.dependency.files"
		               defaultvalue="${required.dependency.files}"
		               input="${required.dependency.files}"
		               regexp=",(.+)"
		               replace="\1"
		               override="true"
		/>
		<echo file="${buildcfg}" append="true">
#csv list of ${numURLs} required dependency files: see buildAllHelper.xml#packAllInOnes
required.dependency.files=${required.dependency.files}
</echo>

		<!-- for debugging use only -->
		<if>
			<equals arg1="${debug}" arg2="true" />
			<then>
				<exec executable="cat">
					<arg line="${buildcfg}" />
				</exec>
			</then>
		</if>

	</target>

	<!-- scan through the map files and decide what type of maps will be used by the build -->
	<target name="collectMapTypes">
		<if>
			<isset property="localSourceCheckoutDir" />
			<then>
				<property name="mapTypes" value="local" />
			</then>
			<else>
				<var name="mapTypes" value="" />
				<for param="file">
					<path>
						<fileset dir="${relengBuilderDir}/maps" includes="*.map" />
					</path>
					<sequential>
						<var name="map.file" unset="true" />
						<loadfile property="map.file" srcfile="@{file}" />
						<if>
							<contains string="${map.file}" substring="=SVN," casesensitive="false" />
							<then>
								<if>
									<not>
										<contains string="${mapTypes}" substring="SVN" />
									</not>
									<then>
										<var name="mapTypes" value="${mapTypes},SVN" />
									</then>
								</if>
							</then>
						</if>
						<if>
							<contains string="${map.file}" substring="=GET," />
							<then>
								<if>
									<not>
										<contains string="${mapTypes}" substring="GET" />
									</not>
									<then>
										<var name="mapTypes" value="${mapTypes},GET" />
									</then>
								</if>
							</then>
						</if>
						<if>
							<contains string="${map.file}" substring="cvs" />
							<then>
								<if>
									<not>
										<contains string="${mapTypes}" substring="CVS" />
									</not>
									<then>
										<var name="mapTypes" value="${mapTypes},CVS" />
									</then>
								</if>
							</then>

						</if>
						<var name="map.file" unset="true" />
					</sequential>
				</for>

				<!-- trim prefix "," -->
				<propertyregex property="mapTypes" defaultvalue="${mapTypes}" input="${mapTypes}" regexp=",(.+)" replace="\1" override="true" />
			</else>
		</if>

		<echo file="${buildcfg}" append="true">

# map types used in this build (CVS, SVN, GET, local)
mapTypes=${mapTypes}</echo>
	</target>

	<target name="projectid2names" description="Calculate *projectName variables from projectid">
		<propertyregex property="topprojectName"
		               defaultvalue="${topprojectName}"
		               input="${projectid}"
		               casesensitive=""
		               regexp="([^\.]+)\..+"
		               replace="\1"
		               override="true"
		/>
		<propertyregex property="subprojectName"
		               defaultvalue="${subprojectName}"
		               input="${projectid}"
		               casesensitive=""
		               regexp=".+\.([^\.]+)"
		               replace="\1"
		               override="true"
		/>
		<!-- projectName is either the middle piece if this regex matches, or ${subprojectName} if it doesn't -->
		<propertyregex property="projectName"
		               defaultvalue="${subprojectName}"
		               input="${projectid}"
		               casesensitive=""
		               regexp=".+\.([^\.]+)\..+"
		               replace="\1"
		               override="true"
		/>
	</target>

	<target name="getZip">
		<if>
			<not>
				<available file="${downloadsDir}/${theFile}" />
			</not>
			<then>
				<mkdir dir="${downloadsDir}" />
				<get src="${theURL}" dest="${downloadsDir}/${theFile}" usetimestamp="true" />
			</then>
		</if>
		<touch file="${downloadsDir}/${theFile}" />
	</target>

	<!-- TODO: support projectSetFiles = a dir, a file, or a CSV list of files -->
	<target name="fetchFromProjectSetFiles">

		<echo>projectSetFiles = ${projectSetFiles}</echo>
		<for param="psfEntry" delimiter=", " list="${projectSetFiles}">
			<sequential>
				<if>
					<available file="@{psfEntry}" type="file" />
					<then>
						<!-- load .psf into ${buildDirectory}/plugins/ and ${buildDirectory/features/ -->
						<echo>load @{psfEntry}</echo>

						<mkdir dir="${buildDir}/psf-checkout" />
						<!-- determine if file is cvs or svn -->

						<!-- do checkout using latest ant4eclipse -->
						<!-- 
						<cvsGetProjectSet cvsreallyquiet="true" 
							cvsUser="anonymous" cvsPwd="" 
							command="checkout" 
							projectSet="@{psfEntry}" workspace="${buildDir}/psf-checkout" />
						<svnGetProjectSet command="checkout" workspace="${buildDir}/psf-checkout"
							projectset="@{psfEntry}" />
						-->

						<!-- set localsourcecheckoutdir = ${buildDir}/psf-checkout, and do -->
					</then>
					<elseif>
						<available file="@{psfEntry}" type="dir" />
						<then>
							<!-- load all .psfs in dir into ${buildDirectory}/plugins/ and ${buildDirectory/features/ -->
							<echo>load all .psfs in dir @{psfEntry}</echo>
						</then>
					</elseif>
				</if>
			</sequential>
		</for>


		<fail />
	</target>

	<target name="fetchEclipseTestFrameworkSources">
		<!-- get missing o.e.test and o.e.a.o.junit if missing -->
		<for param="bundle" list="plugin@org.eclipse.test,fragment@org.eclipse.ant.optional.junit" keepgoing="true">
			<sequential>
				<propertyregex property="bundleName" input="@{bundle}" regexp="([^@]+)@([^@]+)" select="\2" casesensitive="false" override="true" />
				<if>
					<not>
						<available file="${buildDir}/eclipse/plugins/${bundleName}" type="dir" />
					</not>
					<then>
						<!-- fetch two test plugins from cvs via psf file -->
						<mkdir dir="${localSourceCheckoutDir}/test-temp" />
						<cvsGetProjectSet cvsUser="anonymous"
						                  CvsPwd=""
						                  command="checkout"
						                  projectSet="${relengCommonBuilderDir}/psf/test.psf"
						                  workspace="${localSourceCheckoutDir}/test-temp"
						/>

						<!-- copy plugins to where they're needed for the build -->
						<copy todir="${buildDir}/eclipse/plugins">
							<fileset dir="${localSourceCheckoutDir}/test-temp" />
						</copy>

						<!-- cache them for next time -->
						<mkdir dir="${localSourceCheckoutDir}/test" />
						<copy todir="${localSourceCheckoutDir}/test">
							<fileset dir="${localSourceCheckoutDir}/test-temp" />
						</copy>

						<!-- cleanup -->
						<delete dir="${localSourceCheckoutDir}/test-temp" includeemptydirs="true" quiet="true" />
					</then>
				</if>
				<var name="bundleName" unset="true" />
			</sequential>
		</for>

		<!-- check again; this time fail if not found -->
		<for param="bundle" list="plugin@org.eclipse.test,fragment@org.eclipse.ant.optional.junit" keepgoing="false">
			<sequential>
				<propertyregex property="bundleName" input="@{bundle}" regexp="([^@]+)@([^@]+)" select="\2" casesensitive="false" override="true" />
				<if>
					<not>
						<available file="${buildDir}/eclipse/plugins/${bundleName}" type="dir" />
					</not>
					<then>
						<echo message="ERROR! Can't find @{bundle} in ${buildDir}/eclipse/plugins/${bundleName}. Make sure your locally cached sources include this bundle."
						/>
					</then>
				</if>
				<var name="bundleName" unset="true" />
			</sequential>
		</for>
	</target>

	<!-- from a vcs raw dump, create a zip collecting everything into features/ and plugins/ so PDE can build it -->
	<target name="convertRawCheckoutToFeaturesAndPluginsDirs" depends="init">
		<property name="localSourceCheckoutDir" value="/home/nboldt/eclipse/workspace-jboss/org.eclipse.linuxtools.tree" />

		<!-- could be set to ${buildDirectory} if copying sources into a build-in-progress -->
		<property name="targetDir" value="${localSourceCheckoutDir}/ztmpDir" />

		<!-- set to false to include .svn folders and other metadata -->
		<property name="defaultExcludes" value="true" />

		<mkdir dir="${targetDir}/features" />
		<mkdir dir="${targetDir}/plugins" />
		<for param="dir">
			<path>
				<!-- Use "localSourceCheckoutDirExcludes" in build.properties to define what to suppress from the VCS dump; eg., "/archive/" should be ignored in gef.tree -->
				<dirset dir="${localSourceCheckoutDir}"
				        includes="**/**, **/**/**, **/**/**/**"
				        excludes="ztmpDir, ${localSourceCheckoutDirExcludes}"
				/>
			</path>
			<sequential>
				<if>
					<not>
						<or>
							<!-- exclude paths which might be in the workspace which are NOT relevant here -->
							<contains string="@{dir}" substring=".metadata" />
							<contains string="@{dir}" substring="org.eclipse.releng.basebuilder" />
							<contains string="@{dir}" substring="org.eclipse.dash.common.releng" />
						</or>
					</not>
					<then>
						<var name="dir.flat" unset="true" />
						<!-- flatten path to get just the dir -->
						<basename property="dir.flat" file="@{dir}" />
						<!-- trim the "-feature" dir suffix off since we assume the featureid does not include it -->
						<propertyregex property="dir.flat"
						               defaultvalue="${dir.flat}"
						               input="${dir.flat}"
						               regexp="([^/\\]+)-feature"
						               replace="\1"
						               override="true"
						/>
						<if>
							<available file="@{dir}/feature.xml" type="file" />
							<then>
								<!-- <echo>Feature :: ${dir.flat} :: @{dir}</echo> -->
								<mkdir dir="${targetDir}/features/${dir.flat}" />
								<copy todir="${targetDir}/features/${dir.flat}">
									<fileset dir="@{dir}" includes="**" defaultexcludes="${defaultExcludes}" />
								</copy>
							</then>
							<elseif>
								<or>
									<available file="@{dir}/META-INF/MANIFEST.MF" type="file" />
									<available file="@{dir}/plugin.xml" type="file" />
									<available file="@{dir}/fragment.xml" type="file" />
								</or>
								<then>
									<!-- <echo>Plugin :: ${dir.flat} :: @{dir}</echo> -->
									<mkdir dir="${targetDir}/plugins/${dir.flat}" />
									<copy todir="${targetDir}/plugins/${dir.flat}">
										<fileset dir="@{dir}" includes="**" defaultexcludes="${defaultExcludes}" />
									</copy>
								</then>
							</elseif>
							<elseif>
								<or>
									<contains string="${dir.flat}" substring=".releng" />
									<contains string="${dir.flat}" substring=".updatesite" />
									<contains string="${dir.flat}" substring=".update-site" />
									<contains string="${dir.flat}" substring=".updates" />
								</or>
								<then>
									<!-- <echo>Releng :: ${targetDir} :: ${dir.flat} :: @{dir}</echo> -->
									<mkdir dir="${targetDir}/releng/${dir.flat}" />
									<copy todir="${targetDir}/releng/${dir.flat}">
										<fileset dir="@{dir}" includes="**" defaultexcludes="${defaultExcludes}" />
									</copy>
								</then>
							</elseif>
						</if>
						<var name="dir.flat" unset="true" />
					</then>
				</if>
			</sequential>
		</for>
	</target>

	<target name="collectMaps">
		<!-- [256201] merge mapfiles to root & rename -->
		<if>
			<available file="${buildDir}/directory.txt" type="file" />
			<then>
				<delete file="${buildDir}/directory.txt" />
			</then>
		</if>
		<if>
			<available file="${relengBuilderDir}/maps" type="dir" />
			<then>
				<for param="file">
					<path>
						<fileset dir="${relengBuilderDir}/maps" includes="*.map" />
					</path>
					<sequential>
						<loadfile property="map.file" srcfile="@{file}" />
						<echo file="${buildDir}/directory.txt" append="true">
!*** @{file}
${map.file}

</echo>
						<var name="map.file" unset="true" />
					</sequential>
				</for>
			</then>
			<else>
				<echo file="${buildDir}/directory.txt" append="true">
!*** No maps found in ${relengBuilderDir}/maps 
!*** Build from local sources in ${localSourceCheckoutDir}

</echo>
			</else>
		</if>

		<!-- verify that if we're using SVN sources we have SVN support in basebuilder -->
		<loadfile property="directory.txt.contents" srcFile="${buildDir}/directory.txt" />
		<if>
			<and>
				<contains string="${directory.txt.contents}" substring="=SVN,,http" />
				<not>
					<available file="${relengBaseBuilderDir}/plugins/org.eclipse.pde.build.svn_1.0.1.v20070222.jar" type="file" />
				</not>
			</and>
			<then>
				<fail>Error!
Map file(s) require SVN checkout support in PDE, but could not find
	${relengBaseBuilderDir}/
		plugins/org.eclipse.pde.build.svn_1.0.1.v20070222.jar.

You will need to manually add this jar if it cannot be done 
automatically via the build due to permission problems or other
restrictions.
</fail>
			</then>
		</if>
	</target>

	<!-- convert an svn directory tree into map format -->
	<target name="dir2svnmap">
		<property name="dir2map.reporoot" value="http://anonsvn.jboss.org/repos" />
		<property name="dir2map.repopath" value="jbosstools/trunk/foo" />
		<property name="dir2map.dir" value="/home/nboldt/eclipse/workspace-jboss/jbosstools-trunk/foo" />
		<property name="dir2map.map" value="/home/nboldt/eclipse/workspace-jboss/jbosstools-trunk/foo/releng/maps/project.map" />
		<property name="dir2map.exclude" value="**/releng/**, **/.svn/**, **/CVS/**" />
		<delete file="${dir2map.map}" quiet="true" />
		<echo file="${dir2map.map}">!*** Generated with org.eclipse.dash.common.releng/tools/scripts/buildAllHelper.xml#dir2svnmap task
</echo>
		<for param="dir">
			<path>
				<dirset dir="${dir2map.dir}" excludes="${dir2map.exclude}">
				</dirset>
			</path>
			<sequential>
				<if>
					<not>
						<or>
							<!-- exclude paths which might be in the workspace which are NOT relevant here -->
							<contains string="@{dir}" substring=".metadata" />
							<contains string="@{dir}" substring="org.eclipse.releng.basebuilder" />
							<contains string="@{dir}" substring="org.eclipse.dash.common.releng" />
						</or>
					</not>
					<then>
						<var name="dir.flat" unset="true" />
						<var name="dir.svn" unset="true" />
						<!-- flatten path to get just the dir -->
						<basename property="dir.flat" file="@{dir}" />
						<!-- trim the "-feature" dir suffix off since we assume the featureid does not include it -->
						<propertyregex property="dir.flat"
						               defaultvalue="${dir.flat}"
						               input="${dir.flat}"
						               regexp="([^/\\]+)-feature"
						               replace="\1"
						               override="true"
						/>

						<!-- trim off the base dir to get just the path -->
						<pathconvert property="dir.svn">
							<path path="@{dir}" />
							<chainedmapper>
								<regexpmapper from="${dir2map.dir}/(.*)" to="\1" handledirsep="yes" />
							</chainedmapper>
						</pathconvert>
						<if>
							<available file="@{dir}/feature.xml" type="file" />
							<then>
								<!-- feature@org.jboss.tools.jmx.sdk.feature=SVN,,http://anonsvn.jboss.org/repos,,jbosstools/trunk/jmx/features/org.jboss.tools.jmx.sdk.feature -->
								<echo append="true" file="${dir2map.map}">feature@${dir.flat}=SVN,,${dir2map.reporoot},,${dir2map.repopath}/${dir.svn}
</echo>
							</then>
							<elseif>
								<or>
									<available file="@{dir}/META-INF/MANIFEST.MF" type="file" />
									<available file="@{dir}/plugin.xml" type="file" />
									<available file="@{dir}/fragment.xml" type="file" />
								</or>
								<then>
									<!-- plugin@org.jboss.tools.jmx.core=SVN,,http://anonsvn.jboss.org/repos,,jbosstools/trunk/jmx/plugins/org.jboss.tools.jmx.core -->
									<echo append="true" file="${dir2map.map}">plugin@${dir.flat}=SVN,,${dir2map.reporoot},,${dir2map.repopath}/${dir.svn}
</echo>
								</then>
							</elseif>
						</if>
						<var name="dir.flat" unset="true" />
						<var name="dir.svn" unset="true" />
					</then>
				</if>
			</sequential>
		</for>
	</target>

	<!-- [278687] Supported target .psf file formats are: 
			CVS, SVN-Subclipse, SVN-Subversive.
		 	Because Subclipse and Subversive formats are not the same, we need to produce 
		 	TWO .psfs from each .map file.

		 Maps with a mix of CVS and SVN will result in three .psfs (2 for the SVN entries, 1 for CVS); 
		 	CVS .psf will have SVN entries commented out, SVN .psfs will have CVS entries commented out.
		 	
		 Possible future considerations include 
		 	HTTP map files (eg., Orbit jars)
		 	Git map files (?)
	-->
	<target name="map2psf" description="generate psfs/*.psf from every map file in maps/*.map">
		<if>
			<available file="${relengBuilderDir}/maps" type="dir" />
			<then>
				<mkdir dir="${relengBuilderDir}/psfs" />

				<!-- Process mapfiles for CVS content -->
				<for param="mapfile">
					<path>
						<fileset dir="${relengBuilderDir}/maps" includes="*.map">
							<contains text="CVS" casesensitive="false" />
						</fileset>
					</path>
					<sequential>
						<propertyregex property="psfdir"
						               input="@{mapfile}"
						               defaultvalue="@{mapfile}"
						               regexp="/maps/.+"
						               replace="/psfs/"
						               override="true"
						/>
						<propertyregex property="psffileprefix"
						               input="@{mapfile}"
						               defaultvalue="@{mapfile}"
						               regexp=".+/maps/(.+).map"
						               replace="\1"
						               override="true"
						/>

						<!-- create psf in cvs format -->
						<delete dir="${psfdir}" includes="${psffileprefix}.cvs.psf" />
						<var name="psffile" value="${psfdir}/${psffileprefix}.cvs.psf" />
						<concat destfile="${psffile}">
							<header filtering="no">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;psf version="2.0"&gt;
&lt;provider id="org.eclipse.team.cvs.core.cvsnature"&gt;

</header>
							<path path="@{mapfile}" />
							<footer>
&lt;/provider&gt;
&lt;/psf&gt;
</footer>
						</concat>
						<!-- 
						FROM: 
							\1		\2				\3				\4											   \5	\6
							plugin@org.eclipse.gef=v20090306-1147,:pserver:anonymous@dev.eclipse.org:/cvsroot/tools,,org.eclipse.gef/plugins/org.eclipse.gef
							feature@org.eclipse.draw2d=v20090316-1158,:pserver:anonymous@dev.eclipse.org:/cvsroot/tools,,org.eclipse.gef/features/org.eclipse.draw2d-feature
							\1		\2				\3				\4	
							plugin@org.eclipse.test=v20080313,:pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse,
							fragment@org.eclipse.ant.optional.junit=v20070202,:pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse,
						TO: 
							<project reference="1.0,ROOT,PATH,MODULENAME,BRANCHorTAG"/>
							<project reference="1.0,:pserver:anonymous@dev.eclipse.org:/cvsroot/tools,path/to/org.eclipse.gef,org.eclipse.gef,v20090316"/>
							<project reference="1.0,:pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse,org.eclipse.test"/>
						-->
						<replaceregexp file="${psffile}"
						               match="(.+)@(.+)=([^,]+),([^,]+),([^,]*),([^,]+)"
						               replace="  &lt;project reference=&quot;1.0,\4,\6,\2,\3&quot;/&gt;"
						               flags="g"
						               byline="true"
						/>
						<replaceregexp file="${psffile}"
						               match="(.+)@(.+)=([^,]+),([^,]+).*"
						               replace="  &lt;project reference=&quot;1.0,\4,\2,\2,\3&quot;/&gt;"
						               flags="g"
						               byline="true"
						/>
						<replaceregexp file="${psffile}" match="(\!\*|\#)(.+)" replace="  &lt;!-- \1\2 --&gt;" flags="g" byline="true" />
						<replaceregexp file="${psffile}" match="(.+)(=SVN,)(.+)" replace="  &lt;!-- \1\2\3 --&gt;" flags="g" byline="true" />
						<replaceregexp file="${psffile}" match="///" replace="/" flags="g" />

						<var name="psffile" unset="true" />
						<var name="psffileprefix" unset="true" />
						<var name="psfdir" unset="true" />
					</sequential>
				</for>

				<!-- Process mapfiles for SVN content -->
				<for param="mapfile">
					<path>
						<fileset dir="${relengBuilderDir}/maps" includes="*.map">
							<contains text="SVN" casesensitive="false" />
						</fileset>
					</path>
					<sequential>
						<propertyregex property="psfdir"
						               input="@{mapfile}"
						               defaultvalue="@{mapfile}"
						               regexp="/maps/.+"
						               replace="/psfs/"
						               override="true"
						/>
						<propertyregex property="psffileprefix"
						               input="@{mapfile}"
						               defaultvalue="@{mapfile}"
						               regexp=".+/maps/(.+).map"
						               replace="\1"
						               override="true"
						/>

						<!-- create psf in subversive format -->
						<delete dir="${psfdir}" includes="${psffileprefix}.subversive.psf" />
						<var name="psffile" value="${psfdir}/${psffileprefix}.subversive.psf" />
						<concat destfile="${psffile}">
							<header filtering="no">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;psf version="2.0"&gt;
&lt;provider id="org.eclipse.team.svn.core.svnnature"&gt;

</header>
							<path path="@{mapfile}" />
							<footer>
&lt;/provider&gt;
&lt;/psf&gt;
</footer>
						</concat>
						<!-- 
						FROM: 
								\1				\2					\3			\4													\5			\6
						 	feature@org.eclipse.vtp.feature.all=SVN,trunk,http://dev.eclipse.org/svnroot/technology/org.eclipse.vtp,Releng,org.eclipse.vtp.feature.all
							feature@org.jboss.tools.jmx.sdk.feature=SVN,,http://anonsvn.jboss.org/repos,,jbosstools/trunk/jmx/features/org.jboss.tools.jmx.sdk.feature
							plugin@org.jboss.tools.jmx.core=SVN,,http://anonsvn.jboss.org/repos,,jbosstools/trunk/jmx/plugins/org.jboss.tools.jmx.core
							plugin@org.jboss.ide.eclipse.freemarker=SVN,,http://anonsvn.jboss.org/repos,,jbosstools/trunk/freemarker/plugins/org.jboss.ide.eclipse.freemarker
							
							\1				\2								\3	\4									  \5	\6
							plugin@org.eclipse.linuxtools.changelog.doc=SVN,,http://dev.eclipse.org/svnroot/technology,,org.eclipse.linuxtools/changelog/trunk/org.eclipse.linuxtools.changelog.doc
							fragment@org.eclipse.linuxtools.changelog.parsers.java=SVN,,http://dev.eclipse.org/svnroot/technology,,org.eclipse.linuxtools/changelog/trunk/org.eclipse.linuxtools.changelog.javaparser
							feature@org.eclipse.linuxtools.changelog=SVN,,http://dev.eclipse.org/svnroot/technology,,org.eclipse.linuxtools/changelog/trunk/org.eclipse.linuxtools.changelog-feature
						TO (line breaks added for clarity; should be a single line of XML): 
							<project reference="1.0.1,https://dev.eclipse.org/svnroot/technology/org.eclipse.vtp/Releng/trunk/org.eclipse.vtp.releng,org.eclipse.vtp.releng,
							0005dcf07f32001e162a94aa39f2ce50;
							https://dev.eclipse.org/svnroot/technology/org.eclipse.vtp/Releng/trunk/org.eclipse.vtp.releng;
							https://dev.eclipse.org/svnroot/technology/org.eclipse.vtp/Releng/trunk/org.eclipse.vtp.releng;
							branches;tags;trunk;true;ee007c2a-0a25-0410-9ab9-bf268980928c;
							https://dev.eclipse.org/svnroot/technology/org.eclipse.vtp;;false;;;22"/>
							 - or -
							<project reference="1.0.1,https://dev.eclipse.org/svnroot/technology/org.eclipse.vtp/Releng/trunk/org.eclipse.vtp.releng,org.eclipse.vtp.releng"/>
						-->
						<!-- insanely verbose format -->
						<!-- <replaceregexp file="${psffile}"
						               match="(.+)@(.+)=SVN,([^,]*),([^,]+),([^,]*),([^,]+)"
						               replace="  &lt;project reference=&quot;1.0.1,\4/\5/\3/\6,\2,000;\4/\5/\3/\6;\4/\5/\3/\6;branches;tags;trunk;true;000;\4;;false;;;000&quot;/&gt;"
						               flags="g"
						               byline="true"
						/> -->
						<!-- simple format -->
						<replaceregexp file="${psffile}"
						               match="(.+)@(.+)=SVN,([^,]+),([^,]+),([^,]+),([^,]+)"
						               replace="  &lt;project reference=&quot;1.0.1,\4/\5/\3/\6,\2&quot;/&gt;"
						               flags="g"
						               byline="true"
						/>
						<replaceregexp file="${psffile}"
						               match="(.+)@(.+)=SVN,,([^,]+),,([^,]+)"
						               replace="  &lt;project reference=&quot;1.0.1,\3/\4,\2&quot;/&gt;"
						               flags="g"
						               byline="true"
						/>
						<replaceregexp file="${psffile}" match="(\!\*|\#)(.+)" replace="  &lt;!-- \1\2 --&gt;" flags="g" byline="true" />
						<replaceregexp file="${psffile}" match="(.+)(/cvs)(.+)" replace="  &lt;!-- \1\2\3 --&gt;" flags="g" byline="true" />
						<replaceregexp file="${psffile}" match="///" replace="/" flags="g" />

						<!-- create psf in subclipse format -->
						<delete dir="${psfdir}" includes="${psffileprefix}.subclipse.psf" />
						<var name="psffile" value="${psfdir}/${psffileprefix}.subclipse.psf" />
						<concat destfile="${psffile}">
							<header filtering="no">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;psf version="2.0"&gt;
&lt;provider id="org.tigris.subversion.subclipse.core.svnnature"&gt;

</header>
							<path path="@{mapfile}" />
							<footer>
&lt;/provider&gt;
&lt;/psf&gt;
</footer>
						</concat>
						<!-- 
						FROM: 
						 	feature@org.eclipse.vtp.feature.all=SVN,trunk,http://dev.eclipse.org/svnroot/technology/org.eclipse.vtp,Releng,org.eclipse.vtp.feature.all
							feature@org.jboss.tools.jmx.sdk.feature=SVN,,http://anonsvn.jboss.org/repos,,jbosstools/trunk/jmx/features/org.jboss.tools.jmx.sdk.feature
							plugin@org.jboss.tools.jmx.core=SVN,,http://anonsvn.jboss.org/repos,,jbosstools/trunk/jmx/plugins/org.jboss.tools.jmx.core
							plugin@org.eclipse.linuxtools.changelog.doc=SVN,,http://dev.eclipse.org/svnroot/technology,,org.eclipse.linuxtools/changelog/trunk/org.eclipse.linuxtools.changelog.doc
							fragment@org.eclipse.linuxtools.changelog.parsers.java=SVN,,http://dev.eclipse.org/svnroot/technology,,org.eclipse.linuxtools/changelog/trunk/org.eclipse.linuxtools.changelog.javaparser
							feature@org.eclipse.linuxtools.changelog=SVN,,http://dev.eclipse.org/svnroot/technology,,org.eclipse.linuxtools/changelog/trunk/org.eclipse.linuxtools.changelog-feature
						TO: 
							<project reference="0.9.3,svn://svn.jboss.org/repos/jbosstools/trunk/jmx/features/org.jboss.tools.jmx.sdk.feature,org.jboss.tools.jmx.sdk.feature"/>
							<project reference="0.9.3,svn://svn.jboss.org/repos/jbosstools/trunk/jmx/plugins/org.jboss.tools.jmx.core,org.jboss.tools.jmx.core"/>
						-->
						<replaceregexp file="${psffile}"
						               match="(.+)@(.+)=SVN,([^,]*),([^,]+),([^,]*),([^,]+)"
						               replace="  &lt;project reference=&quot;0.9.3,\4/\5/\3/\6,\2&quot;/&gt;"
						               flags="g"
						               byline="true"
						/>
						<replaceregexp file="${psffile}"
						               match="(.+)@(.+)=SVN,,([^,]+),,([^,]+)"
						               replace="  &lt;project reference=&quot;0.9.3,\3/\4,\2&quot;/&gt;"
						               flags="g"
						               byline="true"
						/>
						<replaceregexp file="${psffile}" match="(\!\*|\#)(.+)" replace="  &lt;!-- \1\2 --&gt;" flags="g" byline="true" />
						<replaceregexp file="${psffile}" match="(.+)(/cvs)(.+)" replace="  &lt;!-- \1\2\3 --&gt;" flags="g" byline="true" />
						<replaceregexp file="${psffile}" match="///" replace="/" flags="g" />

						<var name="psffile" unset="true" />
						<var name="psffileprefix" unset="true" />
						<var name="psfdir" unset="true" />
					</sequential>
				</for>
			</then>
			<else>
				<echo>Warning!
Map directory ${relengBuilderDir}/maps does not exist. Nothing to do!
</echo>
			</else>
		</if>
	</target>

	<target name="provision.eclipse.build.base">
		<antcall target="provision.eclipse.base">
			<param name="provision.eclipse.base.target" value="${buildDir}" />
		</antcall>
	</target>
	<target name="provision.eclipse.test.base">
		<antcall target="provision.eclipse.base">
			<param name="provision.eclipse.base.target" value="${install}" />
		</antcall>
	</target>
	<target name="provision.eclipse.base">
		<property name="provision.eclipse.base.target" value="${buildDir}" />
		<if>
			<and>
				<isset property="eclipse.base.url" />
				<isset property="eclipse.base.file" />
			</and>
			<then>
				<echo message="Provision Eclipse base from ${eclipse.base.file} into ${provision.eclipse.base.target}..." />
				<ant target="getDep" antfile="${relengCommonBuilderDir}/tools/scripts/getDependencies.xml">
					<property name="url" value="${eclipse.base.url}" />
					<property name="file" value="${eclipse.base.file}" />
					<property name="unpackDest" value="${provision.eclipse.base.target}" />
				</ant>
			</then>
			<elseif>
				<not>
					<and>
						<isset property="repositoryURLs" />
						<or>
							<isset property="IUsToInstall" />
							<isset property="pluginIDsToInstall" />
							<isset property="featureIDsToInstall" />
						</or>
					</and>
				</not>
				<then>
					<fail>Error!
Build cannot continue without a defined Eclipse base.
----------
You must specify either
	dependencyURLs=http://download.eclipse.org/eclipse/downloads/drops/R-3.5-200906111540/eclipse-SDK-3.5-linux-gtk.tar.gz
	(or equivalent platform, RCP, etc.)
or
	repositoryURLs=http://download.eclipse.org/eclipse/updates/3.5.x/
	featureIDsToInstall=org.eclipse.sdk
	(or equivalent update site repos + features/plugins to install; 
	 use featureIDsToInstall, pluginIDsToInstall and/or IUsToInstall)
</fail>
				</then>
			</elseif>
		</if>
	</target>

</project>