| <?xml version="1.0" encoding="UTF-8"?> |
| <project |
| name="buildutilities" |
| default="nodefault" |
| basedir="."> |
| |
| <!-- = = = standard properties pattern = = = --> |
| <!-- |
| Note to be cross-platform, "environment variables" are only |
| appropriate for some variables, e.g. ones we set, since |
| properties are case sensitive, even if the environment variables |
| on your operating system are not, e.g. it will be ${env.Path} |
| not ${env.PATH} on Windows |
| --> |
| <property |
| environment="env"/> |
| <!-- |
| Let users override standard properties, if desired. If |
| directory, file, or some properties do not exist, then standard |
| properties will be used. |
| --> |
| <property |
| file="${env.LOCAL_BUILD_PROPERTIES_DIR}/${ant.project.name}.properties"/> |
| |
| <!-- = = = end standard properties pattern = = = --> |
| |
| |
| <!-- if not otherwise set, use these default properties --> |
| <property |
| name="debugOptimization" |
| value="false"/> |
| <!-- |
| We should not always normalize ("-repack") jars by default, |
| since in production we sign the jars (which does the -repack for |
| us) and not in production we don't really care so why spend the |
| extra time. For jars which are not supposed to be normalized, |
| such as pre-existing jars, they need to be added to the |
| pack.properties file (see the updatePackProperties task). Note: |
| signing does the -repack when we sign. This can be over-ridden |
| by the caller setting normalize to true, but there are know |
| known cases where we want to normalize (and eventually pack) the |
| jar files but not sign them. |
| --> |
| <property |
| name="normalizeJarFiles" |
| value="false"/> |
| <!-- |
| we'll currently pack jar files, just as part of "debugging" to |
| help sanity check all is working as expected. Eventually we may |
| want to provide some service there jar files in the bundles |
| directory are packed ... but, there's no known use-case for this |
| so far |
| --> |
| <property |
| name="packJarFiles" |
| value="false"/> |
| <!-- |
| Let tmp site be global. Note: we use this odd |
| "tmpsite-archiveName-temp" to make sure unique directories, |
| since in some cases these directories can not be deleted from |
| ant, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=142926, |
| and since directory names ending in .zip are misinterpreted by |
| jarProcessor, see |
| https://bugs.eclipse.org/bugs/show_bug.cgi?id=143385 But, its |
| handy to do as unique directories anyway, since if a larger |
| process calls this mulitiple times, on different zips, and if |
| debugging is turnned on, then all the tmpsite directories are |
| left on disk for post-build inspection. |
| --> |
| <property |
| name="tmpsite" |
| value="${buildDirectory}/tmpsite-${archiveName}-temp"/> |
| <target |
| name="conditionAndSignJars" |
| depends="init"> |
| <!-- |
| if="doSign"> |
| --> |
| <!-- |
| |
| get zip for signing |
| exclude content* artifacts* |
| add pack.properties |
| send to eclipse and wait |
| write over p2.build.repo, |
| but update content and artifacts files |
| remove temp file |
| --> |
| |
| <zip |
| destfile="${buildDirectory}/${buildLabel}/temp-${buildLabel}-${component}.zip"> |
| |
| <zipfileset |
| dir="${buildDirectory}/${buildLabel}/${component}/repository" |
| excludes="content.xml,content.jar,artifacts.xml,artifacts.jar"/> |
| |
| </zip> |
| |
| <updatePackProperties |
| archiveFilename="${buildDirectory}/${buildLabel}/temp-${buildLabel}-${component}.zip"/> |
| |
| |
| <!-- |
| ================================================================================== |
| sign the jars in archive file |
| ================================================================================== |
| --> |
| <!-- |
| <ant |
| antfile="${wtp.builder.home}/scripts/build/signjars.xml" > |
| |
| <property name="archiveName" value="temp-${buildLabel}-${component}.zip"/> |
| </ant> |
| --> |
| <!-- remove our temp zip file, once tested, debugged --> |
| |
| <!-- |
| ================================================================================== |
| for modularity, pack200 is done here, optionally. The |
| resulting gz files are produced in update site directory. |
| This is optional since processing is expensive to do for |
| every build. Only need when ready to declare an update site, |
| and, for exmaple, no need to do for "local" or HEAD builds |
| since developers wouldn't normally need it for a quick check |
| of a build. |
| ================================================================================== |
| --> |
| <echo |
| level="info" |
| message="create pack files if desired ..."/> |
| <antcall |
| target="createPackFilesIfDesired"/> |
| <echo |
| level="info" |
| message="created pack files: ${packJarFiles}"/> |
| |
| |
| </target> |
| <!-- |
| ============================================================================================== |
| Utility and Helper tasks |
| ============================================================================================== |
| --> |
| <target |
| name="init" |
| depends="check.sign"> |
| <condition |
| property="verboseIfDebug" |
| value="-verbose" |
| else=""> |
| <istrue |
| value="${debugOptimization}"/> |
| </condition> |
| <condition |
| property="logIfDebug" |
| value="-debug -consolelog" |
| else=""> |
| <istrue |
| value="${debugOptimization}"/> |
| </condition> |
| <condition |
| property="keepIfDebug" |
| value="true"> |
| <istrue |
| value="${debugOptimization}"/> |
| </condition> |
| <!-- don't normalize if signing, since then it's done by signing --> |
| <condition |
| property="doNormalize" |
| value="true"> |
| <and> |
| <istrue |
| value="${normalizeJarFiles}"/> |
| <not> |
| <equals |
| arg1="${doSign}" |
| arg2="true" |
| trim="true" |
| casesensitive="false"/> |
| </not> |
| </and> |
| </condition> |
| <condition |
| property="doPack" |
| value="true"> |
| <and> |
| <istrue |
| value="${packJarFiles}"/> |
| <istrue |
| value="${createP2repo}"/> |
| <and> |
| <or> |
| <istrue |
| value="${normalizeJarFiles}"/> |
| <istrue |
| value="${doSign}"/> |
| </or> |
| </and> |
| </and> |
| </condition> |
| <condition |
| property="excludeFromRepoZip" |
| value="site.xml"> |
| <isfalse |
| value="${doPack}"/> |
| </condition> |
| <condition |
| property="excludeFromRepoZip" |
| value="site.xml,plugins/*.jar,features/*.jar"> |
| <istrue |
| value="${doPack}"/> |
| </condition> |
| <condition |
| property="archiveDir" |
| value="${tmpsite}/normalized"> |
| <istrue |
| value="${doPack}"/> |
| </condition> |
| <condition |
| property="archiveDir" |
| value="${buildDirectory}/${buildLabel}"> |
| <isfalse |
| value="${doPack}"/> |
| </condition> |
| <condition |
| property="doP2Repo" |
| value="true"> |
| <available |
| file="${buildDirectory}/maps/webtools.maps/releng/sitefile/site.xml"/> |
| </condition> |
| <!-- echo important values, so it's documneted in build logs --> |
| <echo |
| message="doPack: ${doPack}"/> |
| <echo |
| message="packJarFiles: ${packJarFiles}"/> |
| <echo |
| message="normalizeJarFiles: ${normalizeJarFiles}"/> |
| <echo |
| message="doSign: ${doSign}"/> |
| <echo |
| message="doNormalize: ${doNormalize}"/> |
| <echo |
| message="doP2Repo: ${doP2Repo}"/> |
| </target> |
| |
| <target |
| name="normalizeJarFiles" |
| if="doNormalize" |
| depends="init"> |
| <!-- |
| stick with JAVA5 for signing/packing for now ... I've heard |
| rumors of some 'compatibility' issues with JAVA6? |
| --> |
| <echo |
| message="Starting normalizeJarFiles"/> |
| <echo |
| message="archiveDir: ${archiveDir}"/> |
| <java |
| jar="${eclipse.launcher}" |
| fork="true" |
| jvm="${env.JAVA_5_HOME}/bin/java" |
| failonerror="true" |
| maxmemory="512m" |
| dir="${buildDirectory}"> |
| <jvmarg |
| value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/> |
| <arg |
| line="${logIfDebug}"/> |
| <arg |
| line="-application org.eclipse.update.core.siteOptimizer"/> |
| <!-- |
| note: this -processAll option is critical in this first |
| step. For various reasons, jarProcessor is written to |
| not act on any jar if the jar is not "marked", or if not |
| told explicitly to to processAll. There are ways where |
| not all are literally processed, such as using |
| pack.properties (and others, see |
| http://wiki.eclipse.org/JarProcessor_Options). |
| --> |
| <arg |
| line="-jarProcessor ${verboseIfDebug} -processAll -outputDir ${archiveDir} -repack ${buildDirectory}/${buildLabel}/${archiveName}"/> |
| </java> |
| </target> |
| <target |
| name="createPackFilesIfDesired" |
| if="doPack" |
| depends="init"> |
| <!-- |
| stick with JAVA5 for signing/packing for now ... |
| there are 'compatibility' issues with JAVA6? |
| --> |
| |
| <java |
| jar="${pde.builder.path}/plugins/org.eclipse.equinox.launcher.jar" |
| fork="true" |
| jvm="${env.JAVA_5_HOME}/bin/java" |
| failonerror="true" |
| maxmemory="512m" |
| dir="${buildDirectory}"> |
| <jvmarg |
| value="-Djava.io.tmpdir=${env.RECOMMENDED_TMP_DIR}"/> |
| <arg |
| line="${logIfDebug}"/> |
| <arg |
| line="-application org.eclipse.update.core.siteOptimizer"/> |
| <arg |
| line="-jarProcessor ${verboseIfDebug} -outputDir ${buildDirectory}/${buildLabel}/${component}/repository -pack ${buildDirectory}/${buildLabel}/${component}/repository"/> |
| </java> |
| |
| <!-- TODO: need to udpate meta data! --> |
| |
| </target> |
| <!-- |
| always make copy, since normally either normalized, or signed |
| (and normalized) TODO: (minor) tiny improvement in efficiency |
| could be made, for N-builds?, that are neither normalized nor |
| signed. |
| --> |
| <target |
| name="createChecksums"> |
| <!-- |
| This createChecksums task creates two files, for use in two |
| contexts. a. an x.md5 file, that has the name of the file in |
| the contents. This is good for some "third party" |
| executables, like md5summ, that expects the name in the |
| file. b. since ant does not deal well with md5 files with |
| anything in them other than the checksum, we provide same |
| thing in a file with an md5antformat extension, that has |
| only the checksum. |
| --> |
| <mkdir |
| dir="${buildDirectory}/${buildLabel}/checksum"/> |
| <checksum |
| file="${buildDirectory}/${buildLabel}/${archiveName}" |
| todir="${buildDirectory}/${buildLabel}/checksum/" |
| pattern="{0} *{1}" |
| fileext=".md5" |
| algorithm="MD5"/> |
| <checksum |
| file="${buildDirectory}/${buildLabel}/${archiveName}" |
| todir="${buildDirectory}/${buildLabel}/checksum/" |
| pattern="{0} *{1}" |
| fileext=".sha1" |
| algorithm="SHA1"/> |
| </target> |
| <target |
| name="check.sign"> |
| <echo |
| message="sign: ${sign}"/> |
| <echo |
| message="env skip jar signing: ${env.SKIP_JAR_SIGNING}"/> |
| <echo |
| message="skip jar signing: ${SKIP_JAR_SIGNING}"/> |
| <condition |
| property="doSign"> |
| <and> |
| <equals |
| arg1="${sign}" |
| arg2="true" |
| trim="true" |
| casesensitive="false"/> |
| <not> |
| <equals |
| arg1="${env.SKIP_JAR_SIGNING}" |
| arg2="true" |
| trim="true" |
| casesensitive="false"/> |
| </not> |
| <not> |
| <equals |
| arg1="${SKIP_JAR_SIGNING}" |
| arg2="true" |
| trim="true" |
| casesensitive="false"/> |
| </not> |
| </and> |
| </condition> |
| <echo |
| message="doSign: ${doSign}"/> |
| </target> |
| |
| |
| |
| <target |
| name="createTraditionalZipFiles" |
| depends="init"> |
| <p2.repo2runnable> |
| <repository |
| location="file:/${buildDirectory}/${buildLabel}/${component}/runnable"/> |
| <source> |
| <repository |
| location="${p2.build.repo}"/> |
| </source> |
| </p2.repo2runnable> |
| <property |
| name="ziparchiveName" |
| value="${component}-${buildLabel}.zip"/> |
| <copy |
| todir="${buildDirectory}/${buildLabel}/${component}/runnable" |
| overwrite="false"> |
| <fileset |
| dir="${wtp.builder.home}/rootfiles"> |
| </fileset> |
| </copy> |
| <zip |
| destfile="${buildDirectory}/${buildLabel}/${ziparchiveName}"> |
| <zipfileset |
| dir="${buildDirectory}/${buildLabel}/${component}/runnable" |
| excludes="content.xml,content.jar,artifacts.xml,artifacts.jar"/> |
| </zip> |
| <antcall |
| target="createChecksums"> |
| <param |
| name="archiveName" |
| value="${ziparchiveName}"/> |
| </antcall> |
| </target> |
| <target |
| name="nodefault"> |
| <echo |
| level="error" |
| message="There is no default target for this buildutililites.xml ant script."/> |
| </target> |
| </project> |