Stephan Herrmann | dcd87c1 | 2010-04-25 10:59:27 +0000 | [diff] [blame] | 1 | <?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 | ------------------------------------------------------------------------------ |
| 18 | path of eclipse SDK: |
| 19 | eclipse-app.tgz = ${eclipse-app.tgz} |
| 20 | path of eclipse test framework: |
| 21 | eclipse.tests.zip= ${eclipse.tests.zip} |
Stephan Herrmann | dcd87c1 | 2010-04-25 10:59:27 +0000 | [diff] [blame] | 22 | directory to otre jars: |
| 23 | otre.lib = ${otre.lib} |
| 24 | should sources be built (true|false)? |
| 25 | do.build.all = ${do.build.all} |
| 26 | should 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 Herrmann | 33c2604 | 2010-06-03 10:24:16 +0000 | [diff] [blame] | 51 | <!-- These names are hard coded in pde-build: --> |
| 52 | <property name="buildDirectory" value="${build.root.dir}/src" /> |
Stephan Herrmann | 33c2604 | 2010-06-03 10:24:16 +0000 | [diff] [blame] | 53 | <property name="baseLocation" value="${build.root.dir}/eclipse" /> |
Stephan Herrmann | dcd87c1 | 2010-04-25 10:59:27 +0000 | [diff] [blame] | 54 | |
| 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 Herrmann | 20ff77c | 2010-06-03 09:31:09 +0000 | [diff] [blame] | 63 | <!-- will have sub directories "eclipse" and "otdt" --> |
Stephan Herrmann | dcd87c1 | 2010-04-25 10:59:27 +0000 | [diff] [blame] | 64 | |
| 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 Herrmann | 1a9d85a | 2010-05-17 22:45:31 +0000 | [diff] [blame] | 81 | <condition property="arch" value="x86_64"> <!-- HACK: hard coding 64-bit architecture --> |
Stephan Herrmann | dcd87c1 | 2010-04-25 10:59:27 +0000 | [diff] [blame] | 82 | <os arch="i386" /> |
| 83 | </condition> |
| 84 | <condition property="arch" value="ppc64"> <!-- HACK: hard coding 64-bit architecture --> |
| 85 | <os arch="ppc" /> |
| 86 | </condition> |
Stephan Herrmann | 005fc31 | 2010-05-18 12:52:58 +0000 | [diff] [blame] | 87 | <condition property="arch" value="x86_64"> <!-- Map ant's arch to OSGi arch --> |
| 88 | <os arch="amd64" /> |
| 89 | </condition> |
Stephan Herrmann | dcd87c1 | 2010-04-25 10:59:27 +0000 | [diff] [blame] | 90 | <!-- 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 Herrmann | 20ff77c | 2010-06-03 09:31:09 +0000 | [diff] [blame] | 170 | <target name="AddPluginsToEclipse" description="Add svn.pde.build plugin to the base Eclipse"> |
Stephan Herrmann | dcd87c1 | 2010-04-25 10:59:27 +0000 | [diff] [blame] | 171 | <mkdir dir="${baseLocation}/dropins/plugins"/> |
Stephan Herrmann | dcd87c1 | 2010-04-25 10:59:27 +0000 | [diff] [blame] | 172 | <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}"/> |
| 213 | <arg value="-verbose" /> |
| 214 | <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 Herrmann | 20ff77c | 2010-06-03 09:31:09 +0000 | [diff] [blame] | 230 | <mkdir dir="${testsUpdatesDirBase}"/> |
| 231 | <unzip dest="${testsUpdatesDirBase}" src="${eclipse.tests.zip}"/> <!-- unfolds into "eclipse" subdir --> |
Stephan Herrmann | dcd87c1 | 2010-04-25 10:59:27 +0000 | [diff] [blame] | 232 | <ant antfile="${OTScriptDir}/p2helper.xml" target="installFeature" dir="${baseLocation}"> |
| 233 | <property name="feature" value="org.eclipse.test.feature.group"/> |
Stephan Herrmann | 20ff77c | 2010-06-03 09:31:09 +0000 | [diff] [blame] | 234 | <property name="sourceUpdatesDir" value="${testsUpdatesDirBase}/eclipse"/> |
Stephan Herrmann | dcd87c1 | 2010-04-25 10:59:27 +0000 | [diff] [blame] | 235 | <property name="targetEclipseDir" value="${baseLocation}"/> |
| 236 | </ant> |
| 237 | |
| 238 | <echo message="Invoke pdebuild for creating a full OTDT"/> |
| 239 | <java |
| 240 | inputstring="" |
| 241 | dir="${baseLocation}" |
| 242 | fork="true" |
| 243 | classname="org.eclipse.equinox.launcher.Main" |
| 244 | classpath="${baseLocation}/plugins/${org.eclipse.equinox.launcher_jar}"> |
| 245 | <arg value="-clean"/> |
| 246 | <arg value="-Dosgi.ws=${ws}"/> |
| 247 | <arg value="-Dosgi.os=${os}"/> |
| 248 | <arg value="-Dosgi.arch=${arch}"/> |
| 249 | <arg value="-application"/> |
| 250 | <arg value="org.eclipse.ant.core.antRunner"/> |
| 251 | <arg value="-buildfile"/> |
| 252 | <arg value="${buildfile}"/> |
| 253 | <arg value="-Dbuild.root.dir=${build.root.dir}"/> |
| 254 | <arg value="-DbaseLocation=${baseLocation}"/> |
| 255 | <arg value="-Drun.eclipseScriptDir=${run.eclipseScriptDir}"/> |
| 256 | <arg value="-DOTScriptDir=${OTScriptDir}"/> |
| 257 | <arg value="-Dbuilder=${builder-otdt}"/> |
| 258 | <arg value="-D${installmode}=true"/> |
| 259 | <arg value="-Dcomponent.short=OTDT-Build"/> |
| 260 | <arg value="-DotdtUpdatesDir=${otdtUpdatesDir}"/> |
Stephan Herrmann | 20ff77c | 2010-06-03 09:31:09 +0000 | [diff] [blame] | 261 | <arg value="-DtestsUpdatesDirBase=${testsUpdatesDirBase}"/> |
Stephan Herrmann | dcd87c1 | 2010-04-25 10:59:27 +0000 | [diff] [blame] | 262 | <arg value="-Dbaseos=${os}"/> |
| 263 | <arg value="-Dbasews=${ws}"/> |
| 264 | <arg value="-Dbasearch=${arch}"/> |
| 265 | <arg value="-Dtest.root.dir=${test.root.dir}"/> |
| 266 | <arg value="-Dtest.eclipseDir=${test.eclipseDir}"/> |
| 267 | <arg value="-Dsvn.repository.url=${svn.repository.url}"/> |
| 268 | <arg value="-Dsvn.devel.branch=${svn.devel.branch}"/> |
| 269 | <arg value="-DmapVersionTag=${mapVersionTag}"/> |
| 270 | <arg value="-DpathToMapFile=${pathToMapFile}"/> |
| 271 | <arg value="-DmapFileName=otdt.map"/> |
| 272 | <arg value="-Ddo.run.tests=${do.run.tests}"/> |
| 273 | <arg value="-Ddo.build.all=${do.build.all}"/> |
| 274 | <arg value="-Declipse-app.tgz=${eclipse-app.tgz}"/> |
| 275 | <arg value="-Declipse.tests.zip=${eclipse.tests.zip}"/> |
| 276 | <arg value="-Dotre.lib=${otre.lib}"/> |
Stephan Herrmann | dcd87c1 | 2010-04-25 10:59:27 +0000 | [diff] [blame] | 277 | <arg value="-verbose" /> |
| 278 | <jvmarg value="${vm.args}"/> |
| 279 | <jvmarg value="${vm.args2}"/> |
| 280 | <!-- arg value="${verboseAnt}"/ --> |
| 281 | <!-- arg value="-debug" / --> |
| 282 | </java> |
Stephan Herrmann | 20ff77c | 2010-06-03 09:31:09 +0000 | [diff] [blame] | 283 | <!-- At this point a local update site exists, thanks to p2gathering=true --> |
Stephan Herrmann | dcd87c1 | 2010-04-25 10:59:27 +0000 | [diff] [blame] | 284 | |
| 285 | <!-- Generate accumulating metadata by pre-loading existing metadata: --> |
Stephan Herrmann | 20ff77c | 2010-06-03 09:31:09 +0000 | [diff] [blame] | 286 | <!-- |
Stephan Herrmann | dcd87c1 | 2010-04-25 10:59:27 +0000 | [diff] [blame] | 287 | <copy failonerror="false" flatten="true" toDir="${otdtUpdatesDir}"> |
| 288 | <fileset dir="${user.dir}/metadata"> |
| 289 | <include name="*.xml"/> |
| 290 | </fileset> |
| 291 | </copy> |
| 292 | <ant antfile="${OTScriptDir}/p2helper.xml" dir="${buildDirectory}" target="generateMetadata"/> |
Stephan Herrmann | 20ff77c | 2010-06-03 09:31:09 +0000 | [diff] [blame] | 293 | --> |
Stephan Herrmann | dcd87c1 | 2010-04-25 10:59:27 +0000 | [diff] [blame] | 294 | |
| 295 | <property name="_hasCreatedOTDTEclipse" value="true" /> |
| 296 | </target> |
| 297 | |
| 298 | <!-- TESTING at STAGE 3: --> |
| 299 | <target name="setupTests" depends="createOTDTEclipse" description="Install the tests into an fresh OTDT"> |
| 300 | <available file="${buildDirectory}/label.properties" property="label.properties.exists" /> |
| 301 | <ant antfile="${OTScriptDir}/test.xml" target="setupTests" dir="${build.root.dir}"> |
| 302 | <property name="os" value="${os}" /> |
| 303 | <property name="ws" value="${ws}" /> |
| 304 | <property name="arch" value="${arch}" /> |
| 305 | <property name="baseos" value="${os}" /> |
| 306 | <property name="basews" value="${ws}" /> |
| 307 | <property name="basearch" value="${arch}" /> |
| 308 | <property name="eclipse-app.tgz" value="${eclipse-app.tgz}" /> |
| 309 | <property file="${buildDirectory}/label.properties" /> |
| 310 | <property name="otdtUpdatesDir" value="${otdtUpdatesDir}" /> |
Stephan Herrmann | 20ff77c | 2010-06-03 09:31:09 +0000 | [diff] [blame] | 311 | <property name="testsUpdatesDirBase" value="${testsUpdatesDirBase}" /> |
Stephan Herrmann | dcd87c1 | 2010-04-25 10:59:27 +0000 | [diff] [blame] | 312 | </ant> |
| 313 | </target> |
| 314 | |
| 315 | <target name="runAllTests" description="Delegate to the next level script to perform the actual testing."> |
| 316 | <ant antfile="${OTScriptDir}/test.xml" target="all" dir="${build.root.dir}"> |
| 317 | <property name="os" value="${os}" /> |
| 318 | <property name="ws" value="${ws}" /> |
| 319 | <property name="arch" value="${arch}" /> |
| 320 | <property name="baseos" value="${os}" /> |
| 321 | <property name="basews" value="${ws}" /> |
| 322 | <property name="basearch" value="${arch}" /> |
| 323 | <property name="otdtUpdatesDir" value="${otdtUpdatesDir}" /> |
Stephan Herrmann | 20ff77c | 2010-06-03 09:31:09 +0000 | [diff] [blame] | 324 | <property name="testsUpdatesDirBase" value="${testsUpdatesDirBase}" /> |
Stephan Herrmann | dcd87c1 | 2010-04-25 10:59:27 +0000 | [diff] [blame] | 325 | <property name="vmargs" value="${vmargs}" /> |
| 326 | </ant> |
| 327 | </target> |
| 328 | |
| 329 | <!-- currently unused target name="collectResults"> |
| 330 | <ant target="collect" antfile="${test.eclipseDir}/plugins/${org.eclipse.test}/library.xml" dir="${otresults}"> |
| 331 | <property name="includes" value="org.*.xml"/> |
| 332 | <property name="output-file" value="AllTestSuites.xml"/> |
| 333 | </ant> |
| 334 | </target --> |
| 335 | |
| 336 | </project> |