blob: 049db50c63618b236e8044a77a00dca99c127d35 [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:
Stephan Herrmannb105b082011-05-15 00:39:56 +000098 ant -f run.xml ot-junit-all -> runs OTDT Build and Testprocess
99 ant -f run.xml ot-junit-otdt -> runs OTDT Build and Testprocess excluding jdt tests
100 ant -f run.xml ot-junit-build -> runs just OTDT Buildprocess
101 ant -f run.xml ot-compiler-build -> just build the compiler
102 ant -f run.xml ot-junit-run -> runs just OTDT Tests w/o TestSetup
103 </echo>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000104 </target>
105
106 <target name="ot-junit-all" depends="setupProperties,checkOS" description="Build all and run all tests.">
107 <echo message="Starting BuildProcess and Testrun in ${build.root.dir}"/>
108 <antcall target="verifyAntInstall"/>
109 <antcall target="setupTests" />
110 <antcall target="runAllTests"/>
111 </target>
112
Stephan Herrmannd8c81652010-11-06 15:01:14 +0000113 <target name="ot-junit-otdt" depends="setupProperties,checkOS" description="Build all and run otdt tests.">
114 <echo message="Starting BuildProcess and Testrun in ${build.root.dir}"/>
115 <antcall target="verifyAntInstall"/>
116 <antcall target="setupTests" />
117 <antcall target="runOTDTTests"/>
118 </target>
119
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000120 <target name="ot-junit-build" depends="setupProperties,checkOS" description="build everything without running tests">
121 <echo message="Starting BuildProcess in ${build.root.dir}"/>
122 <antcall target="verifyAntInstall"/>
123 <antcall target="createOTDTEclipse"/>
124 </target>
125
Stephan Herrmannb59f3f02011-05-15 00:17:51 +0000126 <target name="ot-compiler-build" depends="setupProperties,checkOS" description="build only the compiler (for debugging the build)">
127 <echo message="Starting BuildProcess in ${build.root.dir}"/>
128 <antcall target="verifyAntInstall"/>
129 <antcall target="createOTCompilerEclipse"/>
130 </target>
131
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000132 <target name="ot-junit-run" depends="setupProperties,checkOS" description="Run tests without building">
133 <echo message="Starting Testrun ${test.root.dir}"/>
134 <antcall target="runAllTests" />
135 </target>
136
137 <!-- =================== END Public Targets ==================== -->
138
139 <!-- === Setup Targets: === -->
140
141 <target name="verifyAntInstall" unless="_hasSaxon.jar">
142 <copy failonerror="true" overwrite="false" file="${OTScriptDir}/${saxon.jar.name}" tofile="${saxon.jar.path}"></copy>
143 <echo message="Needed to copy saxon8.jar to ${saxon.jar.path}. Please restart the build." />
144 <echo message="For an explanation, see http://ant.apache.org/faq.html#delegating-classloader-1.6" />
145 <fail message="See above. Please restart the build."/>
146 </target>
147
148 <!-- checks on which os ant is run, set ${os} and ${ws} accordingly -->
149 <target name="determineOS">
150 <condition property="os.isWindows">
151 <os family="windows"/>
152 </condition>
153
154 <condition property="os.isLinux">
155 <os name="Linux" />
156 </condition>
157 </target>
158
159 <target name="checkOS" depends="determineOS,windows,linux"/>
160
161 <target name="windows" if="os.isWindows">
162 <echo message="OS is Windows"/>
163 <property name="os" value="win32" />
164 <property name="ws" value="win32" />
165 </target>
166
167 <target name="linux" unless="os.isWindows" >
168 <echo message="OS is Linux"/>
169 <!-- eclipse-app.tgz is already passed from the calling script -->
170 <property name="os" value="linux" />
171 <property name="ws" value="gtk" />
172 </target>
173
174 <target name="setupForCompile" depends="checkOS" unless="_hasCreatedOTDTEclipse">
175 <antcall target="UnzipEclipse"/>
176 <antcall target="AddPluginsToEclipse"/>
177 </target>
178
179 <target name="UnzipEclipse">
180 <echo message="Extracting Eclipse (${eclipse-app.tgz}) in ${build.root.dir}..."/>
181 <mkdir dir="${build.root.dir}"/>
182 <untar compression="gzip" src="${eclipse-app.tgz}" dest="${build.root.dir}"/>
183 </target>
184
Stephan Herrmann37d869a2011-12-16 23:48:02 +0100185 <target name="AddPluginsToEclipse" description="Add git.pde.build plugins to the base Eclipse">
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000186 <mkdir dir="${baseLocation}/dropins/plugins"/>
Stephan Herrmanne67e17d2011-10-27 14:36:26 +0000187 <copy file="${OTScriptDir}/lib/${git.pde.build}" todir="${baseLocation}/dropins/plugins" />
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000188 </target>
189
190 <!-- ==== BUILDING AND RUNNING: ==== -->
191
192 <!-- ==== BUILD STAGE 1: ==== -->
193 <!-- setting an empty inputstring is a workaround for http://issues.apache.org/bugzilla/show_bug.cgi?id=34461 -->
194 <target name="createOTCompilerEclipse" depends="setupForCompile" description="create the bootstrapping Eclipse with OT/J compiler">
195 <echo message="Invoke pdebuild for creating the OT-Compiler"/>
196 <java
197 inputstring=""
198 dir="${baseLocation}"
199 fork="true"
200 classname="org.eclipse.equinox.launcher.Main"
201 classpath="${baseLocation}/plugins/${org.eclipse.equinox.launcher_jar}">
202 <arg value="-Dosgi.ws=${ws}"/>
203 <arg value="-Dosgi.os=${os}"/>
204 <arg value="-Dosgi.arch=${arch}"/>
205 <arg value="-application"/>
206 <arg value="org.eclipse.ant.core.antRunner"/>
207 <arg value="-buildfile"/>
208 <arg value="${buildfile}"/>
209 <arg value="-Dbuild.root.dir=${build.root.dir}"/>
210 <arg value="-DbaseLocation=${baseLocation}"/>
211 <arg value="-DOTScriptDir=${OTScriptDir}"/>
212 <arg value="-Drun.eclipseScriptDir=${run.eclipseScriptDir}"/>
213 <arg value="-Dbuilder=${builder-otcompiler}"/>
214 <arg value="-D${installmode}=true"/> <!-- <- obsolete? -->
215 <arg value="-Dcomponent.short=OT-Compiler"/>
Stephan Herrmannb105b082011-05-15 00:39:56 +0000216 <arg value="-DotdtUpdatesDir=${otdtUpdatesDir}"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000217 <arg value="-Dconfigs=*,*,*"/>
218 <arg value="-Dbaseos=${os}"/>
219 <arg value="-Dbasews=${ws}"/>
220 <arg value="-Dbasearch=${arch}"/>
221 <arg value="-Dtest.root.dir=${test.root.dir}"/>
222 <arg value="-Dtest.eclipseDir=${test.eclipseDir}"/>
223 <arg value="-DmapVersionTag=${mapVersionTag}"/>
224 <arg value="-DpathToMapFile=${pathToMapFile}"/>
Stephan Herrmannb59f3f02011-05-15 00:17:51 +0000225 <arg value="-DmapFileName=otdt.map"/>
Stephan Herrmann37d869a2011-12-16 23:48:02 +0100226 <arg value="-Dgit.repository.path=${git.repository.path}"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000227 <arg value="-Declipse-app.tgz=${eclipse-app.tgz}"/>
228 <arg value="-Declipse.tests.zip=${eclipse.tests.zip}"/>
Stephan Herrmanneacdfde2010-08-25 05:58:42 +0000229 <!--arg value="-verbose" /-->
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000230 <jvmarg value="${vm.args}"/>
231 <jvmarg value="${vm.args2}"/>
232 </java>
Stephan Herrmannb105b082011-05-15 00:39:56 +0000233 <!-- Now we should have an update site with the patch feature, time to install it into base: -->
Stephan Herrmannb59f3f02011-05-15 00:17:51 +0000234 <ant antfile="${OTScriptDir}/p2helper.xml" target="installFeature" dir="${baseLocation}">
235 <property name="feature" value="org.eclipse.objectteams.otdt.core.patch.feature.group"/>
236 <property name="sourceUpdatesDir" value="${otdtUpdatesDir}"/>
237 <property name="targetEclipseDir" value="${baseLocation}"/>
238 </ant>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000239 </target>
240
241 <!-- ==== BUILD STAGE 2: ==== -->
242 <!-- setting an empty inputstring is a workaround for http://issues.apache.org/bugzilla/show_bug.cgi?id=34461 -->
243 <target name="createOTDTEclipse" depends="createOTCompilerEclipse" unless="_hasCreatedOTDTEclipse">
244
245 <!-- Make org.eclipse.test.performance available while compiling test projects: -->
246 <echo message="Pre-installing Eclipse Test Framework into OTCompilerEclipse..."/>
Stephan Herrmann67cbf1c2010-09-26 09:59:15 +0000247 <mkdir dir="${testsUpdatesDirBase}/eclipse"/>
248 <unzip dest="${testsUpdatesDirBase}/eclipse" src="${eclipse.tests.zip}"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000249 <ant antfile="${OTScriptDir}/p2helper.xml" target="installFeature" dir="${baseLocation}">
250 <property name="feature" value="org.eclipse.test.feature.group"/>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000251 <property name="sourceUpdatesDir" value="${testsUpdatesDirBase}/eclipse"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000252 <property name="targetEclipseDir" value="${baseLocation}"/>
253 </ant>
Stephan Herrmann8372dc22010-06-03 22:41:05 +0000254
255 <!-- pre-load updateSite with published releases: -->
Stephan Herrmann0c9b5722010-06-04 22:13:03 +0000256 <mkdir dir="${otdtUpdatesDir}/plugins"/>
257 <mkdir dir="${otdtUpdatesDir}/features"/>
258 <exec executable="/bin/sh">
259 <arg value="-c"/>
260 <arg value="ln -s ${published.updates}/features/* ${otdtUpdatesDir}/features/"/>
261 </exec>
262 <exec executable="/bin/sh">
263 <arg value="-c"/>
264 <arg value="ln -s ${published.updates}/plugins/* ${otdtUpdatesDir}/plugins/"/>
265 </exec>
Stephan Herrmann8372dc22010-06-03 22:41:05 +0000266 <!-- pre-load category-less metadata: -->
267 <copy failonerror="false" flatten="true" toDir="${otdtUpdatesDir}">
268 <fileset dir="${user.dir}/metadata">
269 <include name="*.xml"/>
270 </fileset>
271 </copy>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000272
273 <echo message="Invoke pdebuild for creating a full OTDT"/>
274 <java
275 inputstring=""
276 dir="${baseLocation}"
277 fork="true"
278 classname="org.eclipse.equinox.launcher.Main"
279 classpath="${baseLocation}/plugins/${org.eclipse.equinox.launcher_jar}">
280 <arg value="-clean"/>
281 <arg value="-Dosgi.ws=${ws}"/>
282 <arg value="-Dosgi.os=${os}"/>
283 <arg value="-Dosgi.arch=${arch}"/>
284 <arg value="-application"/>
285 <arg value="org.eclipse.ant.core.antRunner"/>
286 <arg value="-buildfile"/>
287 <arg value="${buildfile}"/>
288 <arg value="-Dbuild.root.dir=${build.root.dir}"/>
289 <arg value="-DbaseLocation=${baseLocation}"/>
290 <arg value="-Drun.eclipseScriptDir=${run.eclipseScriptDir}"/>
291 <arg value="-DOTScriptDir=${OTScriptDir}"/>
292 <arg value="-Dbuilder=${builder-otdt}"/>
293 <arg value="-D${installmode}=true"/>
294 <arg value="-Dcomponent.short=OTDT-Build"/>
295 <arg value="-DotdtUpdatesDir=${otdtUpdatesDir}"/>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000296 <arg value="-DtestsUpdatesDirBase=${testsUpdatesDirBase}"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000297 <arg value="-Dbaseos=${os}"/>
298 <arg value="-Dbasews=${ws}"/>
299 <arg value="-Dbasearch=${arch}"/>
300 <arg value="-Dtest.root.dir=${test.root.dir}"/>
301 <arg value="-Dtest.eclipseDir=${test.eclipseDir}"/>
Stephan Herrmann37d869a2011-12-16 23:48:02 +0100302 <arg value="-Dgit.repository.path=${git.repository.path}"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000303 <arg value="-DmapVersionTag=${mapVersionTag}"/>
304 <arg value="-DpathToMapFile=${pathToMapFile}"/>
305 <arg value="-DmapFileName=otdt.map"/>
306 <arg value="-Ddo.run.tests=${do.run.tests}"/>
307 <arg value="-Ddo.build.all=${do.build.all}"/>
308 <arg value="-Declipse-app.tgz=${eclipse-app.tgz}"/>
309 <arg value="-Declipse.tests.zip=${eclipse.tests.zip}"/>
Stephan Herrmanneacdfde2010-08-25 05:58:42 +0000310 <!--arg value="-verbose" /-->
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000311 <jvmarg value="${vm.args}"/>
312 <jvmarg value="${vm.args2}"/>
313 <!-- arg value="${verboseAnt}"/ -->
314 <!-- arg value="-debug" / -->
315 </java>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000316 <!-- At this point a local update site exists, thanks to p2gathering=true -->
Stephan Herrmann99e184d2010-06-11 17:27:25 +0000317
318 <ant antfile="${OTScriptDir}/p2helper.xml" target="patchMetadata" dir="${otdtUpdatesDir}"/>
319
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000320 <property name="_hasCreatedOTDTEclipse" value="true" />
321 </target>
322
323 <!-- TESTING at STAGE 3: -->
324 <target name="setupTests" depends="createOTDTEclipse" description="Install the tests into an fresh OTDT">
325 <available file="${buildDirectory}/label.properties" property="label.properties.exists" />
326 <ant antfile="${OTScriptDir}/test.xml" target="setupTests" dir="${build.root.dir}">
327 <property name="os" value="${os}" />
328 <property name="ws" value="${ws}" />
329 <property name="arch" value="${arch}" />
330 <property name="baseos" value="${os}" />
331 <property name="basews" value="${ws}" />
332 <property name="basearch" value="${arch}" />
333 <property name="eclipse-app.tgz" value="${eclipse-app.tgz}" />
334 <property file="${buildDirectory}/label.properties" />
335 <property name="otdtUpdatesDir" value="${otdtUpdatesDir}" />
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000336 <property name="testsUpdatesDirBase" value="${testsUpdatesDirBase}" />
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000337 </ant>
338 </target>
339
340 <target name="runAllTests" description="Delegate to the next level script to perform the actual testing.">
341 <ant antfile="${OTScriptDir}/test.xml" target="all" dir="${build.root.dir}">
342 <property name="os" value="${os}" />
343 <property name="ws" value="${ws}" />
344 <property name="arch" value="${arch}" />
345 <property name="baseos" value="${os}" />
346 <property name="basews" value="${ws}" />
347 <property name="basearch" value="${arch}" />
348 <property name="otdtUpdatesDir" value="${otdtUpdatesDir}" />
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000349 <property name="testsUpdatesDirBase" value="${testsUpdatesDirBase}" />
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000350 <property name="vmargs" value="${vmargs}" />
351 </ant>
352 </target>
353
Stephan Herrmannd8c81652010-11-06 15:01:14 +0000354 <target name="runOTDTTests" description="Delegate to the next level script to perform the actual testing.">
355 <ant antfile="${OTScriptDir}/test.xml" target="otdt-tests" dir="${build.root.dir}">
356 <property name="os" value="${os}" />
357 <property name="ws" value="${ws}" />
358 <property name="arch" value="${arch}" />
359 <property name="baseos" value="${os}" />
360 <property name="basews" value="${ws}" />
361 <property name="basearch" value="${arch}" />
362 <property name="otdtUpdatesDir" value="${otdtUpdatesDir}" />
363 <property name="testsUpdatesDirBase" value="${testsUpdatesDirBase}" />
364 <property name="vmargs" value="${vmargs}" />
365 </ant>
366 </target>
367
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000368 <!-- currently unused target name="collectResults">
369 <ant target="collect" antfile="${test.eclipseDir}/plugins/${org.eclipse.test}/library.xml" dir="${otresults}">
370 <property name="includes" value="org.*.xml"/>
371 <property name="output-file" value="AllTestSuites.xml"/>
372 </ant>
373 </target -->
374
375</project>