blob: 2d9048820a1792856736d83253113d7401ab8b87 [file] [log] [blame]
Stephan Herrmanndcd87c12010-04-25 10:59:27 +00001<?xml version="1.0"?>
2<!--
3 Copyright (c) 2010 Stephan Herrmann and others.
4 All rights reserved. This program and the accompanying materials
5 are made available under the terms of the Eclipse Public License v1.0
6 which accompanies this distribution, and is available at
7 http://www.eclipse.org/legal/epl-v10.html
8
9 Contributors:
10 Stephan Herrmann - initial API and implementation
11-->
12<project name="Main Object Teams Build and Test Automation" default="INFO">
13
14 <target name="showGivenProperties"
15 description="Show values of all properties that should be passed from our caller.">
16 <echo>Properties passed into this script:
17------------------------------------------------------------------------------
18path of eclipse SDK:
19 eclipse-app.tgz = ${eclipse-app.tgz}
20path of eclipse test framework:
Stephan Herrmann8372dc22010-06-03 22:41:05 +000021 eclipse.tests.zip= ${eclipse.tests.zip}
22path of published updates:
23 published.updates= ${published.updates}
Stephan Herrmanndcd87c12010-04-25 10:59:27 +000024should sources be built (true|false)?
25 do.build.all = ${do.build.all}
26should test be run (true|false)?
27 do.run.tests = ${do.run.tests}
28------------------------------------------------------------------------------
29 </echo>
30 </target>
31
32 <target name="setupProperties" depends="showGivenProperties">
33
34 <dirname property="_toplevelDir" file="${ant.file}"/>
35
36 <!-- main configuration file (version dependent names etc.): -->
37 <loadproperties srcfile="${_toplevelDir}/run.properties" />
38
39 <!-- versions of test plugins, also find org.eclipse.test here: -->
40 <loadproperties srcfile="${_toplevelDir}/test.properties" />
41
42 <!-- ======== Directories (indentation shows structure): ======== -->
43 <!-- build scripts: -->
44 <property name="OTScriptDir" value="${_toplevelDir}" />
45 <property name="buildfile" value="${OTScriptDir}/build.xml" />
46 <property name="builder-otcompiler" value="${OTScriptDir}/OT-Compiler" />
47 <property name="builder-otdt" value="${OTScriptDir}/OTDT-Build" />
48
49 <!-- directories for the build: -->
50 <property name="build.root.dir" value="${user.dir}/build-root" />
Stephan Herrmann33c26042010-06-03 10:24:16 +000051 <!-- These names are hard coded in pde-build: -->
52 <property name="buildDirectory" value="${build.root.dir}/src" />
Stephan Herrmann33c26042010-06-03 10:24:16 +000053 <property name="baseLocation" value="${build.root.dir}/eclipse" />
Stephan Herrmanndcd87c12010-04-25 10:59:27 +000054
55 <!-- directories for testing: -->
56 <property name="test.root.dir" value="${user.dir}/test-root" />
57 <!-- This name is used in individual test.xml of test plugins: -->
58 <property name="test.eclipseDir" value="${test.root.dir}/eclipse" />
59
60 <!-- directories for update sites: -->
61 <property name="otdtUpdatesDir" value="${user.dir}/updateSite"/>
62 <property name="testsUpdatesDirBase" value="${user.dir}/updateSiteTests"/>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +000063 <!-- will have sub directories "eclipse" and "otdt" -->
Stephan Herrmanndcd87c12010-04-25 10:59:27 +000064
65 <!-- ======== More Configuration Details: ======== -->
66 <!-- maybe obsolete: file prefix to distinguish output files. -->
67 <property name="file-id" value="XXX" />
68
69 <!-- Configure Java for STAGE 1 and STAGE 2 building: -->
70 <property name="vm" value="java" />
71 <property name="vm.args" value="-Xmx912m" />
72 <property name="vm.args2" value="-XX:MaxPermSize=128m" />
73
74 <property name="installmode" value="clean" />
75
76 <property name="saxon.jar.name" value="saxon8.jar" />
77 <property name="saxon.jar.path" value="${user.home}/.ant/lib/${saxon.jar.name}" />
78 <available file="${saxon.jar.path}" property="_hasSaxon.jar" />
79
80 <!-- ant's os.arch is slightly different than osgi's arch -->
Stephan Herrmann1a9d85a2010-05-17 22:45:31 +000081 <condition property="arch" value="x86_64"> <!-- HACK: hard coding 64-bit architecture -->
Stephan Herrmanndcd87c12010-04-25 10:59:27 +000082 <os arch="i386" />
83 </condition>
84 <condition property="arch" value="ppc64"> <!-- HACK: hard coding 64-bit architecture -->
85 <os arch="ppc" />
86 </condition>
Stephan Herrmann005fc312010-05-18 12:52:58 +000087 <condition property="arch" value="x86_64"> <!-- Map ant's arch to OSGi arch -->
88 <os arch="amd64" />
89 </condition>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +000090 <!-- if not set above, set it to os.arch -->
91 <property name="arch" value="${os.arch}" />
92
93 </target>
94
95
96 <target name="INFO">
97 <echo>Usage:
98 ant -f run.xml ot-junit-all -> runs OTDT Build and Testprocess
Stephan Herrmannd8c81652010-11-06 15:01:14 +000099 ant -f run.xml ot-junit-otdt -> runs OTDT Build and Testprocess excluding jdt tests
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000100 ant -f run.xml ot-junit-build -> runs just OTDT Buildprocess
101 ant -f run.xml ot-junit-run -> runs just OTDT Tests w/o TestSetup
102 </echo>
103 </target>
104
105 <target name="ot-junit-all" depends="setupProperties,checkOS" description="Build all and run all tests.">
106 <echo message="Starting BuildProcess and Testrun in ${build.root.dir}"/>
107 <antcall target="verifyAntInstall"/>
108 <antcall target="setupTests" />
109 <antcall target="runAllTests"/>
110 </target>
111
Stephan Herrmannd8c81652010-11-06 15:01:14 +0000112 <target name="ot-junit-otdt" depends="setupProperties,checkOS" description="Build all and run otdt tests.">
113 <echo message="Starting BuildProcess and Testrun in ${build.root.dir}"/>
114 <antcall target="verifyAntInstall"/>
115 <antcall target="setupTests" />
116 <antcall target="runOTDTTests"/>
117 </target>
118
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000119 <target name="ot-junit-build" depends="setupProperties,checkOS" description="build everything without running tests">
120 <echo message="Starting BuildProcess in ${build.root.dir}"/>
121 <antcall target="verifyAntInstall"/>
122 <antcall target="createOTDTEclipse"/>
123 </target>
124
125 <target name="ot-junit-run" depends="setupProperties,checkOS" description="Run tests without building">
126 <echo message="Starting Testrun ${test.root.dir}"/>
127 <antcall target="runAllTests" />
128 </target>
129
130 <!-- =================== END Public Targets ==================== -->
131
132 <!-- === Setup Targets: === -->
133
134 <target name="verifyAntInstall" unless="_hasSaxon.jar">
135 <copy failonerror="true" overwrite="false" file="${OTScriptDir}/${saxon.jar.name}" tofile="${saxon.jar.path}"></copy>
136 <echo message="Needed to copy saxon8.jar to ${saxon.jar.path}. Please restart the build." />
137 <echo message="For an explanation, see http://ant.apache.org/faq.html#delegating-classloader-1.6" />
138 <fail message="See above. Please restart the build."/>
139 </target>
140
141 <!-- checks on which os ant is run, set ${os} and ${ws} accordingly -->
142 <target name="determineOS">
143 <condition property="os.isWindows">
144 <os family="windows"/>
145 </condition>
146
147 <condition property="os.isLinux">
148 <os name="Linux" />
149 </condition>
150 </target>
151
152 <target name="checkOS" depends="determineOS,windows,linux"/>
153
154 <target name="windows" if="os.isWindows">
155 <echo message="OS is Windows"/>
156 <property name="os" value="win32" />
157 <property name="ws" value="win32" />
158 </target>
159
160 <target name="linux" unless="os.isWindows" >
161 <echo message="OS is Linux"/>
162 <!-- eclipse-app.tgz is already passed from the calling script -->
163 <property name="os" value="linux" />
164 <property name="ws" value="gtk" />
165 </target>
166
167 <target name="setupForCompile" depends="checkOS" unless="_hasCreatedOTDTEclipse">
168 <antcall target="UnzipEclipse"/>
169 <antcall target="AddPluginsToEclipse"/>
170 </target>
171
172 <target name="UnzipEclipse">
173 <echo message="Extracting Eclipse (${eclipse-app.tgz}) in ${build.root.dir}..."/>
174 <mkdir dir="${build.root.dir}"/>
175 <untar compression="gzip" src="${eclipse-app.tgz}" dest="${build.root.dir}"/>
176 </target>
177
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000178 <target name="AddPluginsToEclipse" description="Add svn.pde.build plugin to the base Eclipse">
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000179 <mkdir dir="${baseLocation}/dropins/plugins"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000180 <copy file="${OTScriptDir}/lib/${svn.pde.build}" todir="${baseLocation}/dropins/plugins" />
181 </target>
182
183 <!-- ==== BUILDING AND RUNNING: ==== -->
184
185 <!-- ==== BUILD STAGE 1: ==== -->
186 <!-- setting an empty inputstring is a workaround for http://issues.apache.org/bugzilla/show_bug.cgi?id=34461 -->
187 <target name="createOTCompilerEclipse" depends="setupForCompile" description="create the bootstrapping Eclipse with OT/J compiler">
188 <echo message="Invoke pdebuild for creating the OT-Compiler"/>
189 <java
190 inputstring=""
191 dir="${baseLocation}"
192 fork="true"
193 classname="org.eclipse.equinox.launcher.Main"
194 classpath="${baseLocation}/plugins/${org.eclipse.equinox.launcher_jar}">
195 <arg value="-Dosgi.ws=${ws}"/>
196 <arg value="-Dosgi.os=${os}"/>
197 <arg value="-Dosgi.arch=${arch}"/>
198 <arg value="-application"/>
199 <arg value="org.eclipse.ant.core.antRunner"/>
200 <arg value="-buildfile"/>
201 <arg value="${buildfile}"/>
202 <arg value="-Dbuild.root.dir=${build.root.dir}"/>
203 <arg value="-DbaseLocation=${baseLocation}"/>
204 <arg value="-DOTScriptDir=${OTScriptDir}"/>
205 <arg value="-Drun.eclipseScriptDir=${run.eclipseScriptDir}"/>
206 <arg value="-Dbuilder=${builder-otcompiler}"/>
207 <arg value="-D${installmode}=true"/> <!-- <- obsolete? -->
208 <arg value="-Dcomponent.short=OT-Compiler"/>
209 <arg value="-Dconfigs=*,*,*"/>
210 <arg value="-Dbaseos=${os}"/>
211 <arg value="-Dbasews=${ws}"/>
212 <arg value="-Dbasearch=${arch}"/>
213 <arg value="-Dtest.root.dir=${test.root.dir}"/>
214 <arg value="-Dtest.eclipseDir=${test.eclipseDir}"/>
215 <arg value="-DmapVersionTag=${mapVersionTag}"/>
216 <arg value="-DpathToMapFile=${pathToMapFile}"/>
217 <arg value="-DmapFileName=ot-compiler.map"/>
218 <arg value="-Dsvn.repository.url=${svn.repository.url}"/>
219 <arg value="-Declipse-app.tgz=${eclipse-app.tgz}"/>
220 <arg value="-Declipse.tests.zip=${eclipse.tests.zip}"/>
Stephan Herrmanneacdfde2010-08-25 05:58:42 +0000221 <!--arg value="-verbose" /-->
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000222 <jvmarg value="${vm.args}"/>
223 <jvmarg value="${vm.args2}"/>
224 </java>
225 <!-- At this point a zip file containing the new jdt.core-plugin exists in
226 ${build.root.dir}/org.eclipse.objectteams.otdt-${buildId}.zip
227 which has already been installed into ${baseLocation} as to replace the
228 original plugin jar of exact same name (see OT-Compiler/customTargets.xml#postBuild)..
229 -->
230 </target>
231
232 <!-- ==== BUILD STAGE 2: ==== -->
233 <!-- setting an empty inputstring is a workaround for http://issues.apache.org/bugzilla/show_bug.cgi?id=34461 -->
234 <target name="createOTDTEclipse" depends="createOTCompilerEclipse" unless="_hasCreatedOTDTEclipse">
235
236 <!-- Make org.eclipse.test.performance available while compiling test projects: -->
237 <echo message="Pre-installing Eclipse Test Framework into OTCompilerEclipse..."/>
Stephan Herrmann67cbf1c2010-09-26 09:59:15 +0000238 <mkdir dir="${testsUpdatesDirBase}/eclipse"/>
239 <unzip dest="${testsUpdatesDirBase}/eclipse" src="${eclipse.tests.zip}"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000240 <ant antfile="${OTScriptDir}/p2helper.xml" target="installFeature" dir="${baseLocation}">
241 <property name="feature" value="org.eclipse.test.feature.group"/>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000242 <property name="sourceUpdatesDir" value="${testsUpdatesDirBase}/eclipse"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000243 <property name="targetEclipseDir" value="${baseLocation}"/>
244 </ant>
Stephan Herrmann8372dc22010-06-03 22:41:05 +0000245
246 <!-- pre-load updateSite with published releases: -->
Stephan Herrmann0c9b5722010-06-04 22:13:03 +0000247 <mkdir dir="${otdtUpdatesDir}/plugins"/>
248 <mkdir dir="${otdtUpdatesDir}/features"/>
249 <exec executable="/bin/sh">
250 <arg value="-c"/>
251 <arg value="ln -s ${published.updates}/features/* ${otdtUpdatesDir}/features/"/>
252 </exec>
253 <exec executable="/bin/sh">
254 <arg value="-c"/>
255 <arg value="ln -s ${published.updates}/plugins/* ${otdtUpdatesDir}/plugins/"/>
256 </exec>
Stephan Herrmann8372dc22010-06-03 22:41:05 +0000257 <!-- pre-load category-less metadata: -->
258 <copy failonerror="false" flatten="true" toDir="${otdtUpdatesDir}">
259 <fileset dir="${user.dir}/metadata">
260 <include name="*.xml"/>
261 </fileset>
262 </copy>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000263
264 <echo message="Invoke pdebuild for creating a full OTDT"/>
265 <java
266 inputstring=""
267 dir="${baseLocation}"
268 fork="true"
269 classname="org.eclipse.equinox.launcher.Main"
270 classpath="${baseLocation}/plugins/${org.eclipse.equinox.launcher_jar}">
271 <arg value="-clean"/>
272 <arg value="-Dosgi.ws=${ws}"/>
273 <arg value="-Dosgi.os=${os}"/>
274 <arg value="-Dosgi.arch=${arch}"/>
275 <arg value="-application"/>
276 <arg value="org.eclipse.ant.core.antRunner"/>
277 <arg value="-buildfile"/>
278 <arg value="${buildfile}"/>
279 <arg value="-Dbuild.root.dir=${build.root.dir}"/>
280 <arg value="-DbaseLocation=${baseLocation}"/>
281 <arg value="-Drun.eclipseScriptDir=${run.eclipseScriptDir}"/>
282 <arg value="-DOTScriptDir=${OTScriptDir}"/>
283 <arg value="-Dbuilder=${builder-otdt}"/>
284 <arg value="-D${installmode}=true"/>
285 <arg value="-Dcomponent.short=OTDT-Build"/>
286 <arg value="-DotdtUpdatesDir=${otdtUpdatesDir}"/>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000287 <arg value="-DtestsUpdatesDirBase=${testsUpdatesDirBase}"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000288 <arg value="-Dbaseos=${os}"/>
289 <arg value="-Dbasews=${ws}"/>
290 <arg value="-Dbasearch=${arch}"/>
291 <arg value="-Dtest.root.dir=${test.root.dir}"/>
292 <arg value="-Dtest.eclipseDir=${test.eclipseDir}"/>
293 <arg value="-Dsvn.repository.url=${svn.repository.url}"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000294 <arg value="-DmapVersionTag=${mapVersionTag}"/>
295 <arg value="-DpathToMapFile=${pathToMapFile}"/>
296 <arg value="-DmapFileName=otdt.map"/>
297 <arg value="-Ddo.run.tests=${do.run.tests}"/>
298 <arg value="-Ddo.build.all=${do.build.all}"/>
299 <arg value="-Declipse-app.tgz=${eclipse-app.tgz}"/>
300 <arg value="-Declipse.tests.zip=${eclipse.tests.zip}"/>
Stephan Herrmanneacdfde2010-08-25 05:58:42 +0000301 <!--arg value="-verbose" /-->
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000302 <jvmarg value="${vm.args}"/>
303 <jvmarg value="${vm.args2}"/>
304 <!-- arg value="${verboseAnt}"/ -->
305 <!-- arg value="-debug" / -->
306 </java>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000307 <!-- At this point a local update site exists, thanks to p2gathering=true -->
Stephan Herrmann99e184d2010-06-11 17:27:25 +0000308
309 <ant antfile="${OTScriptDir}/p2helper.xml" target="patchMetadata" dir="${otdtUpdatesDir}"/>
310
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000311 <property name="_hasCreatedOTDTEclipse" value="true" />
312 </target>
313
314 <!-- TESTING at STAGE 3: -->
315 <target name="setupTests" depends="createOTDTEclipse" description="Install the tests into an fresh OTDT">
316 <available file="${buildDirectory}/label.properties" property="label.properties.exists" />
317 <ant antfile="${OTScriptDir}/test.xml" target="setupTests" dir="${build.root.dir}">
318 <property name="os" value="${os}" />
319 <property name="ws" value="${ws}" />
320 <property name="arch" value="${arch}" />
321 <property name="baseos" value="${os}" />
322 <property name="basews" value="${ws}" />
323 <property name="basearch" value="${arch}" />
324 <property name="eclipse-app.tgz" value="${eclipse-app.tgz}" />
325 <property file="${buildDirectory}/label.properties" />
326 <property name="otdtUpdatesDir" value="${otdtUpdatesDir}" />
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000327 <property name="testsUpdatesDirBase" value="${testsUpdatesDirBase}" />
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000328 </ant>
329 </target>
330
331 <target name="runAllTests" description="Delegate to the next level script to perform the actual testing.">
332 <ant antfile="${OTScriptDir}/test.xml" target="all" dir="${build.root.dir}">
333 <property name="os" value="${os}" />
334 <property name="ws" value="${ws}" />
335 <property name="arch" value="${arch}" />
336 <property name="baseos" value="${os}" />
337 <property name="basews" value="${ws}" />
338 <property name="basearch" value="${arch}" />
339 <property name="otdtUpdatesDir" value="${otdtUpdatesDir}" />
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000340 <property name="testsUpdatesDirBase" value="${testsUpdatesDirBase}" />
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000341 <property name="vmargs" value="${vmargs}" />
342 </ant>
343 </target>
344
Stephan Herrmannd8c81652010-11-06 15:01:14 +0000345 <target name="runOTDTTests" description="Delegate to the next level script to perform the actual testing.">
346 <ant antfile="${OTScriptDir}/test.xml" target="otdt-tests" dir="${build.root.dir}">
347 <property name="os" value="${os}" />
348 <property name="ws" value="${ws}" />
349 <property name="arch" value="${arch}" />
350 <property name="baseos" value="${os}" />
351 <property name="basews" value="${ws}" />
352 <property name="basearch" value="${arch}" />
353 <property name="otdtUpdatesDir" value="${otdtUpdatesDir}" />
354 <property name="testsUpdatesDirBase" value="${testsUpdatesDirBase}" />
355 <property name="vmargs" value="${vmargs}" />
356 </ant>
357 </target>
358
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000359 <!-- currently unused target name="collectResults">
360 <ant target="collect" antfile="${test.eclipseDir}/plugins/${org.eclipse.test}/library.xml" dir="${otresults}">
361 <property name="includes" value="org.*.xml"/>
362 <property name="output-file" value="AllTestSuites.xml"/>
363 </ant>
364 </target -->
365
366</project>