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 | a544b1f | 2010-04-04 03:17:30 +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 | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 75 | depends="init"> |
david_williams | a544b1f | 2010-04-04 03:17:30 +0000 | [diff] [blame^] | 76 | <!-- |
| 77 | if="doSign"> |
| 78 | --> |
| 79 | <!-- |
| 80 | |
| 81 | get zip for signing |
| 82 | exclude content* artifacts* |
| 83 | add pack.properties |
| 84 | send to eclipse and wait |
| 85 | write over p2.build.repo, |
| 86 | but update content and artifacts files |
| 87 | remove temp file |
| 88 | --> |
| 89 | |
| 90 | <zip |
| 91 | destfile="${buildDirectory}/${buildLabel}/temp-${buildLabel}-${component}.zip"> |
| 92 | |
| 93 | <zipfileset |
| 94 | dir="${buildDirectory}/${buildLabel}/${component}/repository" |
| 95 | excludes="content.xml,content.jar,artifacts.xml,artifacts.jar"/> |
| 96 | <zipfileset |
| 97 | file="${wtp.builder.home}/scripts/build/pack.properties" /> |
| 98 | </zip> |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 99 | <!-- |
| 100 | ================================================================================== |
david_williams | a544b1f | 2010-04-04 03:17:30 +0000 | [diff] [blame^] | 101 | sign the jars in archive file |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 102 | ================================================================================== |
| 103 | --> |
david_williams | a544b1f | 2010-04-04 03:17:30 +0000 | [diff] [blame^] | 104 | <!-- |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 105 | <ant |
david_williams | a544b1f | 2010-04-04 03:17:30 +0000 | [diff] [blame^] | 106 | antfile="${wtp.builder.home}/scripts/build/signjars.xml" > |
| 107 | |
| 108 | <property name="archiveName" value="temp-${buildLabel}-${component}.zip"/> |
| 109 | </ant> |
| 110 | --> |
| 111 | <!-- remove our temp zip file, once tested, debugged --> |
| 112 | |
| 113 | <!-- |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 114 | ================================================================================== |
david_williams | a544b1f | 2010-04-04 03:17:30 +0000 | [diff] [blame^] | 115 | for modularity, pack200 is done here, optionally. The |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 116 | resulting gz files are produced in update site directory. |
| 117 | This is optional since processing is expensive to do for |
| 118 | every build. Only need when ready to declare an update site, |
| 119 | and, for exmaple, no need to do for "local" or HEAD builds |
| 120 | since developers wouldn't normally need it for a quick check |
| 121 | of a build. |
| 122 | ================================================================================== |
| 123 | --> |
| 124 | <echo |
| 125 | level="info" |
| 126 | message="create pack files if desired ..."/> |
| 127 | <antcall |
| 128 | target="createPackFilesIfDesired"/> |
| 129 | <echo |
| 130 | level="info" |
| 131 | message="created pack files: ${packJarFiles}"/> |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 132 | |
david_williams | a544b1f | 2010-04-04 03:17:30 +0000 | [diff] [blame^] | 133 | |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 134 | </target> |
| 135 | <!-- |
| 136 | ============================================================================================== |
| 137 | Utility and Helper tasks |
| 138 | ============================================================================================== |
| 139 | --> |
| 140 | <target |
| 141 | name="init" |
| 142 | depends="check.sign"> |
| 143 | <condition |
| 144 | property="verboseIfDebug" |
| 145 | value="-verbose" |
| 146 | else=""> |
| 147 | <istrue |
| 148 | value="${debugOptimization}"/> |
| 149 | </condition> |
| 150 | <condition |
| 151 | property="logIfDebug" |
| 152 | value="-debug -consolelog" |
| 153 | else=""> |
| 154 | <istrue |
| 155 | value="${debugOptimization}"/> |
| 156 | </condition> |
| 157 | <condition |
| 158 | property="keepIfDebug" |
| 159 | value="true"> |
| 160 | <istrue |
| 161 | value="${debugOptimization}"/> |
| 162 | </condition> |
| 163 | <!-- don't normalize if signing, since then it's done by signing --> |
| 164 | <condition |
| 165 | property="doNormalize" |
| 166 | value="true"> |
| 167 | <and> |
| 168 | <istrue |
| 169 | value="${normalizeJarFiles}"/> |
| 170 | <not> |
| 171 | <equals |
| 172 | arg1="${doSign}" |
| 173 | arg2="true" |
| 174 | trim="true" |
| 175 | casesensitive="false"/> |
| 176 | </not> |
| 177 | </and> |
| 178 | </condition> |
| 179 | <condition |
| 180 | property="doPack" |
| 181 | value="true"> |
| 182 | <and> |
| 183 | <istrue |
| 184 | value="${packJarFiles}"/> |
| 185 | <istrue |
| 186 | value="${createP2repo}"/> |
| 187 | <and> |
| 188 | <or> |
| 189 | <istrue |
| 190 | value="${normalizeJarFiles}"/> |
| 191 | <istrue |
| 192 | value="${doSign}"/> |
| 193 | </or> |
| 194 | </and> |
| 195 | </and> |
| 196 | </condition> |
| 197 | <condition |
| 198 | property="excludeFromRepoZip" |
| 199 | value="site.xml"> |
| 200 | <isfalse |
| 201 | value="${doPack}"/> |
| 202 | </condition> |
| 203 | <condition |
| 204 | property="excludeFromRepoZip" |
| 205 | value="site.xml,plugins/*.jar,features/*.jar"> |
| 206 | <istrue |
| 207 | value="${doPack}"/> |
| 208 | </condition> |
| 209 | <condition |
| 210 | property="archiveDir" |
| 211 | value="${tmpsite}/normalized"> |
| 212 | <istrue |
| 213 | value="${doPack}"/> |
| 214 | </condition> |
| 215 | <condition |
| 216 | property="archiveDir" |
| 217 | value="${buildDirectory}/${buildLabel}"> |
| 218 | <isfalse |
| 219 | value="${doPack}"/> |
| 220 | </condition> |
| 221 | <condition |
| 222 | property="doP2Repo" |
| 223 | value="true"> |
| 224 | <available |
| 225 | file="${buildDirectory}/maps/webtools.maps/releng/sitefile/site.xml"/> |
| 226 | </condition> |
| 227 | <!-- echo important values, so it's documneted in build logs --> |
| 228 | <echo |
| 229 | message="doPack: ${doPack}"/> |
| 230 | <echo |
| 231 | message="packJarFiles: ${packJarFiles}"/> |
| 232 | <echo |
| 233 | message="normalizeJarFiles: ${normalizeJarFiles}"/> |
| 234 | <echo |
| 235 | message="doSign: ${doSign}"/> |
| 236 | <echo |
| 237 | message="doNormalize: ${doNormalize}"/> |
| 238 | <echo |
| 239 | message="doP2Repo: ${doP2Repo}"/> |
| 240 | </target> |
david_williams | a544b1f | 2010-04-04 03:17:30 +0000 | [diff] [blame^] | 241 | |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 242 | <target |
| 243 | name="normalizeJarFiles" |
| 244 | if="doNormalize" |
| 245 | depends="init"> |
| 246 | <!-- |
| 247 | stick with JAVA5 for signing/packing for now ... I've heard |
| 248 | rumors of some 'compatibility' issues with JAVA6? |
| 249 | --> |
| 250 | <echo |
| 251 | message="Starting normalizeJarFiles"/> |
| 252 | <echo |
| 253 | message="archiveDir: ${archiveDir}"/> |
| 254 | <java |
| 255 | jar="${eclipse.launcher}" |
| 256 | fork="true" |
| 257 | jvm="${env.JAVA_5_HOME}/bin/java" |
| 258 | failonerror="true" |
| 259 | maxmemory="512m" |
| 260 | dir="${buildDirectory}"> |
| 261 | <jvmarg |
| 262 | value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/> |
| 263 | <arg |
| 264 | line="${logIfDebug}"/> |
| 265 | <arg |
| 266 | line="-application org.eclipse.update.core.siteOptimizer"/> |
| 267 | <!-- |
| 268 | note: this -processAll option is critical in this first |
| 269 | step. For various reasons, jarProcessor is written to |
| 270 | not act on any jar if the jar is not "marked", or if not |
| 271 | told explicitly to to processAll. There are ways where |
| 272 | not all are literally processed, such as using |
| 273 | pack.properties (and others, see |
| 274 | http://wiki.eclipse.org/JarProcessor_Options). |
| 275 | --> |
| 276 | <arg |
| 277 | line="-jarProcessor ${verboseIfDebug} -processAll -outputDir ${archiveDir} -repack ${buildDirectory}/${buildLabel}/${archiveName}"/> |
| 278 | </java> |
| 279 | </target> |
| 280 | <target |
| 281 | name="createPackFilesIfDesired" |
| 282 | if="doPack" |
| 283 | depends="init"> |
| 284 | <!-- |
david_williams | a544b1f | 2010-04-04 03:17:30 +0000 | [diff] [blame^] | 285 | stick with JAVA5 for signing/packing for now ... |
| 286 | there are 'compatibility' issues with JAVA6? |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 287 | --> |
david_williams | a544b1f | 2010-04-04 03:17:30 +0000 | [diff] [blame^] | 288 | |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 289 | <java |
| 290 | jar="${pde.builder.path}/plugins/org.eclipse.equinox.launcher.jar" |
| 291 | fork="true" |
| 292 | jvm="${env.JAVA_5_HOME}/bin/java" |
| 293 | failonerror="true" |
| 294 | maxmemory="512m" |
| 295 | dir="${buildDirectory}"> |
| 296 | <jvmarg |
| 297 | value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/> |
| 298 | <arg |
| 299 | line="${logIfDebug}"/> |
| 300 | <arg |
| 301 | line="-application org.eclipse.update.core.siteOptimizer"/> |
| 302 | <arg |
| 303 | line="-jarProcessor ${verboseIfDebug} -outputDir ${buildDirectory}/${buildLabel}/${component}/repository -pack ${buildDirectory}/${buildLabel}/${component}/repository"/> |
| 304 | </java> |
david_williams | a544b1f | 2010-04-04 03:17:30 +0000 | [diff] [blame^] | 305 | |
| 306 | <!-- TODO: need to udpate meta data! --> |
| 307 | |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 308 | </target> |
| 309 | <!-- |
| 310 | always make copy, since normally either normalized, or signed |
| 311 | (and normalized) TODO: (minor) tiny improvement in efficiency |
| 312 | could be made, for N-builds?, that are neither normalized nor |
| 313 | signed. |
| 314 | --> |
| 315 | <target |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 316 | name="createChecksums"> |
| 317 | <!-- |
| 318 | This createChecksums task creates two files, for use in two |
| 319 | contexts. a. an x.md5 file, that has the name of the file in |
| 320 | the contents. This is good for some "third party" |
| 321 | executables, like md5summ, that expects the name in the |
| 322 | file. b. since ant does not deal well with md5 files with |
| 323 | anything in them other than the checksum, we provide same |
| 324 | thing in a file with an md5antformat extension, that has |
| 325 | only the checksum. |
| 326 | --> |
| 327 | <mkdir |
| 328 | dir="${buildDirectory}/${buildLabel}/checksum"/> |
| 329 | <checksum |
| 330 | file="${buildDirectory}/${buildLabel}/${archiveName}" |
david_williams | 455e984 | 2010-04-04 00:18:08 +0000 | [diff] [blame] | 331 | todir="${buildDirectory}/${buildLabel}/checksum/" |
david_williams | d86830b | 2010-04-04 01:31:34 +0000 | [diff] [blame] | 332 | pattern="{0} *{1}" |
| 333 | fileext=".md5" |
| 334 | algorithm="MD5"/> |
| 335 | <checksum |
| 336 | file="${buildDirectory}/${buildLabel}/${archiveName}" |
| 337 | todir="${buildDirectory}/${buildLabel}/checksum/" |
| 338 | pattern="{0} *{1}" |
| 339 | fileext=".sha1" |
| 340 | algorithm="SHA1"/> |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 341 | </target> |
| 342 | <target |
| 343 | name="check.sign"> |
| 344 | <echo |
| 345 | message="sign: ${sign}"/> |
| 346 | <echo |
| 347 | message="env skip jar signing: ${env.SKIP_JAR_SIGNING}"/> |
| 348 | <echo |
| 349 | message="skip jar signing: ${SKIP_JAR_SIGNING}"/> |
| 350 | <condition |
| 351 | property="doSign"> |
| 352 | <and> |
| 353 | <equals |
| 354 | arg1="${sign}" |
| 355 | arg2="true" |
| 356 | trim="true" |
| 357 | casesensitive="false"/> |
| 358 | <not> |
| 359 | <equals |
| 360 | arg1="${env.SKIP_JAR_SIGNING}" |
| 361 | arg2="true" |
| 362 | trim="true" |
| 363 | casesensitive="false"/> |
| 364 | </not> |
| 365 | <not> |
| 366 | <equals |
| 367 | arg1="${SKIP_JAR_SIGNING}" |
| 368 | arg2="true" |
| 369 | trim="true" |
| 370 | casesensitive="false"/> |
| 371 | </not> |
| 372 | </and> |
| 373 | </condition> |
| 374 | <echo |
| 375 | message="doSign: ${doSign}"/> |
| 376 | </target> |
| 377 | |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 378 | |
| 379 | |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 380 | <target |
david_williams | 455e984 | 2010-04-04 00:18:08 +0000 | [diff] [blame] | 381 | name="createTraditionalZipFiles" |
| 382 | depends="init"> |
david_williams | d86830b | 2010-04-04 01:31:34 +0000 | [diff] [blame] | 383 | <p2.repo2runnable> |
| 384 | <repository |
| 385 | location="file:/${buildDirectory}/${buildLabel}/${component}/runnable"/> |
| 386 | <source> |
| 387 | <repository |
| 388 | location="${p2.build.repo}"/> |
| 389 | </source> |
| 390 | </p2.repo2runnable> |
| 391 | <property |
| 392 | name="ziparchiveName" |
| 393 | value="${component}-${buildLabel}.zip"/> |
| 394 | <copy |
| 395 | todir="${buildDirectory}/${buildLabel}/${component}/runnable" |
| 396 | overwrite="false"> |
| 397 | <fileset |
| 398 | dir="${wtp.builder.home}/rootfiles"> |
| 399 | </fileset> |
| 400 | </copy> |
| 401 | <zip |
| 402 | destfile="${buildDirectory}/${buildLabel}/${ziparchiveName}"> |
| 403 | <zipfileset |
| 404 | dir="${buildDirectory}/${buildLabel}/${component}/runnable" |
| 405 | excludes="content.xml,content.jar,artifacts.xml,artifacts.jar"/> |
| 406 | </zip> |
| 407 | <antcall |
| 408 | target="createChecksums"> |
| 409 | <param |
| 410 | name="archiveName" |
| 411 | value="${ziparchiveName}"/> |
| 412 | </antcall> |
| 413 | </target> |
david_williams | 455e984 | 2010-04-04 00:18:08 +0000 | [diff] [blame] | 414 | <target |
david_williams | 6913d4d | 2010-04-03 05:05:16 +0000 | [diff] [blame] | 415 | name="nodefault"> |
| 416 | <echo |
| 417 | level="error" |
| 418 | message="There is no default target for this buildutililites.xml ant script."/> |
| 419 | </target> |
| 420 | </project> |