blob: 7a29afc3d446165b2b420503879a46a7327ad8e7 [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
99 ant -f run.xml ot-junit-build -> runs just OTDT Buildprocess
100 ant -f run.xml ot-junit-run -> runs just OTDT Tests w/o TestSetup
101 </echo>
102 </target>
103
104 <target name="ot-junit-all" depends="setupProperties,checkOS" description="Build all and run all tests.">
105 <echo message="Starting BuildProcess and Testrun in ${build.root.dir}"/>
106 <antcall target="verifyAntInstall"/>
107 <antcall target="setupTests" />
108 <antcall target="runAllTests"/>
109 </target>
110
111 <target name="ot-junit-build" depends="setupProperties,checkOS" description="build everything without running tests">
112 <echo message="Starting BuildProcess in ${build.root.dir}"/>
113 <antcall target="verifyAntInstall"/>
114 <antcall target="createOTDTEclipse"/>
115 </target>
116
117 <target name="ot-junit-run" depends="setupProperties,checkOS" description="Run tests without building">
118 <echo message="Starting Testrun ${test.root.dir}"/>
119 <antcall target="runAllTests" />
120 </target>
121
122 <!-- =================== END Public Targets ==================== -->
123
124 <!-- === Setup Targets: === -->
125
126 <target name="verifyAntInstall" unless="_hasSaxon.jar">
127 <copy failonerror="true" overwrite="false" file="${OTScriptDir}/${saxon.jar.name}" tofile="${saxon.jar.path}"></copy>
128 <echo message="Needed to copy saxon8.jar to ${saxon.jar.path}. Please restart the build." />
129 <echo message="For an explanation, see http://ant.apache.org/faq.html#delegating-classloader-1.6" />
130 <fail message="See above. Please restart the build."/>
131 </target>
132
133 <!-- checks on which os ant is run, set ${os} and ${ws} accordingly -->
134 <target name="determineOS">
135 <condition property="os.isWindows">
136 <os family="windows"/>
137 </condition>
138
139 <condition property="os.isLinux">
140 <os name="Linux" />
141 </condition>
142 </target>
143
144 <target name="checkOS" depends="determineOS,windows,linux"/>
145
146 <target name="windows" if="os.isWindows">
147 <echo message="OS is Windows"/>
148 <property name="os" value="win32" />
149 <property name="ws" value="win32" />
150 </target>
151
152 <target name="linux" unless="os.isWindows" >
153 <echo message="OS is Linux"/>
154 <!-- eclipse-app.tgz is already passed from the calling script -->
155 <property name="os" value="linux" />
156 <property name="ws" value="gtk" />
157 </target>
158
159 <target name="setupForCompile" depends="checkOS" unless="_hasCreatedOTDTEclipse">
160 <antcall target="UnzipEclipse"/>
161 <antcall target="AddPluginsToEclipse"/>
162 </target>
163
164 <target name="UnzipEclipse">
165 <echo message="Extracting Eclipse (${eclipse-app.tgz}) in ${build.root.dir}..."/>
166 <mkdir dir="${build.root.dir}"/>
167 <untar compression="gzip" src="${eclipse-app.tgz}" dest="${build.root.dir}"/>
168 </target>
169
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000170 <target name="AddPluginsToEclipse" description="Add svn.pde.build plugin to the base Eclipse">
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000171 <mkdir dir="${baseLocation}/dropins/plugins"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000172 <copy file="${OTScriptDir}/lib/${svn.pde.build}" todir="${baseLocation}/dropins/plugins" />
173 </target>
174
175 <!-- ==== BUILDING AND RUNNING: ==== -->
176
177 <!-- ==== BUILD STAGE 1: ==== -->
178 <!-- setting an empty inputstring is a workaround for http://issues.apache.org/bugzilla/show_bug.cgi?id=34461 -->
179 <target name="createOTCompilerEclipse" depends="setupForCompile" description="create the bootstrapping Eclipse with OT/J compiler">
180 <echo message="Invoke pdebuild for creating the OT-Compiler"/>
181 <java
182 inputstring=""
183 dir="${baseLocation}"
184 fork="true"
185 classname="org.eclipse.equinox.launcher.Main"
186 classpath="${baseLocation}/plugins/${org.eclipse.equinox.launcher_jar}">
187 <arg value="-Dosgi.ws=${ws}"/>
188 <arg value="-Dosgi.os=${os}"/>
189 <arg value="-Dosgi.arch=${arch}"/>
190 <arg value="-application"/>
191 <arg value="org.eclipse.ant.core.antRunner"/>
192 <arg value="-buildfile"/>
193 <arg value="${buildfile}"/>
194 <arg value="-Dbuild.root.dir=${build.root.dir}"/>
195 <arg value="-DbaseLocation=${baseLocation}"/>
196 <arg value="-DOTScriptDir=${OTScriptDir}"/>
197 <arg value="-Drun.eclipseScriptDir=${run.eclipseScriptDir}"/>
198 <arg value="-Dbuilder=${builder-otcompiler}"/>
199 <arg value="-D${installmode}=true"/> <!-- <- obsolete? -->
200 <arg value="-Dcomponent.short=OT-Compiler"/>
201 <arg value="-Dconfigs=*,*,*"/>
202 <arg value="-Dbaseos=${os}"/>
203 <arg value="-Dbasews=${ws}"/>
204 <arg value="-Dbasearch=${arch}"/>
205 <arg value="-Dtest.root.dir=${test.root.dir}"/>
206 <arg value="-Dtest.eclipseDir=${test.eclipseDir}"/>
207 <arg value="-DmapVersionTag=${mapVersionTag}"/>
208 <arg value="-DpathToMapFile=${pathToMapFile}"/>
209 <arg value="-DmapFileName=ot-compiler.map"/>
210 <arg value="-Dsvn.repository.url=${svn.repository.url}"/>
211 <arg value="-Declipse-app.tgz=${eclipse-app.tgz}"/>
212 <arg value="-Declipse.tests.zip=${eclipse.tests.zip}"/>
Stephan Herrmanneacdfde2010-08-25 05:58:42 +0000213 <!--arg value="-verbose" /-->
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000214 <jvmarg value="${vm.args}"/>
215 <jvmarg value="${vm.args2}"/>
216 </java>
217 <!-- At this point a zip file containing the new jdt.core-plugin exists in
218 ${build.root.dir}/org.eclipse.objectteams.otdt-${buildId}.zip
219 which has already been installed into ${baseLocation} as to replace the
220 original plugin jar of exact same name (see OT-Compiler/customTargets.xml#postBuild)..
221 -->
222 </target>
223
224 <!-- ==== BUILD STAGE 2: ==== -->
225 <!-- setting an empty inputstring is a workaround for http://issues.apache.org/bugzilla/show_bug.cgi?id=34461 -->
226 <target name="createOTDTEclipse" depends="createOTCompilerEclipse" unless="_hasCreatedOTDTEclipse">
227
228 <!-- Make org.eclipse.test.performance available while compiling test projects: -->
229 <echo message="Pre-installing Eclipse Test Framework into OTCompilerEclipse..."/>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000230 <mkdir dir="${testsUpdatesDirBase}"/>
231 <unzip dest="${testsUpdatesDirBase}" src="${eclipse.tests.zip}"/> <!-- unfolds into "eclipse" subdir -->
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000232 <ant antfile="${OTScriptDir}/p2helper.xml" target="installFeature" dir="${baseLocation}">
233 <property name="feature" value="org.eclipse.test.feature.group"/>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000234 <property name="sourceUpdatesDir" value="${testsUpdatesDirBase}/eclipse"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000235 <property name="targetEclipseDir" value="${baseLocation}"/>
236 </ant>
Stephan Herrmann8372dc22010-06-03 22:41:05 +0000237
238 <!-- pre-load updateSite with published releases: -->
Stephan Herrmann0c9b5722010-06-04 22:13:03 +0000239 <mkdir dir="${otdtUpdatesDir}/plugins"/>
240 <mkdir dir="${otdtUpdatesDir}/features"/>
241 <exec executable="/bin/sh">
242 <arg value="-c"/>
243 <arg value="ln -s ${published.updates}/features/* ${otdtUpdatesDir}/features/"/>
244 </exec>
245 <exec executable="/bin/sh">
246 <arg value="-c"/>
247 <arg value="ln -s ${published.updates}/plugins/* ${otdtUpdatesDir}/plugins/"/>
248 </exec>
Stephan Herrmann8372dc22010-06-03 22:41:05 +0000249 <!-- pre-load category-less metadata: -->
250 <copy failonerror="false" flatten="true" toDir="${otdtUpdatesDir}">
251 <fileset dir="${user.dir}/metadata">
252 <include name="*.xml"/>
253 </fileset>
254 </copy>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000255
256 <echo message="Invoke pdebuild for creating a full OTDT"/>
257 <java
258 inputstring=""
259 dir="${baseLocation}"
260 fork="true"
261 classname="org.eclipse.equinox.launcher.Main"
262 classpath="${baseLocation}/plugins/${org.eclipse.equinox.launcher_jar}">
263 <arg value="-clean"/>
264 <arg value="-Dosgi.ws=${ws}"/>
265 <arg value="-Dosgi.os=${os}"/>
266 <arg value="-Dosgi.arch=${arch}"/>
267 <arg value="-application"/>
268 <arg value="org.eclipse.ant.core.antRunner"/>
269 <arg value="-buildfile"/>
270 <arg value="${buildfile}"/>
271 <arg value="-Dbuild.root.dir=${build.root.dir}"/>
272 <arg value="-DbaseLocation=${baseLocation}"/>
273 <arg value="-Drun.eclipseScriptDir=${run.eclipseScriptDir}"/>
274 <arg value="-DOTScriptDir=${OTScriptDir}"/>
275 <arg value="-Dbuilder=${builder-otdt}"/>
276 <arg value="-D${installmode}=true"/>
277 <arg value="-Dcomponent.short=OTDT-Build"/>
278 <arg value="-DotdtUpdatesDir=${otdtUpdatesDir}"/>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000279 <arg value="-DtestsUpdatesDirBase=${testsUpdatesDirBase}"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000280 <arg value="-Dbaseos=${os}"/>
281 <arg value="-Dbasews=${ws}"/>
282 <arg value="-Dbasearch=${arch}"/>
283 <arg value="-Dtest.root.dir=${test.root.dir}"/>
284 <arg value="-Dtest.eclipseDir=${test.eclipseDir}"/>
285 <arg value="-Dsvn.repository.url=${svn.repository.url}"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000286 <arg value="-DmapVersionTag=${mapVersionTag}"/>
287 <arg value="-DpathToMapFile=${pathToMapFile}"/>
288 <arg value="-DmapFileName=otdt.map"/>
289 <arg value="-Ddo.run.tests=${do.run.tests}"/>
290 <arg value="-Ddo.build.all=${do.build.all}"/>
291 <arg value="-Declipse-app.tgz=${eclipse-app.tgz}"/>
292 <arg value="-Declipse.tests.zip=${eclipse.tests.zip}"/>
Stephan Herrmanneacdfde2010-08-25 05:58:42 +0000293 <!--arg value="-verbose" /-->
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000294 <jvmarg value="${vm.args}"/>
295 <jvmarg value="${vm.args2}"/>
296 <!-- arg value="${verboseAnt}"/ -->
297 <!-- arg value="-debug" / -->
298 </java>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000299 <!-- At this point a local update site exists, thanks to p2gathering=true -->
Stephan Herrmann99e184d2010-06-11 17:27:25 +0000300
301 <ant antfile="${OTScriptDir}/p2helper.xml" target="patchMetadata" dir="${otdtUpdatesDir}"/>
302
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000303 <property name="_hasCreatedOTDTEclipse" value="true" />
304 </target>
305
306 <!-- TESTING at STAGE 3: -->
307 <target name="setupTests" depends="createOTDTEclipse" description="Install the tests into an fresh OTDT">
308 <available file="${buildDirectory}/label.properties" property="label.properties.exists" />
309 <ant antfile="${OTScriptDir}/test.xml" target="setupTests" dir="${build.root.dir}">
310 <property name="os" value="${os}" />
311 <property name="ws" value="${ws}" />
312 <property name="arch" value="${arch}" />
313 <property name="baseos" value="${os}" />
314 <property name="basews" value="${ws}" />
315 <property name="basearch" value="${arch}" />
316 <property name="eclipse-app.tgz" value="${eclipse-app.tgz}" />
317 <property file="${buildDirectory}/label.properties" />
318 <property name="otdtUpdatesDir" value="${otdtUpdatesDir}" />
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000319 <property name="testsUpdatesDirBase" value="${testsUpdatesDirBase}" />
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000320 </ant>
321 </target>
322
323 <target name="runAllTests" description="Delegate to the next level script to perform the actual testing.">
324 <ant antfile="${OTScriptDir}/test.xml" target="all" dir="${build.root.dir}">
325 <property name="os" value="${os}" />
326 <property name="ws" value="${ws}" />
327 <property name="arch" value="${arch}" />
328 <property name="baseos" value="${os}" />
329 <property name="basews" value="${ws}" />
330 <property name="basearch" value="${arch}" />
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 <property name="vmargs" value="${vmargs}" />
334 </ant>
335 </target>
336
337 <!-- currently unused target name="collectResults">
338 <ant target="collect" antfile="${test.eclipseDir}/plugins/${org.eclipse.test}/library.xml" dir="${otresults}">
339 <property name="includes" value="org.*.xml"/>
340 <property name="output-file" value="AllTestSuites.xml"/>
341 </ant>
342 </target -->
343
344</project>