blob: dd2b1b5c74b59fa515f01232df77631479b408e9 [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" />
53 <!-- Both these names are hard coded in pde-build: -->
54 <property name="buildDirectory" value="${build.root.dir}/src" />
55 <property name="baseLocation" value="${build.root.dir}/eclipse" />
56
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"/>
65 <property name="testsUpdatesDir" value="${testsUpdatesDirBase}/eclipse"/>
66
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
172 <target name="AddPluginsToEclipse" description="Add bcel and svn.pde.build plugins to the base Eclipse">
173 <mkdir dir="${baseLocation}/dropins/plugins"/>
174 <copy file="${bcel.jar}" todir="${baseLocation}/dropins/plugins"/>
175 <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..."/>
233 <mkdir dir="${testsUpdatesDir}"/>
234 <unzip dest="${testsUpdatesDirBase}" src="${eclipse.tests.zip}"/>
235 <ant antfile="${OTScriptDir}/p2helper.xml" target="installFeature" dir="${baseLocation}">
236 <property name="feature" value="org.eclipse.test.feature.group"/>
237 <property name="sourceUpdatesDir" value="${testsUpdatesDir}"/>
238 <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}"/>
264 <arg value="-Dbaseos=${os}"/>
265 <arg value="-Dbasews=${ws}"/>
266 <arg value="-Dbasearch=${arch}"/>
267 <arg value="-Dtest.root.dir=${test.root.dir}"/>
268 <arg value="-Dtest.eclipseDir=${test.eclipseDir}"/>
269 <arg value="-Dsvn.repository.url=${svn.repository.url}"/>
270 <arg value="-Dsvn.devel.branch=${svn.devel.branch}"/>
271 <arg value="-DmapVersionTag=${mapVersionTag}"/>
272 <arg value="-DpathToMapFile=${pathToMapFile}"/>
273 <arg value="-DmapFileName=otdt.map"/>
274 <arg value="-Ddo.run.tests=${do.run.tests}"/>
275 <arg value="-Ddo.build.all=${do.build.all}"/>
276 <arg value="-Declipse-app.tgz=${eclipse-app.tgz}"/>
277 <arg value="-Declipse.tests.zip=${eclipse.tests.zip}"/>
278 <arg value="-Dotre.lib=${otre.lib}"/>
279 <arg value="-Dbcel.jar=${bcel.jar}"/>
280 <arg value="-verbose" />
281 <jvmarg value="${vm.args}"/>
282 <jvmarg value="${vm.args2}"/>
283 <!-- arg value="${verboseAnt}"/ -->
284 <!-- arg value="-debug" / -->
285 </java>
286 <!-- At this point a local update site exists
287 (created from build.xml#postOTDT-Build -> p2helper.xml#createLocalUpdateSite)
288 -->
289
290 <!-- Generate accumulating metadata by pre-loading existing metadata: -->
291 <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"/>
297
298 <property name="_hasCreatedOTDTEclipse" value="true" />
299 </target>
300
301 <!-- TESTING at STAGE 3: -->
302 <target name="setupTests" depends="createOTDTEclipse" description="Install the tests into an fresh OTDT">
303 <available file="${buildDirectory}/label.properties" property="label.properties.exists" />
304 <ant antfile="${OTScriptDir}/test.xml" target="setupTests" dir="${build.root.dir}">
305 <property name="os" value="${os}" />
306 <property name="ws" value="${ws}" />
307 <property name="arch" value="${arch}" />
308 <property name="baseos" value="${os}" />
309 <property name="basews" value="${ws}" />
310 <property name="basearch" value="${arch}" />
311 <property name="eclipse-app.tgz" value="${eclipse-app.tgz}" />
312 <property file="${buildDirectory}/label.properties" />
313 <property name="otdtUpdatesDir" value="${otdtUpdatesDir}" />
314 <property name="testsUpdatesDir" value="${testsUpdatesDir}" />
315 </ant>
316 </target>
317
318 <target name="runAllTests" description="Delegate to the next level script to perform the actual testing.">
319 <ant antfile="${OTScriptDir}/test.xml" target="all" dir="${build.root.dir}">
320 <property name="os" value="${os}" />
321 <property name="ws" value="${ws}" />
322 <property name="arch" value="${arch}" />
323 <property name="baseos" value="${os}" />
324 <property name="basews" value="${ws}" />
325 <property name="basearch" value="${arch}" />
326 <property name="otdtUpdatesDir" value="${otdtUpdatesDir}" />
327 <property name="testsUpdatesDir" value="${testsUpdatesDir}" />
328 <property name="vmargs" value="${vmargs}" />
329 </ant>
330 </target>
331
332 <!-- currently unused target name="collectResults">
333 <ant target="collect" antfile="${test.eclipseDir}/plugins/${org.eclipse.test}/library.xml" dir="${otresults}">
334 <property name="includes" value="org.*.xml"/>
335 <property name="output-file" value="AllTestSuites.xml"/>
336 </ant>
337 </target -->
338
339</project>