david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <project |
| 3 | name="buildutilities" |
| 4 | default="nodefault" |
| 5 | basedir="."> |
| 6 | |
| 7 | <!-- = = = standard properties pattern = = = --> |
| 8 | <!-- |
| 9 | Note to be cross-platform, "environment variables" are only |
| 10 | appropriate for some variables, e.g. ones we set, since |
| 11 | properties are case sensitive, even if the environment variables |
| 12 | on your operating system are not, e.g. it will be ${env.Path} |
| 13 | not ${env.PATH} on Windows |
| 14 | --> |
david_williams | dc454d3 | 2010-04-04 04:29:41 +0000 | [diff] [blame] | 15 | <property |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 16 | environment="env"/> |
| 17 | <!-- |
| 18 | Let users override standard properties, if desired. If |
| 19 | directory, file, or some properties do not exist, then standard |
| 20 | properties will be used. |
| 21 | --> |
| 22 | <property |
| 23 | file="${env.LOCAL_BUILD_PROPERTIES_DIR}/${ant.project.name}.properties"/> |
| 24 | |
| 25 | <!-- = = = end standard properties pattern = = = --> |
| 26 | |
| 27 | |
| 28 | <!-- if not otherwise set, use these default properties --> |
| 29 | <property |
| 30 | name="debugOptimization" |
| 31 | value="false"/> |
| 32 | <!-- |
| 33 | We should not always normalize ("-repack") jars by default, |
| 34 | since in production we sign the jars (which does the -repack for |
| 35 | us) and not in production we don't really care so why spend the |
| 36 | extra time. For jars which are not supposed to be normalized, |
| 37 | such as pre-existing jars, they need to be added to the |
| 38 | pack.properties file (see the updatePackProperties task). Note: |
| 39 | signing does the -repack when we sign. This can be over-ridden |
| 40 | by the caller setting normalize to true, but there are know |
| 41 | known cases where we want to normalize (and eventually pack) the |
| 42 | jar files but not sign them. |
| 43 | --> |
| 44 | <property |
| 45 | name="normalizeJarFiles" |
| 46 | value="false"/> |
| 47 | <!-- |
| 48 | we'll currently pack jar files, just as part of "debugging" to |
| 49 | help sanity check all is working as expected. Eventually we may |
| 50 | want to provide some service there jar files in the bundles |
| 51 | directory are packed ... but, there's no known use-case for this |
| 52 | so far |
| 53 | --> |
| 54 | <property |
| 55 | name="packJarFiles" |
| 56 | value="false"/> |
| 57 | <!-- |
| 58 | Let tmp site be global. Note: we use this odd |
| 59 | "tmpsite-archiveName-temp" to make sure unique directories, |
| 60 | since in some cases these directories can not be deleted from |
| 61 | ant, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=142926, |
| 62 | and since directory names ending in .zip are misinterpreted by |
| 63 | jarProcessor, see |
| 64 | https://bugs.eclipse.org/bugs/show_bug.cgi?id=143385 But, its |
| 65 | handy to do as unique directories anyway, since if a larger |
| 66 | process calls this mulitiple times, on different zips, and if |
| 67 | debugging is turnned on, then all the tmpsite directories are |
| 68 | left on disk for post-build inspection. |
| 69 | --> |
| 70 | <property |
| 71 | name="tmpsite" |
| 72 | value="${buildDirectory}/tmpsite-${archiveName}-temp"/> |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 73 | <target |
david_williams | a544b1f | 2010-04-04 03:17:30 +0000 | [diff] [blame] | 74 | name="conditionAndSignJars" |
david_williams | e06113e | 2010-04-04 04:39:36 +0000 | [diff] [blame] | 75 | depends="init"> |
| 76 | <!-- |
david_williams | dc454d3 | 2010-04-04 04:29:41 +0000 | [diff] [blame] | 77 | if="doSign"> |
david_williams | e06113e | 2010-04-04 04:39:36 +0000 | [diff] [blame] | 78 | --> |
| 79 | <!-- |
david_williams | dc454d3 | 2010-04-04 04:29:41 +0000 | [diff] [blame] | 80 | get zip for signing exclude content* artifacts* add |
| 81 | pack.properties send to eclipse and wait write over |
| 82 | p2.build.repo, but update content and artifacts files remove |
| 83 | temp file |
| 84 | --> |
david_williams | 2490246 | 2010-04-04 04:54:38 +0000 | [diff] [blame] | 85 | <echo message="p2.build.repo: ${p2.build.repo}"/> |
david_williams | dc454d3 | 2010-04-04 04:29:41 +0000 | [diff] [blame] | 86 | <zip |
| 87 | destfile="${buildDirectory}/${buildLabel}/temp-${buildLabel}-${component}.zip"> |
| 88 | <zipfileset |
david_williams | 6b72318 | 2010-04-04 05:04:17 +0000 | [diff] [blame] | 89 | dir="${buildDirectory}/${buildLabel}/${component}/repository/" |
david_williams | dc454d3 | 2010-04-04 04:29:41 +0000 | [diff] [blame] | 90 | excludes="content.xml,content.jar,artifacts.xml,artifacts.jar"/> |
| 91 | </zip> |
| 92 | <updatePackProperties |
| 93 | archiveFilename="${buildDirectory}/${buildLabel}/temp-${buildLabel}-${component}.zip"/> |
| 94 | <!-- |
| 95 | comment out when debugging, for original zip files, before |
| 96 | updatePackProperties ran |
| 97 | |
| 98 | <delete |
| 99 | file="${buildDirectory}/${buildLabel}/temp-${buildLabel}-${component}.zip.bak"/> |
| 100 | --> |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 101 | <!-- |
| 102 | ================================================================================== |
david_williams | dc454d3 | 2010-04-04 04:29:41 +0000 | [diff] [blame] | 103 | sign the jars in archive file |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 104 | ================================================================================== |
| 105 | --> |
david_williams | dc454d3 | 2010-04-04 04:29:41 +0000 | [diff] [blame] | 106 | <!-- |
| 107 | <ant |
| 108 | antfile="${wtp.builder.home}/scripts/build/signjars.xml"> |
| 109 | <property |
| 110 | name="archiveName" |
| 111 | value="temp-${buildLabel}-${component}.zip"/> |
| 112 | </ant> |
| 113 | --> |
| 114 | <unzip |
david_williams | 0b719c6 | 2010-04-04 05:09:59 +0000 | [diff] [blame] | 115 | dest="${buildDirectory}/${buildLabel}/${component}/repository/" |
david_williams | 2cf184a | 2010-04-04 05:10:20 +0000 | [diff] [blame^] | 116 | src="${buildDirectory}/${buildLabel}/temp-${buildLabel}-${component}.zip" |
| 117 | overwrite="true"/> |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 118 | |
david_williams | dc454d3 | 2010-04-04 04:29:41 +0000 | [diff] [blame] | 119 | |
| 120 | <!-- TODO we could add 'pack' to this task, if desierd --> |
| 121 | <p2.process.artifacts |
| 122 | repositoryPath="${p2.build.repo}"/> |
| 123 | <!-- |
| 124 | remove our temp zip file, once tested, debugged <delete |
| 125 | file="${buildDirectory}/${buildLabel}/temp-${buildLabel}-${component}.zip"/> |
| 126 | --> |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 127 | </target> |
| 128 | <!-- |
| 129 | ============================================================================================== |
| 130 | Utility and Helper tasks |
| 131 | ============================================================================================== |
| 132 | --> |
| 133 | <target |
| 134 | name="init" |
| 135 | depends="check.sign"> |
| 136 | <condition |
| 137 | property="verboseIfDebug" |
| 138 | value="-verbose" |
| 139 | else=""> |
| 140 | <istrue |
| 141 | value="${debugOptimization}"/> |
| 142 | </condition> |
| 143 | <condition |
| 144 | property="logIfDebug" |
| 145 | value="-debug -consolelog" |
| 146 | else=""> |
| 147 | <istrue |
| 148 | value="${debugOptimization}"/> |
| 149 | </condition> |
| 150 | <condition |
| 151 | property="keepIfDebug" |
| 152 | value="true"> |
| 153 | <istrue |
| 154 | value="${debugOptimization}"/> |
| 155 | </condition> |
| 156 | <!-- don't normalize if signing, since then it's done by signing --> |
| 157 | <condition |
| 158 | property="doNormalize" |
| 159 | value="true"> |
| 160 | <and> |
| 161 | <istrue |
| 162 | value="${normalizeJarFiles}"/> |
| 163 | <not> |
| 164 | <equals |
| 165 | arg1="${doSign}" |
| 166 | arg2="true" |
| 167 | trim="true" |
| 168 | casesensitive="false"/> |
| 169 | </not> |
| 170 | </and> |
| 171 | </condition> |
| 172 | <condition |
| 173 | property="doPack" |
| 174 | value="true"> |
| 175 | <and> |
| 176 | <istrue |
| 177 | value="${packJarFiles}"/> |
| 178 | <istrue |
| 179 | value="${createP2repo}"/> |
| 180 | <and> |
| 181 | <or> |
| 182 | <istrue |
| 183 | value="${normalizeJarFiles}"/> |
| 184 | <istrue |
| 185 | value="${doSign}"/> |
| 186 | </or> |
| 187 | </and> |
| 188 | </and> |
| 189 | </condition> |
| 190 | <condition |
| 191 | property="excludeFromRepoZip" |
| 192 | value="site.xml"> |
| 193 | <isfalse |
| 194 | value="${doPack}"/> |
| 195 | </condition> |
| 196 | <condition |
| 197 | property="excludeFromRepoZip" |
| 198 | value="site.xml,plugins/*.jar,features/*.jar"> |
| 199 | <istrue |
| 200 | value="${doPack}"/> |
| 201 | </condition> |
| 202 | <condition |
| 203 | property="archiveDir" |
| 204 | value="${tmpsite}/normalized"> |
| 205 | <istrue |
| 206 | value="${doPack}"/> |
| 207 | </condition> |
| 208 | <condition |
| 209 | property="archiveDir" |
| 210 | value="${buildDirectory}/${buildLabel}"> |
| 211 | <isfalse |
| 212 | value="${doPack}"/> |
| 213 | </condition> |
| 214 | <condition |
| 215 | property="doP2Repo" |
| 216 | value="true"> |
| 217 | <available |
| 218 | file="${buildDirectory}/maps/webtools.maps/releng/sitefile/site.xml"/> |
| 219 | </condition> |
| 220 | <!-- echo important values, so it's documneted in build logs --> |
| 221 | <echo |
| 222 | message="doPack: ${doPack}"/> |
| 223 | <echo |
| 224 | message="packJarFiles: ${packJarFiles}"/> |
| 225 | <echo |
| 226 | message="normalizeJarFiles: ${normalizeJarFiles}"/> |
| 227 | <echo |
| 228 | message="doSign: ${doSign}"/> |
| 229 | <echo |
| 230 | message="doNormalize: ${doNormalize}"/> |
| 231 | <echo |
| 232 | message="doP2Repo: ${doP2Repo}"/> |
| 233 | </target> |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 234 | <target |
| 235 | name="normalizeJarFiles" |
| 236 | if="doNormalize" |
| 237 | depends="init"> |
| 238 | <!-- |
| 239 | stick with JAVA5 for signing/packing for now ... I've heard |
| 240 | rumors of some 'compatibility' issues with JAVA6? |
| 241 | --> |
| 242 | <echo |
| 243 | message="Starting normalizeJarFiles"/> |
| 244 | <echo |
| 245 | message="archiveDir: ${archiveDir}"/> |
| 246 | <java |
| 247 | jar="${eclipse.launcher}" |
| 248 | fork="true" |
| 249 | jvm="${env.JAVA_5_HOME}/bin/java" |
| 250 | failonerror="true" |
| 251 | maxmemory="512m" |
| 252 | dir="${buildDirectory}"> |
| 253 | <jvmarg |
| 254 | value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/> |
| 255 | <arg |
| 256 | line="${logIfDebug}"/> |
| 257 | <arg |
| 258 | line="-application org.eclipse.update.core.siteOptimizer"/> |
| 259 | <!-- |
| 260 | note: this -processAll option is critical in this first |
| 261 | step. For various reasons, jarProcessor is written to |
| 262 | not act on any jar if the jar is not "marked", or if not |
| 263 | told explicitly to to processAll. There are ways where |
| 264 | not all are literally processed, such as using |
| 265 | pack.properties (and others, see |
| 266 | http://wiki.eclipse.org/JarProcessor_Options). |
| 267 | --> |
| 268 | <arg |
| 269 | line="-jarProcessor ${verboseIfDebug} -processAll -outputDir ${archiveDir} -repack ${buildDirectory}/${buildLabel}/${archiveName}"/> |
| 270 | </java> |
| 271 | </target> |
| 272 | <target |
| 273 | name="createPackFilesIfDesired" |
| 274 | if="doPack" |
| 275 | depends="init"> |
| 276 | <!-- |
david_williams | dc454d3 | 2010-04-04 04:29:41 +0000 | [diff] [blame] | 277 | stick with JAVA5 for signing/packing for now ... there are |
| 278 | 'compatibility' issues with JAVA6? |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 279 | --> |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 280 | <java |
| 281 | jar="${pde.builder.path}/plugins/org.eclipse.equinox.launcher.jar" |
| 282 | fork="true" |
| 283 | jvm="${env.JAVA_5_HOME}/bin/java" |
| 284 | failonerror="true" |
| 285 | maxmemory="512m" |
| 286 | dir="${buildDirectory}"> |
| 287 | <jvmarg |
| 288 | value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/> |
| 289 | <arg |
| 290 | line="${logIfDebug}"/> |
| 291 | <arg |
| 292 | line="-application org.eclipse.update.core.siteOptimizer"/> |
| 293 | <arg |
| 294 | line="-jarProcessor ${verboseIfDebug} -outputDir ${buildDirectory}/${buildLabel}/${component}/repository -pack ${buildDirectory}/${buildLabel}/${component}/repository"/> |
| 295 | </java> |
david_williams | dc454d3 | 2010-04-04 04:29:41 +0000 | [diff] [blame] | 296 | |
| 297 | <!-- TODO: need to udpate meta data! --> |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 298 | </target> |
| 299 | <!-- |
| 300 | always make copy, since normally either normalized, or signed |
| 301 | (and normalized) TODO: (minor) tiny improvement in efficiency |
| 302 | could be made, for N-builds?, that are neither normalized nor |
| 303 | signed. |
| 304 | --> |
| 305 | <target |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 306 | name="createChecksums"> |
| 307 | <!-- |
| 308 | This createChecksums task creates two files, for use in two |
| 309 | contexts. a. an x.md5 file, that has the name of the file in |
| 310 | the contents. This is good for some "third party" |
| 311 | executables, like md5summ, that expects the name in the |
| 312 | file. b. since ant does not deal well with md5 files with |
| 313 | anything in them other than the checksum, we provide same |
| 314 | thing in a file with an md5antformat extension, that has |
| 315 | only the checksum. |
| 316 | --> |
| 317 | <mkdir |
| 318 | dir="${buildDirectory}/${buildLabel}/checksum"/> |
| 319 | <checksum |
| 320 | file="${buildDirectory}/${buildLabel}/${archiveName}" |
david_williams | 455e984 | 2010-04-04 00:18:08 +0000 | [diff] [blame] | 321 | todir="${buildDirectory}/${buildLabel}/checksum/" |
david_williams | d86830b | 2010-04-04 01:31:34 +0000 | [diff] [blame] | 322 | pattern="{0} *{1}" |
| 323 | fileext=".md5" |
| 324 | algorithm="MD5"/> |
| 325 | <checksum |
| 326 | file="${buildDirectory}/${buildLabel}/${archiveName}" |
| 327 | todir="${buildDirectory}/${buildLabel}/checksum/" |
| 328 | pattern="{0} *{1}" |
| 329 | fileext=".sha1" |
| 330 | algorithm="SHA1"/> |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 331 | </target> |
| 332 | <target |
| 333 | name="check.sign"> |
| 334 | <echo |
| 335 | message="sign: ${sign}"/> |
| 336 | <echo |
| 337 | message="env skip jar signing: ${env.SKIP_JAR_SIGNING}"/> |
| 338 | <echo |
| 339 | message="skip jar signing: ${SKIP_JAR_SIGNING}"/> |
| 340 | <condition |
| 341 | property="doSign"> |
| 342 | <and> |
| 343 | <equals |
| 344 | arg1="${sign}" |
| 345 | arg2="true" |
| 346 | trim="true" |
| 347 | casesensitive="false"/> |
| 348 | <not> |
| 349 | <equals |
| 350 | arg1="${env.SKIP_JAR_SIGNING}" |
| 351 | arg2="true" |
| 352 | trim="true" |
| 353 | casesensitive="false"/> |
| 354 | </not> |
| 355 | <not> |
| 356 | <equals |
| 357 | arg1="${SKIP_JAR_SIGNING}" |
| 358 | arg2="true" |
| 359 | trim="true" |
| 360 | casesensitive="false"/> |
| 361 | </not> |
| 362 | </and> |
| 363 | </condition> |
| 364 | <echo |
| 365 | message="doSign: ${doSign}"/> |
| 366 | </target> |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 367 | <target |
david_williams | 455e984 | 2010-04-04 00:18:08 +0000 | [diff] [blame] | 368 | name="createTraditionalZipFiles" |
| 369 | depends="init"> |
david_williams | d86830b | 2010-04-04 01:31:34 +0000 | [diff] [blame] | 370 | <p2.repo2runnable> |
| 371 | <repository |
| 372 | location="file:/${buildDirectory}/${buildLabel}/${component}/runnable"/> |
| 373 | <source> |
| 374 | <repository |
| 375 | location="${p2.build.repo}"/> |
| 376 | </source> |
| 377 | </p2.repo2runnable> |
| 378 | <property |
| 379 | name="ziparchiveName" |
| 380 | value="${component}-${buildLabel}.zip"/> |
| 381 | <copy |
| 382 | todir="${buildDirectory}/${buildLabel}/${component}/runnable" |
| 383 | overwrite="false"> |
| 384 | <fileset |
| 385 | dir="${wtp.builder.home}/rootfiles"> |
| 386 | </fileset> |
| 387 | </copy> |
| 388 | <zip |
| 389 | destfile="${buildDirectory}/${buildLabel}/${ziparchiveName}"> |
| 390 | <zipfileset |
| 391 | dir="${buildDirectory}/${buildLabel}/${component}/runnable" |
| 392 | excludes="content.xml,content.jar,artifacts.xml,artifacts.jar"/> |
| 393 | </zip> |
| 394 | <antcall |
| 395 | target="createChecksums"> |
| 396 | <param |
| 397 | name="archiveName" |
| 398 | value="${ziparchiveName}"/> |
| 399 | </antcall> |
| 400 | </target> |
david_williams | 455e984 | 2010-04-04 00:18:08 +0000 | [diff] [blame] | 401 | <target |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 402 | name="nodefault"> |
| 403 | <echo |
| 404 | level="error" |
| 405 | message="There is no default target for this buildutililites.xml ant script."/> |
| 406 | </target> |
| 407 | </project> |