Skip to main content
summaryrefslogblamecommitdiffstats
blob: 5ad3a3b61dcd908b1928f5ca772d350bc977e34f (plain) (tree)


























































































































                                                                                                                                                                                                                                                                   
<project>

	<!-- load up the properties for cruise agents based on their hostnames, if available -->
	<exec executable="hostname" outputproperty="hostname" />
	<property file="host-conf/build.${hostname}.properties" />

	<taskdef resource="net/sf/antcontrib/antlib.xml">
		<classpath>
			<pathelement location="externals/libs/ant-contrib-1.0b3.jar" />
		</classpath>
	</taskdef>

	<property environment="env" />
	<condition property="path" value="${env.PATH}">
		<isset property="env.PATH" />
	</condition>
	<condition property="path" value="${env.Path}">
		<isset property="env.Path" />
	</condition>

	<macrodef name="check.executable">
		<attribute name="executable" />
		<sequential>
			<echo>Checking for @{executable} on path.</echo>
			<available file="@{executable}" filepath="${path}" property="@{executable}.executable.available" />
			<available file="@{executable}.exe" filepath="${path}" property="@{executable}.executable.available" />
			<fail unless="@{executable}.executable.available" message="@{executable} not available on path. Please ensure that @{executable} is on path." />
			<echo>Found @{executable} on path.</echo>
		</sequential>
	</macrodef>

	<condition property="isWin">
		<contains casesensitive="false" substring="win" string="${os.name}" />
	</condition>

	<target name="check-windows-preconditions" if="isWin">
		<check.executable executable="unzip" />
	</target>

	<target name="check-other-preconditions" unless="isWin">
		<check.executable executable="tar" />
	</target>

	<target name="guess-pde-build-version" unless="pde-build-version">
		<echo>Guessing plugin version of org.eclipse.pde.build.</echo>
		<for param="pde-build-file">
			<dirset dir="../eclipse/plugins/" includes="org.eclipse.pde.build_*" />
			<sequential>
				<propertyregex property="pde-build-version" input="@{pde-build-file}" regexp="org.eclipse.pde.build_(.*)" select="\1" />
			</sequential>
		</for>
		<fail unless="pde-build-version" message="Could not find org.eclipse.pde.build in target eclipse" />
		<echo>Plugin version of org.eclipse.pde.build is "${pde-build-version}"</echo>
	</target>

	<target name="create-build-properties-from-template">
		<copy file="build.properties.template" tofile="build.properties" overwrite="true">
			<filterset>
				<filter token="PDE_BUILD_PLUGIN_VERSION" value="${pde-build-version}" />
			</filterset>
		</copy>
		<property file="build.properties" />
	</target>

	<target name="check-conditions" depends="check-windows-preconditions, check-other-preconditions">
		<check.executable executable="svn" />
		<available file="build.developer.properties" property="build.developer.properties.available" />
		<available file="host-conf/build.${hostname}.properties" property="build.developer.properties.available" />
		<fail unless="build.developer.properties.available">Could not find the file "build.developer.properties", or host-conf/build.${hostname}.properties. Please create the file using "build.developer.properties.sample" as the starting point.</fail>
	</target>

	<target name="guess-junit-version">
		<echo>Guessing plugin version of org.junit4.</echo>
		<for param="junit-version-file">
			<dirset dir="../eclipse/plugins/" includes="org.junit4_*" />
			<sequential>
				<propertyregex property="junit4-build-version" input="@{junit-version-file}" regexp="org.junit4_(.*)" select="\1" />
			</sequential>
		</for>
		<condition property="isJunit4.5">
			<contains string="${junit4-build-version}" substring="4.5" />
		</condition>
		<fail unless="junit4-build-version" message="Could not find org.junit4 in target eclipse" />
		<echo>Plugin version of org.junit is "${junit4-build-version}"</echo>
		<echo>isJunit4.5: ${isJunit4.5}</echo>
	</target>

	<target name="initialize-environment" depends="guess-junit-version, guess-pde-build-version, create-build-properties-from-template" />

	<delete file="${java.io.tmpdir}/git.svn.properties" />
	<touch file="${java.io.tmpdir}/git.svn.properties" />
	<!-- guess svn revision -->
	<exec executable="git" output="${java.io.tmpdir}/git.svn.properties" dir=".." failifexecutionfails="false" failonerror="false">
		<arg line="svn info" />
	</exec>

	<!-- prefix all properties with "svn." and replace spaces to make the keys unique -->
	<loadproperties srcfile="${java.io.tmpdir}/git.svn.properties">
		<filterchain>
			<prefixlines prefix="svn." />
			<deletecharacters chars="\ " />
		</filterchain>
	</loadproperties>

	<delete file="${java.io.tmpdir}/svn.properties" />
	<touch file="${java.io.tmpdir}/svn.properties" />
	<!-- guess svn revision -->
	<exec executable="svn" output="${java.io.tmpdir}/svn.properties" dir=".." failifexecutionfails="false" failonerror="false">
		<arg value="info" />
	</exec>

	<!-- prefix all properties with "svn." and replace spaces to make the keys unique -->
	<loadproperties srcfile="${java.io.tmpdir}/svn.properties">
		<filterchain>
			<prefixlines prefix="svn." />
			<deletecharacters chars="\ " />
		</filterchain>
	</loadproperties>

	<property name="svn.version" value="${svn.LastChangedRev}" />
	<fail unless="svn.version" message="could not determine svn version number" />

</project>

Back to the top