blob: d2350404149e007c75f9fd2696f82717326cda20 [file] [log] [blame]
<?xml version="1.0"?>
<!--
Copyright (c) 2010 Stephan Herrmann and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
Contributors:
Stephan Herrmann - initial API and implementation
-->
<project name="Main Object Teams Build and Test Automation" default="INFO">
<target name="showGivenProperties"
description="Show values of all properties that should be passed from our caller.">
<echo>Properties passed into this script:
------------------------------------------------------------------------------
path of boot eclipse SDK:
eclipse-boot.tgz = ${eclipse-boot.tgz}
path of base eclipse SDK:
eclipse-app.tgz = ${eclipse-app.tgz}
eclipse SDK build qualifier:
eclipse.sdk.qualifier = ${eclipse.sdk.qualifier}
path of eclipse test framework:
eclipse.tests.zip= ${eclipse.tests.zip}
path of published updates:
published.updates= ${published.updates}
should sources be built (true|false)?
do.build.all = ${do.build.all}
should test be run (true|false)?
do.run.tests = ${do.run.tests}
directory for tempory files during testing:
test.tmpDir = ${test.tmpDir}
git working area
fetchCacheLocation = ${fetchCacheLocation}
path to map file (with substitutions):
map.file.path = ${map.file.path}
------------------------------------------------------------------------------
</echo>
</target>
<target name="setupProperties" depends="showGivenProperties">
<dirname property="_toplevelDir" file="${ant.file}"/>
<!-- main configuration file (version dependent names etc.): -->
<loadproperties srcfile="${_toplevelDir}/run.properties" />
<!-- ======== Directories (indentation shows structure): ======== -->
<!-- build scripts: -->
<property name="OTScriptDir" value="${_toplevelDir}" />
<property name="buildfile" value="${OTScriptDir}/build.xml" />
<property name="builder-otcompiler" value="${OTScriptDir}/OT-Compiler" />
<property name="builder-otdt" value="${OTScriptDir}/OTDT-Build" />
<!-- directories for testing: -->
<property name="test.root.dir" value="${user.dir}/test-root" />
<!-- This name is used in individual test.xml of test plugins: -->
<property name="test.eclipseDir" value="${test.root.dir}/eclipse" />
<!-- directories for the build: -->
<property name="build.root.dir" value="${user.dir}/build-root" />
<!-- These names are hard coded in pde-build: -->
<property name="buildDirectory" value="${build.root.dir}/src" />
<property name="bootLocation" value="${build.root.dir}/eclipse" />
<property name="baseLocation" value="${test.eclipseDir}" />
<!-- directories for update sites: -->
<!-- TODO: extract compilerUpdatesDir to prerequisistes? -->
<property name="compilerUpdatesDir" value="http://download.eclipse.org/objectteams/updates/ot2.7/compiler"/>
<property name="otdtUpdatesDir" value="${user.dir}/updateSite"/>
<property name="testsUpdatesDirBase" value="${user.dir}/updateSiteTests"/>
<!-- will have sub directories "eclipse" and "otdt" -->
<!-- ======== Insert SDK build qualifier into our configuration files: ======== -->
<copy file="${map.file.path}.in" tofile="${map.file.path}">
<filterset>
<filter token="SDK_QUALIFIER" value="${eclipse.sdk.qualifier}"/>
</filterset>
</copy>
<!-- Insert SDK build qualifier into our configuration file: -->
<copy file="${OTScriptDir}/test.properties.in" tofile="${OTScriptDir}/test.properties" overwrite="true">
<filterset>
<filter token="SDK_QUALIFIER" value="${eclipse.sdk.qualifier}"/>
</filterset>
</copy>
<!-- versions of test plugins: -->
<loadproperties srcfile="${OTScriptDir}/test.properties" />
<!-- ======== More Configuration Details: ======== -->
<!-- maybe obsolete: file prefix to distinguish output files. -->
<property name="file-id" value="XXX" />
<!-- Configure Java for STAGE 1 and STAGE 2 building: -->
<property name="vm" value="java" />
<property name="vm.args" value="-Xmx912m" />
<property name="installmode" value="clean" />
<property name="saxon.jar.name" value="saxon8.jar" />
<property name="saxon.jar.path" value="${user.home}/.ant/lib/${saxon.jar.name}" />
<available file="${saxon.jar.path}" property="_hasSaxon.jar" /> <!-- on HIPP this is set to true by the caller -->
<!-- ant's os.arch is slightly different than osgi's arch -->
<condition property="arch" value="x86_64"> <!-- HACK: hard coding 64-bit architecture -->
<os arch="i386" />
</condition>
<condition property="arch" value="ppc64"> <!-- HACK: hard coding 64-bit architecture -->
<os arch="ppc" />
</condition>
<condition property="arch" value="x86_64"> <!-- Map ant's arch to OSGi arch -->
<os arch="amd64" />
</condition>
<!-- if not set above, set it to os.arch -->
<property name="arch" value="${os.arch}" />
</target>
<target name="INFO">
<echo>Usage:
ant -f run.xml ot-junit-all -> runs OTDT Build and Testprocess
ant -f run.xml ot-junit-otdt -> runs OTDT Build and Testprocess excluding jdt tests
ant -f run.xml ot-junit-build -> runs just OTDT Buildprocess
ant -f run.xml ot-compiler-build -> just build the compiler
ant -f run.xml ot-junit-run -> runs just OTDT Tests w/o TestSetup
</echo>
</target>
<target name="ot-junit-all" depends="setupProperties,checkOS" description="Build all and run all tests.">
<echo message="Starting BuildProcess and Testrun in ${build.root.dir}"/>
<antcall target="verifyAntInstall"/>
<antcall target="setupTests" />
<antcall target="runAllTests"/>
</target>
<target name="ot-junit-otdt" depends="setupProperties,checkOS" description="Build all and run otdt tests.">
<echo message="Starting BuildProcess and Testrun in ${build.root.dir}"/>
<antcall target="verifyAntInstall"/>
<antcall target="setupTests" />
<antcall target="runOTDTTests"/>
</target>
<target name="ot-junit-build" depends="setupProperties,checkOS" description="build everything without running tests">
<echo message="Starting BuildProcess in ${build.root.dir}"/>
<antcall target="verifyAntInstall"/>
<antcall target="createOTDTEclipse"/>
<antcall target="setupTests" />
</target>
<target name="ot-compiler-build" depends="setupProperties,checkOS" description="build only the compiler (for debugging the build)">
<echo message="Starting BuildProcess in ${build.root.dir}"/>
<antcall target="verifyAntInstall"/>
<antcall target="createOTCompilerEclipse"/>
</target>
<target name="ot-junit-run" depends="setupProperties,checkOS" description="Run tests without building">
<echo message="Starting Testrun ${test.root.dir}"/>
<antcall target="runAllTests" />
</target>
<target name="ot-junit-run-ot" depends="setupProperties,checkOS" description="Run OT tests without building">
<echo message="Starting Testrun ${test.root.dir}"/>
<antcall target="runOTDTTests" />
</target>
<target name="ot-junit-run-onlyone" depends="setupProperties,checkOS" description="Run OT tests without building">
<echo message="Starting Testrun ${test.root.dir}"/>
<antcall target="setupTests" />
<antcall target="runOnlyoneTests" />
</target>
<!-- =================== END Public Targets ==================== -->
<!-- === Setup Targets: === -->
<target name="verifyAntInstall" unless="_hasSaxon.jar">
<copy failonerror="true" overwrite="false" file="${OTScriptDir}/${saxon.jar.name}" tofile="${saxon.jar.path}"></copy>
<echo message="Needed to copy saxon8.jar to ${saxon.jar.path}. Please restart the build." />
<echo message="For an explanation, see http://ant.apache.org/faq.html#delegating-classloader-1.6" />
<fail message="See above. Please restart the build."/>
</target>
<!-- checks on which os ant is run, set ${os} and ${ws} accordingly -->
<target name="determineOS">
<condition property="os.isWindows">
<os family="windows"/>
</condition>
<condition property="os.isLinux">
<os name="Linux" />
</condition>
</target>
<target name="checkOS" depends="determineOS,windows,linux"/>
<target name="windows" if="os.isWindows">
<echo message="OS is Windows"/>
<property name="os" value="win32" />
<property name="ws" value="win32" />
</target>
<target name="linux" unless="os.isWindows" >
<echo message="OS is Linux"/>
<!-- eclipse-app.tgz is already passed from the calling script -->
<property name="os" value="linux" />
<property name="ws" value="gtk" />
</target>
<target name="setupForCompile" depends="checkOS" unless="_hasCreatedOTDTEclipse">
<antcall target="UnzipEclipse"/>
<antcall target="AddPluginsToEclipse"/>
</target>
<target name="UnzipEclipse">
<echo message="Extracting Boot Eclipse (${eclipse-boot.tgz}) in ${build.root.dir}..."/>
<mkdir dir="${build.root.dir}"/>
<untar compression="gzip" src="${eclipse-boot.tgz}" dest="${build.root.dir}"/>
<mkdir dir="${test.root.dir}"/>
<untar compression="gzip" src="${eclipse-app.tgz}" dest="${test.root.dir}"/>
</target>
<target name="AddPluginsToEclipse" description="Add git.pde.build plugins to the boot Eclipse">
<mkdir dir="${bootLocation}/dropins/plugins"/>
<copy file="${OTScriptDir}/lib/${git.pde.build}" todir="${bootLocation}/dropins/plugins" />
</target>
<!-- ==== BUILDING AND RUNNING: ==== -->
<!-- ==== BUILD STAGE 1: ==== -->
<!-- setting an empty inputstring is a workaround for http://issues.apache.org/bugzilla/show_bug.cgi?id=34461 -->
<target name="createOTCompilerEclipse" depends="setupForCompile" description="create the bootstrapping Eclipse with OT/J compiler">
<echo message="Invoke pdebuild for creating the OT-Compiler"/>
<!-- Re-use the compiler from the previous published build: -->
<ant antfile="${OTScriptDir}/p2helper.xml" target="installFeatureFromUrl" dir="${bootLocation}">
<property name="feature" value="org.eclipse.objectteams.otdt.core.patch.feature.group"/>
<property name="sourceUpdatesUrl" value="${compilerUpdatesDir}"/>
<property name="targetEclipseDir" value="${bootLocation}"/>
<property name="org.eclipse.equinox.launcher_jar" value="${boot.org.eclipse.equinox.launcher_jar}"/>
</ant>
<delete>
<fileset dir="${bootLocation}/plugins/" includes="org.eclipse.jdt.core_*.v* org.eclipse.jdt.core.source_*.v*" />
<fileset dir="${baseLocation}/plugins/" includes="org.eclipse.jdt.core_*.v* org.eclipse.jdt.core.source_*.v*" />
</delete>
</target>
<!-- ==== BUILD STAGE 2: ==== -->
<!-- setting an empty inputstring is a workaround for http://issues.apache.org/bugzilla/show_bug.cgi?id=34461 -->
<target name="createOTDTEclipse" depends="createOTCompilerEclipse" unless="_hasCreatedOTDTEclipse">
<!-- Make org.eclipse.test.performance available while compiling test projects: -->
<echo message="Pre-installing Eclipse Test Framework into OTCompilerEclipse..."/>
<mkdir dir="${testsUpdatesDirBase}/eclipse"/>
<unzip dest="${testsUpdatesDirBase}/eclipse" src="${eclipse.tests.zip}"/>
<ant antfile="${OTScriptDir}/p2helper.xml" target="installFeature" dir="${baseLocation}">
<property name="feature" value="org.eclipse.test.feature.group"/>
<property name="sourceUpdatesDir" value="${testsUpdatesDirBase}/eclipse"/>
<property name="targetEclipseDir" value="${baseLocation}"/>
</ant>
<!-- pre-load updateSite with published releases: -->
<mkdir dir="${otdtUpdatesDir}/plugins"/>
<mkdir dir="${otdtUpdatesDir}/features"/>
<!-- don't use previous artifacts during the transition to OTDRE:
<exec executable="/bin/sh">
<arg value="-c"/>
<arg value="ln -s ${published.updates}/features/* ${otdtUpdatesDir}/features/"/>
</exec>
<exec executable="/bin/sh">
<arg value="-c"/>
<arg value="ln -s ${published.updates}/plugins/* ${otdtUpdatesDir}/plugins/"/>
</exec>
-->
<!-- pre-load category-less metadata: -->
<!--
<copy failonerror="false" flatten="true" toDir="${otdtUpdatesDir}">
<fileset dir="${user.dir}/metadata">
<include name="*.xml"/>
</fileset>
</copy>
-->
<echo message="Invoke pdebuild for creating a full OTDT"/>
<java
inputstring=""
dir="${bootLocation}"
fork="true"
classname="org.eclipse.equinox.launcher.Main"
classpath="${bootLocation}/plugins/${org.eclipse.equinox.launcher_jar}">
<arg value="-clean"/>
<arg value="-Dosgi.ws=${ws}"/>
<arg value="-Dosgi.os=${os}"/>
<arg value="-Dosgi.arch=${arch}"/>
<arg value="-application"/>
<arg value="org.eclipse.ant.core.antRunner"/>
<arg value="-buildfile"/>
<arg value="${buildfile}"/>
<arg value="-Dbuild.root.dir=${build.root.dir}"/>
<arg value="-DbootLocation=${bootLocation}"/>
<arg value="-DbaseLocation=${baseLocation}"/>
<arg value="-DtransformedRepoLocation=${baseLocation}"/> <!-- fetch jars into target -->
<arg value="-Drun.eclipseScriptDir=${run.eclipseScriptDir}"/>
<arg value="-DOTScriptDir=${OTScriptDir}"/>
<arg value="-Dbuilder=${builder-otdt}"/>
<arg value="-D${installmode}=true"/>
<arg value="-Dcomponent.short=OTDT-Build"/>
<arg value="-DotdtUpdatesDir=${otdtUpdatesDir}"/>
<arg value="-DtestsUpdatesDirBase=${testsUpdatesDirBase}"/>
<arg value="-Dbaseos=${os}"/>
<arg value="-Dbasews=${ws}"/>
<arg value="-Dbasearch=${arch}"/>
<arg value="-Dtest.root.dir=${test.root.dir}"/>
<arg value="-Dtest.eclipseDir=${test.eclipseDir}"/>
<arg value="-DmapVersionTag=${mapVersionTag}"/>
<arg value="-Dmap.file.path=${map.file.path}"/>
<arg value="-DfetchCacheLocation=${fetchCacheLocation}"/>
<arg value="-Ddo.run.tests=${do.run.tests}"/>
<arg value="-Ddo.build.all=${do.build.all}"/>
<arg value="-Declipse-app.tgz=${eclipse-app.tgz}"/>
<arg value="-Declipse.tests.zip=${eclipse.tests.zip}"/>
<arg value="-Djdt.compiler.apt=${jdt.compiler.apt}"/>
<arg value="-Djdt.compiler.tool=${jdt.compiler.tool}"/>
<!--arg value="-verbose" /-->
<jvmarg value="${vm.args}"/>
<!-- arg value="${verboseAnt}"/ -->
<!-- arg value="-debug" / -->
</java>
<!-- At this point a local update site exists, thanks to p2gathering=true -->
<ant antfile="${OTScriptDir}/p2helper.xml" target="patchMetadata" dir="${otdtUpdatesDir}"/>
<property name="_hasCreatedOTDTEclipse" value="true" />
</target>
<!-- TESTING at STAGE 3: -->
<target name="setupTests" depends="createOTDTEclipse" description="Install the tests into an fresh OTDT">
<available file="${buildDirectory}/label.properties" property="label.properties.exists" />
<ant antfile="${OTScriptDir}/test.xml" target="setupTests" dir="${build.root.dir}">
<property name="os" value="${os}" />
<property name="ws" value="${ws}" />
<property name="arch" value="${arch}" />
<property name="baseos" value="${os}" />
<property name="basews" value="${ws}" />
<property name="basearch" value="${arch}" />
<property name="eclipse-app.tgz" value="${eclipse-app.tgz}" />
<property file="${buildDirectory}/label.properties" />
<property name="otdtUpdatesDir" value="${otdtUpdatesDir}" />
<property name="testsUpdatesDirBase" value="${testsUpdatesDirBase}" />
</ant>
</target>
<target name="runAllTests" description="Delegate to the next level script to perform the actual testing.">
<ant antfile="${OTScriptDir}/test.xml" target="all" dir="${build.root.dir}">
<property name="os" value="${os}" />
<property name="ws" value="${ws}" />
<property name="arch" value="${arch}" />
<property name="baseos" value="${os}" />
<property name="basews" value="${ws}" />
<property name="basearch" value="${arch}" />
<property name="otdtUpdatesDir" value="${otdtUpdatesDir}" />
<property name="testsUpdatesDirBase" value="${testsUpdatesDirBase}" />
<property name="test.tmpDir" value="${test.tmpDir}"/>
<property name="vmargs" value="${vmargs}" />
</ant>
</target>
<target name="runOTDTTests" description="Delegate to the next level script to perform the actual testing.">
<ant antfile="${OTScriptDir}/test.xml" target="otdt-tests" dir="${build.root.dir}">
<property name="os" value="${os}" />
<property name="ws" value="${ws}" />
<property name="arch" value="${arch}" />
<property name="baseos" value="${os}" />
<property name="basews" value="${ws}" />
<property name="basearch" value="${arch}" />
<property name="otdtUpdatesDir" value="${otdtUpdatesDir}" />
<property name="testsUpdatesDirBase" value="${testsUpdatesDirBase}" />
<property name="test.tmpDir" value="${test.tmpDir}"/>
<property name="vmargs" value="${vmargs}" />
</ant>
</target>
<target name="runOnlyoneTests" description="Delegate to the next level script to perform the actual testing.">
<ant antfile="${OTScriptDir}/test.xml" target="onlyone" dir="${build.root.dir}">
<property name="os" value="${os}" />
<property name="ws" value="${ws}" />
<property name="arch" value="${arch}" />
<property name="baseos" value="${os}" />
<property name="basews" value="${ws}" />
<property name="basearch" value="${arch}" />
<property name="otdtUpdatesDir" value="${otdtUpdatesDir}" />
<property name="testsUpdatesDirBase" value="${testsUpdatesDirBase}" />
<property name="test.tmpDir" value="${test.tmpDir}"/>
<property name="vmargs" value="${vmargs}" />
</ant>
</target>
<!-- currently unused target name="collectResults">
<ant target="collect" antfile="${test.root.dir}/library.xml" dir="${otresults}">
<property name="includes" value="org.*.xml"/>
<property name="output-file" value="AllTestSuites.xml"/>
</ant>
</target -->
</project>