blob: 29c704c00d93ebbd46862d6f056a6c6d7fea54db [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 +000024directory to otre jars:
25 otre.lib = ${otre.lib}
26should sources be built (true|false)?
27 do.build.all = ${do.build.all}
28should test be run (true|false)?
29 do.run.tests = ${do.run.tests}
30------------------------------------------------------------------------------
31 </echo>
32 </target>
33
34 <target name="setupProperties" depends="showGivenProperties">
35
36 <dirname property="_toplevelDir" file="${ant.file}"/>
37
38 <!-- main configuration file (version dependent names etc.): -->
39 <loadproperties srcfile="${_toplevelDir}/run.properties" />
40
41 <!-- versions of test plugins, also find org.eclipse.test here: -->
42 <loadproperties srcfile="${_toplevelDir}/test.properties" />
43
44 <!-- ======== Directories (indentation shows structure): ======== -->
45 <!-- build scripts: -->
46 <property name="OTScriptDir" value="${_toplevelDir}" />
47 <property name="buildfile" value="${OTScriptDir}/build.xml" />
48 <property name="builder-otcompiler" value="${OTScriptDir}/OT-Compiler" />
49 <property name="builder-otdt" value="${OTScriptDir}/OTDT-Build" />
50
51 <!-- directories for the build: -->
52 <property name="build.root.dir" value="${user.dir}/build-root" />
Stephan Herrmann33c26042010-06-03 10:24:16 +000053 <!-- These names are hard coded in pde-build: -->
54 <property name="buildDirectory" value="${build.root.dir}/src" />
Stephan Herrmann33c26042010-06-03 10:24:16 +000055 <property name="baseLocation" value="${build.root.dir}/eclipse" />
Stephan Herrmanndcd87c12010-04-25 10:59:27 +000056
57 <!-- directories for testing: -->
58 <property name="test.root.dir" value="${user.dir}/test-root" />
59 <!-- This name is used in individual test.xml of test plugins: -->
60 <property name="test.eclipseDir" value="${test.root.dir}/eclipse" />
61
62 <!-- directories for update sites: -->
63 <property name="otdtUpdatesDir" value="${user.dir}/updateSite"/>
64 <property name="testsUpdatesDirBase" value="${user.dir}/updateSiteTests"/>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +000065 <!-- will have sub directories "eclipse" and "otdt" -->
Stephan Herrmanndcd87c12010-04-25 10:59:27 +000066
67 <!-- ======== More Configuration Details: ======== -->
68 <!-- maybe obsolete: file prefix to distinguish output files. -->
69 <property name="file-id" value="XXX" />
70
71 <!-- Configure Java for STAGE 1 and STAGE 2 building: -->
72 <property name="vm" value="java" />
73 <property name="vm.args" value="-Xmx912m" />
74 <property name="vm.args2" value="-XX:MaxPermSize=128m" />
75
76 <property name="installmode" value="clean" />
77
78 <property name="saxon.jar.name" value="saxon8.jar" />
79 <property name="saxon.jar.path" value="${user.home}/.ant/lib/${saxon.jar.name}" />
80 <available file="${saxon.jar.path}" property="_hasSaxon.jar" />
81
82 <!-- ant's os.arch is slightly different than osgi's arch -->
Stephan Herrmann1a9d85a2010-05-17 22:45:31 +000083 <condition property="arch" value="x86_64"> <!-- HACK: hard coding 64-bit architecture -->
Stephan Herrmanndcd87c12010-04-25 10:59:27 +000084 <os arch="i386" />
85 </condition>
86 <condition property="arch" value="ppc64"> <!-- HACK: hard coding 64-bit architecture -->
87 <os arch="ppc" />
88 </condition>
Stephan Herrmann005fc312010-05-18 12:52:58 +000089 <condition property="arch" value="x86_64"> <!-- Map ant's arch to OSGi arch -->
90 <os arch="amd64" />
91 </condition>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +000092 <!-- if not set above, set it to os.arch -->
93 <property name="arch" value="${os.arch}" />
94
95 </target>
96
97
98 <target name="INFO">
99 <echo>Usage:
100 ant -f run.xml ot-junit-all -> runs OTDT Build and Testprocess
101 ant -f run.xml ot-junit-build -> runs just OTDT Buildprocess
102 ant -f run.xml ot-junit-run -> runs just OTDT Tests w/o TestSetup
103 </echo>
104 </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
113 <target name="ot-junit-build" depends="setupProperties,checkOS" description="build everything without running tests">
114 <echo message="Starting BuildProcess in ${build.root.dir}"/>
115 <antcall target="verifyAntInstall"/>
116 <antcall target="createOTDTEclipse"/>
117 </target>
118
119 <target name="ot-junit-run" depends="setupProperties,checkOS" description="Run tests without building">
120 <echo message="Starting Testrun ${test.root.dir}"/>
121 <antcall target="runAllTests" />
122 </target>
123
124 <!-- =================== END Public Targets ==================== -->
125
126 <!-- === Setup Targets: === -->
127
128 <target name="verifyAntInstall" unless="_hasSaxon.jar">
129 <copy failonerror="true" overwrite="false" file="${OTScriptDir}/${saxon.jar.name}" tofile="${saxon.jar.path}"></copy>
130 <echo message="Needed to copy saxon8.jar to ${saxon.jar.path}. Please restart the build." />
131 <echo message="For an explanation, see http://ant.apache.org/faq.html#delegating-classloader-1.6" />
132 <fail message="See above. Please restart the build."/>
133 </target>
134
135 <!-- checks on which os ant is run, set ${os} and ${ws} accordingly -->
136 <target name="determineOS">
137 <condition property="os.isWindows">
138 <os family="windows"/>
139 </condition>
140
141 <condition property="os.isLinux">
142 <os name="Linux" />
143 </condition>
144 </target>
145
146 <target name="checkOS" depends="determineOS,windows,linux"/>
147
148 <target name="windows" if="os.isWindows">
149 <echo message="OS is Windows"/>
150 <property name="os" value="win32" />
151 <property name="ws" value="win32" />
152 </target>
153
154 <target name="linux" unless="os.isWindows" >
155 <echo message="OS is Linux"/>
156 <!-- eclipse-app.tgz is already passed from the calling script -->
157 <property name="os" value="linux" />
158 <property name="ws" value="gtk" />
159 </target>
160
161 <target name="setupForCompile" depends="checkOS" unless="_hasCreatedOTDTEclipse">
162 <antcall target="UnzipEclipse"/>
163 <antcall target="AddPluginsToEclipse"/>
164 </target>
165
166 <target name="UnzipEclipse">
167 <echo message="Extracting Eclipse (${eclipse-app.tgz}) in ${build.root.dir}..."/>
168 <mkdir dir="${build.root.dir}"/>
169 <untar compression="gzip" src="${eclipse-app.tgz}" dest="${build.root.dir}"/>
170 </target>
171
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000172 <target name="AddPluginsToEclipse" description="Add svn.pde.build plugin to the base Eclipse">
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000173 <mkdir dir="${baseLocation}/dropins/plugins"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000174 <copy file="${OTScriptDir}/lib/${svn.pde.build}" todir="${baseLocation}/dropins/plugins" />
175 </target>
176
177 <!-- ==== BUILDING AND RUNNING: ==== -->
178
179 <!-- ==== BUILD STAGE 1: ==== -->
180 <!-- setting an empty inputstring is a workaround for http://issues.apache.org/bugzilla/show_bug.cgi?id=34461 -->
181 <target name="createOTCompilerEclipse" depends="setupForCompile" description="create the bootstrapping Eclipse with OT/J compiler">
182 <echo message="Invoke pdebuild for creating the OT-Compiler"/>
183 <java
184 inputstring=""
185 dir="${baseLocation}"
186 fork="true"
187 classname="org.eclipse.equinox.launcher.Main"
188 classpath="${baseLocation}/plugins/${org.eclipse.equinox.launcher_jar}">
189 <arg value="-Dosgi.ws=${ws}"/>
190 <arg value="-Dosgi.os=${os}"/>
191 <arg value="-Dosgi.arch=${arch}"/>
192 <arg value="-application"/>
193 <arg value="org.eclipse.ant.core.antRunner"/>
194 <arg value="-buildfile"/>
195 <arg value="${buildfile}"/>
196 <arg value="-Dbuild.root.dir=${build.root.dir}"/>
197 <arg value="-DbaseLocation=${baseLocation}"/>
198 <arg value="-DOTScriptDir=${OTScriptDir}"/>
199 <arg value="-Drun.eclipseScriptDir=${run.eclipseScriptDir}"/>
200 <arg value="-Dbuilder=${builder-otcompiler}"/>
201 <arg value="-D${installmode}=true"/> <!-- <- obsolete? -->
202 <arg value="-Dcomponent.short=OT-Compiler"/>
203 <arg value="-Dconfigs=*,*,*"/>
204 <arg value="-Dbaseos=${os}"/>
205 <arg value="-Dbasews=${ws}"/>
206 <arg value="-Dbasearch=${arch}"/>
207 <arg value="-Dtest.root.dir=${test.root.dir}"/>
208 <arg value="-Dtest.eclipseDir=${test.eclipseDir}"/>
209 <arg value="-DmapVersionTag=${mapVersionTag}"/>
210 <arg value="-DpathToMapFile=${pathToMapFile}"/>
211 <arg value="-DmapFileName=ot-compiler.map"/>
212 <arg value="-Dsvn.repository.url=${svn.repository.url}"/>
213 <arg value="-Declipse-app.tgz=${eclipse-app.tgz}"/>
214 <arg value="-Declipse.tests.zip=${eclipse.tests.zip}"/>
215 <arg value="-verbose" />
216 <jvmarg value="${vm.args}"/>
217 <jvmarg value="${vm.args2}"/>
218 </java>
219 <!-- At this point a zip file containing the new jdt.core-plugin exists in
220 ${build.root.dir}/org.eclipse.objectteams.otdt-${buildId}.zip
221 which has already been installed into ${baseLocation} as to replace the
222 original plugin jar of exact same name (see OT-Compiler/customTargets.xml#postBuild)..
223 -->
224 </target>
225
226 <!-- ==== BUILD STAGE 2: ==== -->
227 <!-- setting an empty inputstring is a workaround for http://issues.apache.org/bugzilla/show_bug.cgi?id=34461 -->
228 <target name="createOTDTEclipse" depends="createOTCompilerEclipse" unless="_hasCreatedOTDTEclipse">
229
230 <!-- Make org.eclipse.test.performance available while compiling test projects: -->
231 <echo message="Pre-installing Eclipse Test Framework into OTCompilerEclipse..."/>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000232 <mkdir dir="${testsUpdatesDirBase}"/>
233 <unzip dest="${testsUpdatesDirBase}" src="${eclipse.tests.zip}"/> <!-- unfolds into "eclipse" subdir -->
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000234 <ant antfile="${OTScriptDir}/p2helper.xml" target="installFeature" dir="${baseLocation}">
235 <property name="feature" value="org.eclipse.test.feature.group"/>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000236 <property name="sourceUpdatesDir" value="${testsUpdatesDirBase}/eclipse"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000237 <property name="targetEclipseDir" value="${baseLocation}"/>
238 </ant>
Stephan Herrmann8372dc22010-06-03 22:41:05 +0000239
240 <!-- pre-load updateSite with published releases: -->
241 <mkdir dir="${otdtUpdatesDir}"/>
242 <copy todir="${otdtUpdatesDir}" flatten="false">
243 <fileset dir="${published.updates}">
244 <include name="**/*.jar"/>
245 </fileset>
246 </copy>
247 <!-- pre-load category-less metadata: -->
248 <copy failonerror="false" flatten="true" toDir="${otdtUpdatesDir}">
249 <fileset dir="${user.dir}/metadata">
250 <include name="*.xml"/>
251 </fileset>
252 </copy>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000253
254 <echo message="Invoke pdebuild for creating a full OTDT"/>
255 <java
256 inputstring=""
257 dir="${baseLocation}"
258 fork="true"
259 classname="org.eclipse.equinox.launcher.Main"
260 classpath="${baseLocation}/plugins/${org.eclipse.equinox.launcher_jar}">
261 <arg value="-clean"/>
262 <arg value="-Dosgi.ws=${ws}"/>
263 <arg value="-Dosgi.os=${os}"/>
264 <arg value="-Dosgi.arch=${arch}"/>
265 <arg value="-application"/>
266 <arg value="org.eclipse.ant.core.antRunner"/>
267 <arg value="-buildfile"/>
268 <arg value="${buildfile}"/>
269 <arg value="-Dbuild.root.dir=${build.root.dir}"/>
270 <arg value="-DbaseLocation=${baseLocation}"/>
271 <arg value="-Drun.eclipseScriptDir=${run.eclipseScriptDir}"/>
272 <arg value="-DOTScriptDir=${OTScriptDir}"/>
273 <arg value="-Dbuilder=${builder-otdt}"/>
274 <arg value="-D${installmode}=true"/>
275 <arg value="-Dcomponent.short=OTDT-Build"/>
276 <arg value="-DotdtUpdatesDir=${otdtUpdatesDir}"/>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000277 <arg value="-DtestsUpdatesDirBase=${testsUpdatesDirBase}"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000278 <arg value="-Dbaseos=${os}"/>
279 <arg value="-Dbasews=${ws}"/>
280 <arg value="-Dbasearch=${arch}"/>
281 <arg value="-Dtest.root.dir=${test.root.dir}"/>
282 <arg value="-Dtest.eclipseDir=${test.eclipseDir}"/>
283 <arg value="-Dsvn.repository.url=${svn.repository.url}"/>
284 <arg value="-Dsvn.devel.branch=${svn.devel.branch}"/>
285 <arg value="-DmapVersionTag=${mapVersionTag}"/>
286 <arg value="-DpathToMapFile=${pathToMapFile}"/>
287 <arg value="-DmapFileName=otdt.map"/>
288 <arg value="-Ddo.run.tests=${do.run.tests}"/>
289 <arg value="-Ddo.build.all=${do.build.all}"/>
290 <arg value="-Declipse-app.tgz=${eclipse-app.tgz}"/>
291 <arg value="-Declipse.tests.zip=${eclipse.tests.zip}"/>
292 <arg value="-Dotre.lib=${otre.lib}"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000293 <arg value="-verbose" />
294 <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 Herrmanndcd87c12010-04-25 10:59:27 +0000300
301 <!-- Generate accumulating metadata by pre-loading existing metadata: -->
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000302<!--
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000303 <copy failonerror="false" flatten="true" toDir="${otdtUpdatesDir}">
304 <fileset dir="${user.dir}/metadata">
305 <include name="*.xml"/>
306 </fileset>
307 </copy>
308 <ant antfile="${OTScriptDir}/p2helper.xml" dir="${buildDirectory}" target="generateMetadata"/>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000309-->
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000310
311 <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
345 <!-- currently unused target name="collectResults">
346 <ant target="collect" antfile="${test.eclipseDir}/plugins/${org.eclipse.test}/library.xml" dir="${otresults}">
347 <property name="includes" value="org.*.xml"/>
348 <property name="output-file" value="AllTestSuites.xml"/>
349 </ant>
350 </target -->
351
352</project>