blob: ae0ee7b6c7742a483aa203dbada66c69c8246fee [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:
21 eclipse.tests.zip= ${eclipse.tests.zip}
22path of bcel jar:
23 bcel.jar = ${bcel.jar}
24directory 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" />
55 <property name="base" value="${build.root.dir}" />
56 <property name="baseLocation" value="${build.root.dir}/eclipse" />
Stephan Herrmanndcd87c12010-04-25 10:59:27 +000057
58 <!-- directories for testing: -->
59 <property name="test.root.dir" value="${user.dir}/test-root" />
60 <!-- This name is used in individual test.xml of test plugins: -->
61 <property name="test.eclipseDir" value="${test.root.dir}/eclipse" />
62
63 <!-- directories for update sites: -->
64 <property name="otdtUpdatesDir" value="${user.dir}/updateSite"/>
65 <property name="testsUpdatesDirBase" value="${user.dir}/updateSiteTests"/>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +000066 <!-- will have sub directories "eclipse" and "otdt" -->
Stephan Herrmanndcd87c12010-04-25 10:59:27 +000067
68 <!-- ======== More Configuration Details: ======== -->
69 <!-- maybe obsolete: file prefix to distinguish output files. -->
70 <property name="file-id" value="XXX" />
71
72 <!-- Configure Java for STAGE 1 and STAGE 2 building: -->
73 <property name="vm" value="java" />
74 <property name="vm.args" value="-Xmx912m" />
75 <property name="vm.args2" value="-XX:MaxPermSize=128m" />
76
77 <property name="installmode" value="clean" />
78
79 <property name="saxon.jar.name" value="saxon8.jar" />
80 <property name="saxon.jar.path" value="${user.home}/.ant/lib/${saxon.jar.name}" />
81 <available file="${saxon.jar.path}" property="_hasSaxon.jar" />
82
83 <!-- ant's os.arch is slightly different than osgi's arch -->
Stephan Herrmann1a9d85a2010-05-17 22:45:31 +000084 <condition property="arch" value="x86_64"> <!-- HACK: hard coding 64-bit architecture -->
Stephan Herrmanndcd87c12010-04-25 10:59:27 +000085 <os arch="i386" />
86 </condition>
87 <condition property="arch" value="ppc64"> <!-- HACK: hard coding 64-bit architecture -->
88 <os arch="ppc" />
89 </condition>
Stephan Herrmann005fc312010-05-18 12:52:58 +000090 <condition property="arch" value="x86_64"> <!-- Map ant's arch to OSGi arch -->
91 <os arch="amd64" />
92 </condition>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +000093 <!-- if not set above, set it to os.arch -->
94 <property name="arch" value="${os.arch}" />
95
96 </target>
97
98
99 <target name="INFO">
100 <echo>Usage:
101 ant -f run.xml ot-junit-all -> runs OTDT Build and Testprocess
102 ant -f run.xml ot-junit-build -> runs just OTDT Buildprocess
103 ant -f run.xml ot-junit-run -> runs just OTDT Tests w/o TestSetup
104 </echo>
105 </target>
106
107 <target name="ot-junit-all" depends="setupProperties,checkOS" description="Build all and run all tests.">
108 <echo message="Starting BuildProcess and Testrun in ${build.root.dir}"/>
109 <antcall target="verifyAntInstall"/>
110 <antcall target="setupTests" />
111 <antcall target="runAllTests"/>
112 </target>
113
114 <target name="ot-junit-build" depends="setupProperties,checkOS" description="build everything without running tests">
115 <echo message="Starting BuildProcess in ${build.root.dir}"/>
116 <antcall target="verifyAntInstall"/>
117 <antcall target="createOTDTEclipse"/>
118 </target>
119
120 <target name="ot-junit-run" depends="setupProperties,checkOS" description="Run tests without building">
121 <echo message="Starting Testrun ${test.root.dir}"/>
122 <antcall target="runAllTests" />
123 </target>
124
125 <!-- =================== END Public Targets ==================== -->
126
127 <!-- === Setup Targets: === -->
128
129 <target name="verifyAntInstall" unless="_hasSaxon.jar">
130 <copy failonerror="true" overwrite="false" file="${OTScriptDir}/${saxon.jar.name}" tofile="${saxon.jar.path}"></copy>
131 <echo message="Needed to copy saxon8.jar to ${saxon.jar.path}. Please restart the build." />
132 <echo message="For an explanation, see http://ant.apache.org/faq.html#delegating-classloader-1.6" />
133 <fail message="See above. Please restart the build."/>
134 </target>
135
136 <!-- checks on which os ant is run, set ${os} and ${ws} accordingly -->
137 <target name="determineOS">
138 <condition property="os.isWindows">
139 <os family="windows"/>
140 </condition>
141
142 <condition property="os.isLinux">
143 <os name="Linux" />
144 </condition>
145 </target>
146
147 <target name="checkOS" depends="determineOS,windows,linux"/>
148
149 <target name="windows" if="os.isWindows">
150 <echo message="OS is Windows"/>
151 <property name="os" value="win32" />
152 <property name="ws" value="win32" />
153 </target>
154
155 <target name="linux" unless="os.isWindows" >
156 <echo message="OS is Linux"/>
157 <!-- eclipse-app.tgz is already passed from the calling script -->
158 <property name="os" value="linux" />
159 <property name="ws" value="gtk" />
160 </target>
161
162 <target name="setupForCompile" depends="checkOS" unless="_hasCreatedOTDTEclipse">
163 <antcall target="UnzipEclipse"/>
164 <antcall target="AddPluginsToEclipse"/>
165 </target>
166
167 <target name="UnzipEclipse">
168 <echo message="Extracting Eclipse (${eclipse-app.tgz}) in ${build.root.dir}..."/>
169 <mkdir dir="${build.root.dir}"/>
170 <untar compression="gzip" src="${eclipse-app.tgz}" dest="${build.root.dir}"/>
171 </target>
172
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000173 <target name="AddPluginsToEclipse" description="Add svn.pde.build plugin to the base Eclipse">
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000174 <mkdir dir="${baseLocation}/dropins/plugins"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000175 <copy file="${OTScriptDir}/lib/${svn.pde.build}" todir="${baseLocation}/dropins/plugins" />
176 </target>
177
178 <!-- ==== BUILDING AND RUNNING: ==== -->
179
180 <!-- ==== BUILD STAGE 1: ==== -->
181 <!-- setting an empty inputstring is a workaround for http://issues.apache.org/bugzilla/show_bug.cgi?id=34461 -->
182 <target name="createOTCompilerEclipse" depends="setupForCompile" description="create the bootstrapping Eclipse with OT/J compiler">
183 <echo message="Invoke pdebuild for creating the OT-Compiler"/>
184 <java
185 inputstring=""
186 dir="${baseLocation}"
187 fork="true"
188 classname="org.eclipse.equinox.launcher.Main"
189 classpath="${baseLocation}/plugins/${org.eclipse.equinox.launcher_jar}">
190 <arg value="-Dosgi.ws=${ws}"/>
191 <arg value="-Dosgi.os=${os}"/>
192 <arg value="-Dosgi.arch=${arch}"/>
193 <arg value="-application"/>
194 <arg value="org.eclipse.ant.core.antRunner"/>
195 <arg value="-buildfile"/>
196 <arg value="${buildfile}"/>
197 <arg value="-Dbuild.root.dir=${build.root.dir}"/>
198 <arg value="-DbaseLocation=${baseLocation}"/>
199 <arg value="-DOTScriptDir=${OTScriptDir}"/>
200 <arg value="-Drun.eclipseScriptDir=${run.eclipseScriptDir}"/>
201 <arg value="-Dbuilder=${builder-otcompiler}"/>
202 <arg value="-D${installmode}=true"/> <!-- <- obsolete? -->
203 <arg value="-Dcomponent.short=OT-Compiler"/>
204 <arg value="-Dconfigs=*,*,*"/>
205 <arg value="-Dbaseos=${os}"/>
206 <arg value="-Dbasews=${ws}"/>
207 <arg value="-Dbasearch=${arch}"/>
208 <arg value="-Dtest.root.dir=${test.root.dir}"/>
209 <arg value="-Dtest.eclipseDir=${test.eclipseDir}"/>
210 <arg value="-DmapVersionTag=${mapVersionTag}"/>
211 <arg value="-DpathToMapFile=${pathToMapFile}"/>
212 <arg value="-DmapFileName=ot-compiler.map"/>
213 <arg value="-Dsvn.repository.url=${svn.repository.url}"/>
214 <arg value="-Declipse-app.tgz=${eclipse-app.tgz}"/>
215 <arg value="-Declipse.tests.zip=${eclipse.tests.zip}"/>
216 <arg value="-verbose" />
217 <jvmarg value="${vm.args}"/>
218 <jvmarg value="${vm.args2}"/>
219 </java>
220 <!-- At this point a zip file containing the new jdt.core-plugin exists in
221 ${build.root.dir}/org.eclipse.objectteams.otdt-${buildId}.zip
222 which has already been installed into ${baseLocation} as to replace the
223 original plugin jar of exact same name (see OT-Compiler/customTargets.xml#postBuild)..
224 -->
225 </target>
226
227 <!-- ==== BUILD STAGE 2: ==== -->
228 <!-- setting an empty inputstring is a workaround for http://issues.apache.org/bugzilla/show_bug.cgi?id=34461 -->
229 <target name="createOTDTEclipse" depends="createOTCompilerEclipse" unless="_hasCreatedOTDTEclipse">
230
231 <!-- Make org.eclipse.test.performance available while compiling test projects: -->
232 <echo message="Pre-installing Eclipse Test Framework into OTCompilerEclipse..."/>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000233 <mkdir dir="${testsUpdatesDirBase}"/>
234 <unzip dest="${testsUpdatesDirBase}" src="${eclipse.tests.zip}"/> <!-- unfolds into "eclipse" subdir -->
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000235 <ant antfile="${OTScriptDir}/p2helper.xml" target="installFeature" dir="${baseLocation}">
236 <property name="feature" value="org.eclipse.test.feature.group"/>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000237 <property name="sourceUpdatesDir" value="${testsUpdatesDirBase}/eclipse"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000238 <property name="targetEclipseDir" value="${baseLocation}"/>
239 </ant>
240
241 <echo message="Invoke pdebuild for creating a full OTDT"/>
242 <java
243 inputstring=""
244 dir="${baseLocation}"
245 fork="true"
246 classname="org.eclipse.equinox.launcher.Main"
247 classpath="${baseLocation}/plugins/${org.eclipse.equinox.launcher_jar}">
248 <arg value="-clean"/>
249 <arg value="-Dosgi.ws=${ws}"/>
250 <arg value="-Dosgi.os=${os}"/>
251 <arg value="-Dosgi.arch=${arch}"/>
252 <arg value="-application"/>
253 <arg value="org.eclipse.ant.core.antRunner"/>
254 <arg value="-buildfile"/>
255 <arg value="${buildfile}"/>
256 <arg value="-Dbuild.root.dir=${build.root.dir}"/>
257 <arg value="-DbaseLocation=${baseLocation}"/>
258 <arg value="-Drun.eclipseScriptDir=${run.eclipseScriptDir}"/>
259 <arg value="-DOTScriptDir=${OTScriptDir}"/>
260 <arg value="-Dbuilder=${builder-otdt}"/>
261 <arg value="-D${installmode}=true"/>
262 <arg value="-Dcomponent.short=OTDT-Build"/>
263 <arg value="-DotdtUpdatesDir=${otdtUpdatesDir}"/>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000264 <arg value="-DtestsUpdatesDirBase=${testsUpdatesDirBase}"/>
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000265 <arg value="-Dbaseos=${os}"/>
266 <arg value="-Dbasews=${ws}"/>
267 <arg value="-Dbasearch=${arch}"/>
268 <arg value="-Dtest.root.dir=${test.root.dir}"/>
269 <arg value="-Dtest.eclipseDir=${test.eclipseDir}"/>
270 <arg value="-Dsvn.repository.url=${svn.repository.url}"/>
271 <arg value="-Dsvn.devel.branch=${svn.devel.branch}"/>
272 <arg value="-DmapVersionTag=${mapVersionTag}"/>
273 <arg value="-DpathToMapFile=${pathToMapFile}"/>
274 <arg value="-DmapFileName=otdt.map"/>
275 <arg value="-Ddo.run.tests=${do.run.tests}"/>
276 <arg value="-Ddo.build.all=${do.build.all}"/>
277 <arg value="-Declipse-app.tgz=${eclipse-app.tgz}"/>
278 <arg value="-Declipse.tests.zip=${eclipse.tests.zip}"/>
279 <arg value="-Dotre.lib=${otre.lib}"/>
280 <arg value="-Dbcel.jar=${bcel.jar}"/>
281 <arg value="-verbose" />
282 <jvmarg value="${vm.args}"/>
283 <jvmarg value="${vm.args2}"/>
284 <!-- arg value="${verboseAnt}"/ -->
285 <!-- arg value="-debug" / -->
286 </java>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000287 <!-- At this point a local update site exists, thanks to p2gathering=true -->
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000288
289 <!-- Generate accumulating metadata by pre-loading existing metadata: -->
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000290<!--
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000291 <copy failonerror="false" flatten="true" toDir="${otdtUpdatesDir}">
292 <fileset dir="${user.dir}/metadata">
293 <include name="*.xml"/>
294 </fileset>
295 </copy>
296 <ant antfile="${OTScriptDir}/p2helper.xml" dir="${buildDirectory}" target="generateMetadata"/>
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000297-->
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000298
299 <property name="_hasCreatedOTDTEclipse" value="true" />
300 </target>
301
302 <!-- TESTING at STAGE 3: -->
303 <target name="setupTests" depends="createOTDTEclipse" description="Install the tests into an fresh OTDT">
304 <available file="${buildDirectory}/label.properties" property="label.properties.exists" />
305 <ant antfile="${OTScriptDir}/test.xml" target="setupTests" dir="${build.root.dir}">
306 <property name="os" value="${os}" />
307 <property name="ws" value="${ws}" />
308 <property name="arch" value="${arch}" />
309 <property name="baseos" value="${os}" />
310 <property name="basews" value="${ws}" />
311 <property name="basearch" value="${arch}" />
312 <property name="eclipse-app.tgz" value="${eclipse-app.tgz}" />
313 <property file="${buildDirectory}/label.properties" />
314 <property name="otdtUpdatesDir" value="${otdtUpdatesDir}" />
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000315 <property name="testsUpdatesDirBase" value="${testsUpdatesDirBase}" />
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000316 </ant>
317 </target>
318
319 <target name="runAllTests" description="Delegate to the next level script to perform the actual testing.">
320 <ant antfile="${OTScriptDir}/test.xml" target="all" dir="${build.root.dir}">
321 <property name="os" value="${os}" />
322 <property name="ws" value="${ws}" />
323 <property name="arch" value="${arch}" />
324 <property name="baseos" value="${os}" />
325 <property name="basews" value="${ws}" />
326 <property name="basearch" value="${arch}" />
327 <property name="otdtUpdatesDir" value="${otdtUpdatesDir}" />
Stephan Herrmann20ff77c2010-06-03 09:31:09 +0000328 <property name="testsUpdatesDirBase" value="${testsUpdatesDirBase}" />
Stephan Herrmanndcd87c12010-04-25 10:59:27 +0000329 <property name="vmargs" value="${vmargs}" />
330 </ant>
331 </target>
332
333 <!-- currently unused target name="collectResults">
334 <ant target="collect" antfile="${test.eclipseDir}/plugins/${org.eclipse.test}/library.xml" dir="${otresults}">
335 <property name="includes" value="org.*.xml"/>
336 <property name="output-file" value="AllTestSuites.xml"/>
337 </ant>
338 </target -->
339
340</project>