alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

<project default="main">

	<!--
		Steps
		
		1.  Create Eclipse SDK source drops.
		2.  Build master feature which includes all features and plug-ins in eclipse and equinox projects, with exception of tests.
		3.  Sign master zip, build root file drops and SDK tests in parallel.
		4.  Repackage signed master.zip into eclipse and equinox distributables.  Start JUnit and performance tests as soon as JUnit test plug-ins
			are packaged.
		5.  Post drops to eclipse and equinox download areas.
	
	 	Ant properties available at runtime: 
	
	 - eclipse.pdebuild.scripts: the org.eclipse.eclipse.pdebuild.scripts folder
	 - eclipse.pdebuild.home: the root folder of pde build
	 - eclipse.pdebuild.templates: the  templates folder

	-->

	<!--build monitoring information:  e-mail, smtp server, build label-->
	<property file="monitor.properties" />

	<!--location of PDE Build configuration files for builder and packager-->
	<property name="eclipse.build.configs" value="${basedir}/eclipse/buildConfigs" />
	<property name="equinox.build.configs" value="${basedir}/equinox/buildConfigs" />

	<property name="sdkHelper" location="${eclipse.build.configs}/eclipse/helper.xml" />
	<property name="base.builder" value="${basedir}/../org.eclipse.releng.basebuilder" />

	<!--location of properties file containing last tag used for integration build-->
	<property name="mapTag.properties" value="/home/users/releng/buildTools/eclipse34/mapTag.properties" />

	<!--location of properties file containing last performance reference test information-->
	<property name="ref.properties" value="/home/users/releng/buildTools/eclipse.perf/ref34.properties" />

	<!--location of test update site-->
	<property file="${ref.properties}" />

	<!--default buildDirectory-->
	<property name="buildDirectory" value="${basedir}/../src" />

	<!--default location for build output, parent to ${buildLabel}-->
	<property name="postingDirectory" value="${buildDirectory}" />
	<property name="equinoxPostingDirectory" value="${postingDirectory}/../../equinox/drops" />

	<target name="main" depends="init">
		<antcall target="buildEclipseSourceDrops" />
		<antcall target="buildMasterFeature" />
		<parallel failonany="true">
			<sequential>
				<antcall target="updatePackProperties" />
				<antcall target="signMasterFeature" />
				<antcall target="packMasterFeature" />
				<antcall target="unpackUpdateJarsForPackaging" />
				<antcall target="buildUpdateSite" />				
			</sequential>
			<sequential>
				<antcall target="buildMasterRootFeature" />
				<antcall target="buildSdkTestFeature" />
				<ant antfile="${eclipse.build.configs}/../helper.xml" target="verifyCompile" />
			</sequential>
		</parallel>
		<parallel failonany="true">
			<sequential>
				<antcall target="packageEclipseDistributables" />
				<antcall target="packageEquinoxDistributables" />
				<ant antfile="${equinox.build.configs}/equinox.prov/run.xml"/>			
				<antcall target="publishEclipse" />
				<antcall target="publishEquinox" />
			</sequential>
			<antcall target="testEclipse" />
		</parallel>
		<antcall target="publishRSS" />
	</target>

	<target name="init">
		<ant antfile="build.xml" target="init" />
		<property file="${buildDirectory}/label.properties" />
		<condition property="fetchTag" value="HEAD">
			<equals arg1="${buildType}" arg2="N" />
		</condition>
		<condition property="forceContextQualifier" value="${buildId}">
			<equals arg1="${buildType}" arg2="N" />
		</condition>
		<!--generic compiler args-->
		<property name="javacSource" value="1.3" />
		<property name="javacTarget" value="1.2" />
		<property name="javacDebugInfo" value="true" />
		<property name="javacFailOnError" value="false" />
		<property name="javacVerbose" value="false" />
		<property name="logExtension" value=".xml" />
		<!--this property required as of Eclipse 3.0 stream builds > 20031126 -->
		<property name="buildingOSGi" value="true" />
		<!--zip args-->
		<property name="zipargs" value="-y -qq" />
		<!--unzip args-->
		<property name="unzipArgs" value="-qq" />
		<property name="repo" value="${buildDirectory}/repo" />
		<property name="reposource" value="${buildDirectory}/reposource" />
	</target>

	<target name="buildMasterFeature">
		<ant antfile="build.xml" dir="${basedir}">
			<property name="component" value="${eclipse.build.configs}/master" />
		</ant>
	</target>

	<target name="buildUpdateSite" if="updateSite">
		<ant antfile="${eclipse.build.configs}/../helper.xml" target="buildUpdateJars" />
	</target>

	<target name="buildMasterRootFeature">
		<ant antfile="build.xml" dir="${basedir}" target="main">
			<property name="component" value="${eclipse.build.configs}/org.eclipse.equinox.executable" />
		</ant>
		<ant antfile="build.xml" dir="${basedir}" target="main">
			<property name="component" value="${eclipse.build.configs}/master-root" />
		</ant>
	</target>

	<target name="buildSdkTestFeature">
		<ant antfile="build.xml" dir="${basedir}" target="main">
			<property name="component" value="${eclipse.build.configs}/sdk.tests" />
		</ant>
		<ant antfile="build.xml" dir="${basedir}" target="main">
			<property name="component" value="${eclipse.build.configs}/test.framework" />
		</ant>
	</target>

	<target name="buildEclipseSourceDrops">
		<property name="buildSourceDrops" value="true" />
		<!--examples are required to pull sample doc into SDK doc plug-ins-->
		<ant antfile="build.xml" dir="${eclipse.pdebuild.scripts}" target="preBuild">
			<property name="builder" value="${eclipse.build.configs}/sdk.examples" />
		</ant>
		<ant antfile="build.xml" dir="${eclipse.pdebuild.scripts}" target="fetch">
			<property name="builder" value="${eclipse.build.configs}/sdk.examples" />
		</ant>
		<!--fetch source and generate scripts for eclipse SDK-->
		<ant antfile="build.xml" dir="${eclipse.pdebuild.scripts}" target="preBuild">
			<property name="builder" value="${eclipse.build.configs}/sdk" />
		</ant>
		<ant antfile="build.xml" dir="${eclipse.pdebuild.scripts}" target="fetch">
			<property name="builder" value="${eclipse.build.configs}/sdk" />
		</ant>
		<ant antfile="build.xml" dir="${eclipse.pdebuild.scripts}" target="generate">
			<property name="builder" value="${eclipse.build.configs}/sdk" />
		</ant>
	</target>

	<target name="packMasterFeature" unless="skipPack">
		<property name="archiveName" value="eclipse-master-${buildId}.zip" />
		<property name="packtmp" value="${buildDirectory}/packtmp" />
		<mkdir dir="${packtmp}" />
		<move file="${buildDirectory}/${buildLabel}/${archiveName}" tofile="${packtmp}/${archiveName}" />


		<!-- update location of jvm arguments -->
		<replace file="${eclipse.build.configs}/../../extras/pack200" token="@pack200@" value="${java15-home}/bin/pack200" />
		<chmod file="${eclipse.build.configs}/../../extras/pack200" perm="755" />

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

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

		<delete dir="${packtmp}" />
	</target>

	<target name="waitForChangedAttribs" unless="attribs.changed">
		<antcall target="compareAttribs" inheritAll="false">
			<param name="originalAttribs" value="${originalAttribs}" />
		</antcall>
	</target>

	<target name="compareAttribs">
		<!--poll file for change in attributes-->
		<exec dir="${buildDirectory}" executable="ssh" outputProperty="polledAttribs">
			<arg line="${sshline}" />
		</exec>
		<echo message="original:  ${originalAttribs}" />
		<condition property="attribChanged">
			<and>
				<not>
					<contains string="${polledAttribs}" substring="Permission denied, please try again." casesensitive="no" />
				</not>
				<not>
					<contains string="${polledAttribs}" substring="Host key verification failed." casesensitive="no" />
				</not>
				<or>
					<not>
						<contains string="${polledAttribs}" substring="No such file or directory" casesensitive="no" />
					</not>
					<contains string="${polledAttribs}" substring="bash: line 0: cd:" casesensitive="no" />
				</or>
			</and>
		</condition>
		<echo message="polled:  ${polledAttribs}" />
		<antcall target="writeDiffResult" />
		<sleep seconds="120" />
		<available property="attribs.changed" file="${buildDirectory}/attribDiff.txt" />
		<antcall target="waitForChangedAttribs" />
	</target>

	<target name="writeDiffResult" if="attribChanged">
		<echo message="original: ${originalAttribs}" file="${buildDirectory}/attribDiff.txt" />
		<echo message="new: ${polledAttribs}" file="${buildDirectory}/attribDiff.txt" append="true" />
	</target>

	<target name="updatePackProperties">
		<!--exclude pre-built Orbit bundles from being signed and packed-->
		<property name="packproperties" value="${buildDirectory}/updatePackProperties.txt" />
		<apply executable="ls" output="${packproperties}" dir="${buildDirectory}/plugins" relative="true" parallel="true" append="true">
			<arg value="-d" />
			<fileset dir="${buildDirectory}/plugins" includes="com.ibm.icu*, com.ibm.icu.*, com.jcraft.jsch*" />
		</apply>
		<replaceregexp file="${packproperties}" match="\n+" replace=",eclipse/plugins/" />
		<replaceregexp file="${packproperties}" match="\s+" replace=",eclipse/plugins/" />
		<replaceregexp file="${packproperties}" match="\n+" replace="" />
		<loadfile property="pack.properties" srcFile="${packproperties}" />
		<delete file="${packproperties}" failonerror="false" />
		<replace file="${eclipse.build.configs}/../../extras/pack.properties" token="@excludejars@" value="${pack.properties}" />
	</target>


	<target name="signMasterFeature" if="sign">
		<property name="archiveName" value="eclipse-master-${buildId}.zip" />
		<property name="packtmp" value="${buildDirectory}/packtmp" />
		<property name="stagingDirectoryOutput" value="/home/data/httpd/download-staging.priv/eclipse/${buildId}-out" />
		<property name="stagingDirectory" value="/home/data/httpd/download-staging.priv/eclipse" />
		<property name="outputFile" value="${stagingDirectoryOutput}/${archiveName}" />

		<mkdir dir="${packtmp}" />
		<move file="${buildDirectory}/${buildLabel}/${archiveName}" tofile="${packtmp}/${archiveName}" />
		<!-- add pack.properties file that specifies effort level -->
		<exec dir="${eclipse.build.configs}/../../extras" executable="zip">
			<arg line="-r ${packtmp}/${archiveName} pack.properties" />
		</exec>

		<!--push drop to staging directory-->
		<echo message="push drop to staging directory" />
		<exec dir="${packtmp}" executable="scp" output="signing.txt">
			<arg line="${archiveName} build.eclipse.org:${stagingDirectory}" />
		</exec>
		<exec dir="${buildDirectory}" executable="ssh" output="signing.txt" append="true">
			<arg line="build.eclipse.org /bin/chmod ugo+rw ${stagingDirectory}/${archiveName} " />
		</exec>

		<!--invoke sign script and wait-->
		<echo message="invoke sign script and wait" />
		<exec dir="." executable="ssh" output="signing.txt" append="true">
			<arg line="build.eclipse.org "cd ${stagingDirectory}; /usr/bin/sign ${stagingDirectory}/${archiveName} mail ${stagingDirectoryOutput}"" />
		</exec>

		<!--Wait for build to be available -->
		<antcall target="waitForChangedAttribs">
			<param name="sshline" value="build.eclipse.org "cd ${stagingDirectoryOutput};ls ${archiveName}"" />
		</antcall>

		<!--copy zip back to build machine -->
		<sleep minutes="2" />
		<echo message="copy zip back to build machine" />
		<exec dir="." executable="scp" output="signing.txt" append="true">
			<arg line="build.eclipse.org:${stagingDirectory}/${buildId}-out/${archiveName} ${buildDirectory}/${buildLabel}" />
		</exec>

		<!--delete files on build.eclipse.org-->
		<echo message="delete temp files on build.eclipse.org" />
		<exec dir="." executable="ssh" output="signing.txt" append="true">
			<arg line="build.eclipse.org "/bin/rm -rf ${stagingDirectory}/${buildId}-out ${stagingDirectory}/${archiveName}"" />
		</exec>
	</target>


	<target name="testEclipse">
		<parallel>
			<ant antfile="eclipse/helper.xml" target="testAll" />
		</parallel>
	</target>

	<target name="publishEclipse">
		<parallel>
			<ant antfile="eclipse/helper.xml" target="rSyncWithSnzZrh" />
			<sequential>
				<ant antfile="eclipse/helper.xml" target="buildStandAloneSWT" />
				<ant antfile="eclipse/helper.xml" target="publish" />
			</sequential>
		</parallel>
	</target>

	<target name="publishEquinox">
		<ant antfile="${equinox.build.configs}/../helper.xml" target="publish" />
	</target>

	<target name="unpackUpdateJarsForPackaging">
		<property name="tmpsite" value="${buildDirectory}/tmpsite" />
		<mkdir dir="${tmpsite}/new/eclipse/features" />
		<mkdir dir="${tmpsite}/new/eclipse/plugins" />
		<exec executable="unzip" dir="${buildDirectory}/${buildLabel}">
			<arg line="-q eclipse-master-${buildId}.zip -d ${tmpsite}" />
		</exec>
		<unpackUpdateJars site="${tmpsite}/eclipse" output="${tmpsite}/new/eclipse" />
		<exec executable="unzip" dir="${buildDirectory}/${buildLabel}">
			<arg line="-q eclipse-master-${buildId}.zip -d ${tmpsite}" />
		</exec>
		<move file="${buildDirectory}/${buildLabel}/eclipse-master-${buildId}.zip" tofile="${buildDirectory}/${buildLabel}/eclipse-master-${buildId}.bak.zip" />
		<exec executable="zip" dir="${tmpsite}/new">
			<arg line="-q ${buildDirectory}/${buildLabel}/eclipse-master-${buildId}.zip -r eclipse" />
		</exec>
	</target>


	<target name="packageEclipseDistributables">
		<replace token="@qualifier@" file="${eclipse.build.configs}/sdk/packager/sdk.product" value="${buildId}" />
		<replace token="@qualifier@" file="${eclipse.build.configs}/platform/packager/platform.product" value="${buildId}" />
		<replace token="@qualifier@" file="${eclipse.build.configs}/platform.sdk/packager/platform.product" value="${buildId}" />
		<delete dir="${repo}" />
		<mkdir dir="${repo}" />
		<delete dir="${reposource}" />
		<mkdir dir="${reposource}" />
		<copy todir="${reposource}" failonerror="false">
			<fileset file="${updateSite}/artifacts.*" />
			<fileset file="${updateSite}/content.*" />
		</copy>
		<unzip src="${buildDirectory}/${buildLabel}/eclipse-master-${buildId}.zip" dest="${reposource}" />

		<!-- 
		<move todir="${reposource}">
			<fileset dir="${reposource}/eclipse" />
		</move>
		<delete dir="${reposource}/eclipse" />

		<!--features and plugins metadata -->
		<p2.generator source="${reposource}" compress="true" append="true" flavor="tooling" metadataRepository="file:${repo}" artifactRepository="file:${repo}" publishArtifacts="true" p2OS="linux" mode="incremental" />

		<replace file="packaging.map" token="@buildId@" value="${buildId}" />
		<antcall target="package">
			<param name="packagingInfo" value="${eclipse.build.configs}/sdk/packager" />
		</antcall>
		<antcall target="package">
			<param name="packagingInfo" value="${eclipse.build.configs}/rcp.deltapack/packager" />
		</antcall>
		<antcall target="package">
			<param name="packagingInfo" value="${eclipse.build.configs}/sdk.examples/packager" />
		</antcall>
		<antcall target="package">
			<param name="packagingInfo" value="${eclipse.build.configs}/jdt/packager" />
		</antcall>
		<antcall target="package">
			<param name="packagingInfo" value="${eclipse.build.configs}/jdt.sdk/packager" />
		</antcall>
		<antcall target="package">
			<param name="packagingInfo" value="${eclipse.build.configs}/pde/packager" />
		</antcall>
		<antcall target="package">
			<param name="packagingInfo" value="${eclipse.build.configs}/pde.sdk/packager" />
		</antcall>
		<antcall target="package">
			<param name="packagingInfo" value="${eclipse.build.configs}/platform/packager" />
		</antcall>
		<antcall target="package">
			<param name="packagingInfo" value="${eclipse.build.configs}/platform.sdk/packager" />
		</antcall>
		<antcall target="package">
			<param name="packagingInfo" value="${eclipse.build.configs}/rcp/packager" />
		</antcall>
		<antcall target="package">
			<param name="packagingInfo" value="${eclipse.build.configs}/rcp.sdk/packager" />
		</antcall>
		<antcall target="package">
			<param name="packagingInfo" value="${eclipse.build.configs}/com.ibm.icu.base/packager" />
		</antcall>
		<antcall target="package">
			<param name="packagingInfo" value="${eclipse.build.configs}/releng.tools/packager" />
		</antcall>
		<antcall target="package">
			<param name="packagingInfo" value="${eclipse.build.configs}/cvsfeature/packager" />
		</antcall>
		<antcall target="package">
			<param name="packagingInfo" value="${eclipse.build.configs}/cvsfeature.sdk/packager" />
		</antcall>
	</target>

	<target name="packageEquinoxDistributables">
		<antcall target="package">
			<param name="packagingInfo" value="${equinox.build.configs}/equinox/packager" />
		</antcall>
		<antcall target="package">
			<param name="packagingInfo" value="${equinox.build.configs}/equinox.sdk/packager" />
		</antcall>
		<antcall target="package">
			<param name="packagingInfo" value="${equinox.build.configs}/master-equinox/packager" />
		</antcall>
		<ant antfile="build.xml" dir="${basedir}">
			<property name="component" value="${equinox.build.configs}/equinox-launchers" />
		</ant>
		<ant antfile="build.xml" dir="${basedir}">
			<property name="component" value="${equinox.build.configs}/equinox.jmx.common" />
		</ant>
		<ant antfile="build.xml" dir="${basedir}">
			<property name="component" value="${equinox.build.configs}/equinox.jmx.client" />
		</ant>
		<ant antfile="build.xml" dir="${basedir}">
			<property name="component" value="${equinox.build.configs}/equinox.jmx.server" />
		</ant>
		<antcall target="package">
			<param name="packagingInfo" value="${equinox.build.configs}/equinox.p2.agent.feature/packager" />
		</antcall>
		<antcall target="package">
			<param name="packagingInfo" value="${equinox.build.configs}/equinox.p2.director.feature/packager" />
		</antcall>
		<antcall target="package">
			<param name="packagingInfo" value="${equinox.build.configs}/equinox.p2.generator.feature/packager" />
		</antcall>		
		<!-- invoke equinox.p2.installer in a separate process -->
		<ant antfile="${equinox.build.configs}/../helper.xml" target="build.p2.installer.product" />
	</target>


	<target name="package">
		<ant antfile="package.xml" dir="${eclipse.pdebuild.scripts}">
			<property name="packagingInfo" value="${packagingInfo}" />
			<property name="assemblyTempDir" value="${packagingInfo}/jartmp" />
		</ant>
	</target>

	<target name="publishRSS" unless="skip.feed">
		<property name="rssproperties" value="feedPublish.eclipse.properties" />
		<property name="buildrssproperties" value="${postingDirectory}/${buildLabel}/${rssproperties}" />
		<copy file="${eclipse.build.configs}/../publishingFiles/templateFiles/${rssproperties}" tofile="${buildrssproperties}" failonerror="true" />
		<condition property="updateManagerURL" value="http://download.eclipse.org/eclipse/testUpdates">
			<equals arg1="${buildType}" arg2="I" />
		</condition>
		<replace file="${buildrssproperties}" token="@updateManagerURL@" value="updateManagerURL=${updateManagerURL}" />
		<replace file="${buildrssproperties}" token="@buildid@" value="${buildId}" />
		<replace file="${buildrssproperties}" token="@buildType@" value="${buildType}" />
		<condition property="feedFileValue" value="${base.builder}/plugins/org.eclipse.build.tools/data/builds-eclipse.xml">
			<equals arg1="${test}" arg2="true" />
		</condition>
		<condition property="feedFileValue" value="/builds/transfer/files/master/downloads/builds-eclipse-3.3.xml">
			<equals arg1="${buildType}" arg2="I" />
		</condition>
		<condition property="feedFileValue" value="/builds/transfer/files/master/downloads/builds-eclipse-N.xml">
			<equals arg1="${buildType}" arg2="N" />
		</condition>
		<replace file="${buildrssproperties}" token="@file@" value="file=${feedFileValue}" />
		<condition property="feedURL" value="http://download.eclipse.org/eclipse/downloads/builds-eclipse-test.xml">
			<equals arg1="${test}" arg2="true" />
		</condition>
		<condition property="feedURL" value="http://download.eclipse.org/eclipse/downloads/builds-eclipse-3.3.xml">
			<equals arg1="${buildType}" arg2="I" />
		</condition>
		<condition property="feedURL" value="http://download.eclipse.org/eclipse/downloads/builds-eclipse-N.xml">
			<equals arg1="${buildType}" arg2="N" />
		</condition>
		<replace file="${buildrssproperties}" token="@feedURL@" value="feedURL=${feedURL}" />
		<condition property="signStatus" value="SIGNED">
			<equals arg1="${sign}" arg2="true" />
		</condition>
		<property name="signStatus" value="UNSIGNED" />
		<replace file="${buildrssproperties}" token="@jarSigningStatus@" value="jarSigningStatus=${signStatus}" />
		<copy file="${buildrssproperties}" tofile="${base.builder}/plugins/org.eclipse.build.tools/properties/${rssproperties}" overwrite="true" failonerror="true" />
	</target>

</project>
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.