blob: 2d709e71ee753cea0894bd4eb30a5754c8b2abf3 [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}"/>
Stephan Herrmannd8abd7a2012-04-12 22:08:50 +0200224 <arg value="-Dmap.file.path=${map.file.path}"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000225 <arg value="-Declipse-app.tgz=${eclipse-app.tgz}"/>
226 <arg value="-Declipse.tests.zip=${eclipse.tests.zip}"/>
Stephan Herrmanneacdfde2010-08-25 05:58:42 +0000227 <!--arg value="-verbose" /-->
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000228 <jvmarg value="${vm.args}"/>
229 <jvmarg value="${vm.args2}"/>
230 </java>
Stephan Herrmannb105b082011-05-15 00:39:56 +0000231 <!-- Now we should have an update site with the patch feature, time to install it into base: -->
Stephan Herrmannb59f3f02011-05-15 00:17:51 +0000232 <ant antfile="${OTScriptDir}/p2helper.xml" target="installFeature" dir="${baseLocation}">
233 <property name="feature" value="org.eclipse.objectteams.otdt.core.patch.feature.group"/>
234 <property name="sourceUpdatesDir" value="${otdtUpdatesDir}"/>
235 <property name="targetEclipseDir" value="${baseLocation}"/>
236 </ant>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000237 </target>
238
239 <!-- ==== BUILD STAGE 2: ==== -->
240 <!-- setting an empty inputstring is a workaround for http://issues.apache.org/bugzilla/show_bug.cgi?id=34461 -->
241 <target name="createOTDTEclipse" depends="createOTCompilerEclipse" unless="_hasCreatedOTDTEclipse">
242
243 <!-- Make org.eclipse.test.performance available while compiling test projects: -->
244 <echo message="Pre-installing Eclipse Test Framework into OTCompilerEclipse..."/>
Stephan Herrmann67cbf1c2010-09-26 09:59:15 +0000245 <mkdir dir="${testsUpdatesDirBase}/eclipse"/>
246 <unzip dest="${testsUpdatesDirBase}/eclipse" src="${eclipse.tests.zip}"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000247 <ant antfile="${OTScriptDir}/p2helper.xml" target="installFeature" dir="${baseLocation}">
248 <property name="feature" value="org.eclipse.test.feature.group"/>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000249 <property name="sourceUpdatesDir" value="${testsUpdatesDirBase}/eclipse"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000250 <property name="targetEclipseDir" value="${baseLocation}"/>
251 </ant>
Stephan Herrmann8372dc22010-06-03 22:41:05 +0000252
253 <!-- pre-load updateSite with published releases: -->
Stephan Herrmann0c9b5722010-06-04 22:13:03 +0000254 <mkdir dir="${otdtUpdatesDir}/plugins"/>
255 <mkdir dir="${otdtUpdatesDir}/features"/>
256 <exec executable="/bin/sh">
257 <arg value="-c"/>
258 <arg value="ln -s ${published.updates}/features/* ${otdtUpdatesDir}/features/"/>
259 </exec>
260 <exec executable="/bin/sh">
261 <arg value="-c"/>
262 <arg value="ln -s ${published.updates}/plugins/* ${otdtUpdatesDir}/plugins/"/>
263 </exec>
Stephan Herrmann8372dc22010-06-03 22:41:05 +0000264 <!-- pre-load category-less metadata: -->
265 <copy failonerror="false" flatten="true" toDir="${otdtUpdatesDir}">
266 <fileset dir="${user.dir}/metadata">
267 <include name="*.xml"/>
268 </fileset>
269 </copy>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000270
271 <echo message="Invoke pdebuild for creating a full OTDT"/>
272 <java
273 inputstring=""
274 dir="${baseLocation}"
275 fork="true"
276 classname="org.eclipse.equinox.launcher.Main"
277 classpath="${baseLocation}/plugins/${org.eclipse.equinox.launcher_jar}">
278 <arg value="-clean"/>
279 <arg value="-Dosgi.ws=${ws}"/>
280 <arg value="-Dosgi.os=${os}"/>
281 <arg value="-Dosgi.arch=${arch}"/>
282 <arg value="-application"/>
283 <arg value="org.eclipse.ant.core.antRunner"/>
284 <arg value="-buildfile"/>
285 <arg value="${buildfile}"/>
286 <arg value="-Dbuild.root.dir=${build.root.dir}"/>
287 <arg value="-DbaseLocation=${baseLocation}"/>
288 <arg value="-Drun.eclipseScriptDir=${run.eclipseScriptDir}"/>
289 <arg value="-DOTScriptDir=${OTScriptDir}"/>
290 <arg value="-Dbuilder=${builder-otdt}"/>
291 <arg value="-D${installmode}=true"/>
292 <arg value="-Dcomponent.short=OTDT-Build"/>
293 <arg value="-DotdtUpdatesDir=${otdtUpdatesDir}"/>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000294 <arg value="-DtestsUpdatesDirBase=${testsUpdatesDirBase}"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000295 <arg value="-Dbaseos=${os}"/>
296 <arg value="-Dbasews=${ws}"/>
297 <arg value="-Dbasearch=${arch}"/>
298 <arg value="-Dtest.root.dir=${test.root.dir}"/>
299 <arg value="-Dtest.eclipseDir=${test.eclipseDir}"/>
Stephan Herrmannd8abd7a2012-04-12 22:08:50 +0200300 <arg value="-Dmap.file.path=${map.file.path}"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000301 <arg value="-DmapVersionTag=${mapVersionTag}"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000302 <arg value="-Ddo.run.tests=${do.run.tests}"/>
303 <arg value="-Ddo.build.all=${do.build.all}"/>
304 <arg value="-Declipse-app.tgz=${eclipse-app.tgz}"/>
305 <arg value="-Declipse.tests.zip=${eclipse.tests.zip}"/>
Stephan Herrmanneacdfde2010-08-25 05:58:42 +0000306 <!--arg value="-verbose" /-->
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000307 <jvmarg value="${vm.args}"/>
308 <jvmarg value="${vm.args2}"/>
309 <!-- arg value="${verboseAnt}"/ -->
310 <!-- arg value="-debug" / -->
311 </java>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000312 <!-- At this point a local update site exists, thanks to p2gathering=true -->
Stephan Herrmann99e184d2010-06-11 17:27:25 +0000313
314 <ant antfile="${OTScriptDir}/p2helper.xml" target="patchMetadata" dir="${otdtUpdatesDir}"/>
315
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000316 <property name="_hasCreatedOTDTEclipse" value="true" />
317 </target>
318
319 <!-- TESTING at STAGE 3: -->
320 <target name="setupTests" depends="createOTDTEclipse" description="Install the tests into an fresh OTDT">
321 <available file="${buildDirectory}/label.properties" property="label.properties.exists" />
322 <ant antfile="${OTScriptDir}/test.xml" target="setupTests" dir="${build.root.dir}">
323 <property name="os" value="${os}" />
324 <property name="ws" value="${ws}" />
325 <property name="arch" value="${arch}" />
326 <property name="baseos" value="${os}" />
327 <property name="basews" value="${ws}" />
328 <property name="basearch" value="${arch}" />
329 <property name="eclipse-app.tgz" value="${eclipse-app.tgz}" />
330 <property file="${buildDirectory}/label.properties" />
331 <property name="otdtUpdatesDir" value="${otdtUpdatesDir}" />
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000332 <property name="testsUpdatesDirBase" value="${testsUpdatesDirBase}" />
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000333 </ant>
334 </target>
335
336 <target name="runAllTests" description="Delegate to the next level script to perform the actual testing.">
337 <ant antfile="${OTScriptDir}/test.xml" target="all" dir="${build.root.dir}">
338 <property name="os" value="${os}" />
339 <property name="ws" value="${ws}" />
340 <property name="arch" value="${arch}" />
341 <property name="baseos" value="${os}" />
342 <property name="basews" value="${ws}" />
343 <property name="basearch" value="${arch}" />
344 <property name="otdtUpdatesDir" value="${otdtUpdatesDir}" />
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000345 <property name="testsUpdatesDirBase" value="${testsUpdatesDirBase}" />
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000346 <property name="vmargs" value="${vmargs}" />
347 </ant>
348 </target>
349
Stephan Herrmannd8c81652010-11-06 15:01:14 +0000350 <target name="runOTDTTests" description="Delegate to the next level script to perform the actual testing.">
351 <ant antfile="${OTScriptDir}/test.xml" target="otdt-tests" dir="${build.root.dir}">
352 <property name="os" value="${os}" />
353 <property name="ws" value="${ws}" />
354 <property name="arch" value="${arch}" />
355 <property name="baseos" value="${os}" />
356 <property name="basews" value="${ws}" />
357 <property name="basearch" value="${arch}" />
358 <property name="otdtUpdatesDir" value="${otdtUpdatesDir}" />
359 <property name="testsUpdatesDirBase" value="${testsUpdatesDirBase}" />
360 <property name="vmargs" value="${vmargs}" />
361 </ant>
362 </target>
363
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000364 <!-- currently unused target name="collectResults">
365 <ant target="collect" antfile="${test.eclipseDir}/plugins/${org.eclipse.test}/library.xml" dir="${otresults}">
366 <property name="includes" value="org.*.xml"/>
367 <property name="output-file" value="AllTestSuites.xml"/>
368 </ant>
369 </target -->
370
371</project>