blob: 163d75b8d3a26172a78744afa90d8a34a34c3953 [file] [log] [blame]
<?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" />
<!-- load standard properties for production environment -->
<property file="${env.STANDARD_PROPERTIES_DIR}/${ant.project.name}.properties" />
<!-- = = = end standard properties pattern = = = -->
<!-- if not otherwise set, use these default properties -->
<property
name="debugOptimization"
value="false" />
<property
name="normalizeJarFiles"
value="true" />
<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
inspection.
-->
<property name="tmpsite"
value="${buildDirectory}/tmpsite-${archiveName}-temp" />
<!-- ================================================================================== -->
<!-- -->
<!-- unpackUpdateJarsAndCreateZippedPackages -->
<!-- -->
<!-- This task takes a zip file of update jars, which is created by PDE build -->
<!-- process, and "converts" it to a traditional zip file, processing the -->
<!-- jars with pack200 for better compression on update sites. -->
<!-- -->
<!-- -->
<!-- ================================================================================== -->
<target
name="unpackUpdateJarsAndCreateZippedPackages"
depends="init">
<!-- ================================================================================== -->
<!-- -->
<!-- 0. make "backup" copy of original zip, if debugging, -->
<!-- since might be needed for comparison -->
<!-- -->
<!-- ================================================================================== -->
<antcall target="makeBackupCopyForDebugging" />
<!-- ================================================================================== -->
<!-- -->
<!-- 1. normalize jars here, from a zip file of update jars. -->
<!-- The normalized jars are put in zip file of same name, in a directory -->
<!-- named normalized -->
<!-- -->
<!-- ================================================================================== -->
<echo message="normalize jars if desired ..." />
<antcall target="normalizeJarFiles" />
<echo message="normalized jars: ${normalizeJarFiles}" />
<!-- ================================================================================== -->
<!-- -->
<!-- 2. unzip the normalized jars in the zip file produced in step 1., to the -->
<!-- directory {tmpsite} for further processing. plugins and features -->
<!-- end up in {tmpsite}/eclipse -->
<!-- -->
<!-- ================================================================================== -->
<echo message="unzip normalized update jars to a holding place" />
<echo level="info"
message="archiveDir: ${archiveDir}" />
<unzip dest="${tmpsite}"
src="${archiveDir}/${archiveName}" />
<!-- ================================================================================== -->
<!-- -->
<!-- 3. copy all update jars to a common update site directory, if desired. -->
<!-- Note: overwite is false to avoid "touching" files already produced and -->
<!-- processed be previous steps in a larger build process. This means the updateSite -->
<!-- *must* be completely clean before the larger process starts. -->
<!-- -->
<!-- ================================================================================== -->
<antcall target="makeCopyForUpdate" />
<!-- ================================================================================== -->
<!-- -->
<!-- 4. for modularity, pack200 is done here, optionally. -->
<!-- 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 of a build. -->
<!-- -->
<!-- ================================================================================== -->
<echo message="create pack files if desired ..." />
<antcall target="createPackFilesIfDesired" />
<echo message="created pack files: ${packJarFiles}" />
<!-- ================================================================================== -->
<!-- -->
<!-- 5. now create traditional zip file of unpacked jars. This type of -->
<!-- "unpack" is not related to pack200, but instead means to unpack -->
<!-- those jars that are supposed to be unpacked based on feature defintion, -->
<!-- if the plugin's unpack attribute is set to true in the feature -->
<!-- -->
<!-- ================================================================================== -->
<!-- use releng task of unpackUpdateJars -->
<unpackUpdateJars
site="${tmpsite}/eclipse"
output="${tmpsite}/unpacked/eclipse" />
<!-- add copy of legal doc's here, product.ini, etc., before re-zipping -->
<copy
todir="${tmpsite}/unpacked/eclipse"
overwrite="false">
<fileset dir="${dltk.builder.home}/rootfiles"></fileset>
</copy>
<!-- delete the zip file of update jars we started with, which we are about to re-create
as traditional zip file -->
<delete file="${buildDirectory}/${buildLabel}/${archiveName}" />
<!-- recreate zip file now, same name, traditional content, which is mix of folders and jars -->
<zip
destfile="${buildDirectory}/${buildLabel}/${archiveName}"
basedir="${tmpsite}/unpacked"
update="false"
duplicate="preserve" />
<!-- always produce checksum files for any zips produced -->
<antcall target="createChecksums" />
<!-- ================================================================================== -->
<!-- -->
<!-- 6. can now remove tmpsite as no longer needed, unless debugging -->
<!-- -->
<!-- ================================================================================== -->
<antcall target="deleteTmpSite" />
</target>
<!-- ============================================================================================== -->
<!-- -->
<!-- Utility and Helper tasks -->
<!-- -->
<!-- ============================================================================================== -->
<target name="init">
<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>
<condition
property="doNormalize"
value="true">
<istrue value="${normalizeJarFiles}" />
</condition>
<condition
property="doPack"
value="true">
<and>
<istrue value="${packJarFiles}" />
<istrue value="${normalizeJarFiles}" />
</and>
</condition>
<condition property="archiveDir"
value="${tmpsite}/normalized">
<istrue value="${doPack}" />
</condition>
<condition property="archiveDir"
value="${buildDirectory}/${buildLabel}">
<isfalse value="${doPack}" />
</condition>
</target>
<target
name="deleteTmpSite"
unless="keepIfDebug">
<delete dir="${tmpsite}" />
</target>
<target
name="normalizeJarFiles"
if="doNormalize"
depends="init">
<java
jar="${eclipse.launcher}"
fork="true"
jvm="${env.JAVA_5_HOME}/bin/java"
failonerror="true"
maxmemory="256m"
dir="${buildDirectory}">
<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
-->
<arg
line="-jarProcessor ${verboseIfDebug} -processAll -outputDir ${archiveDir} -repack ${buildDirectory}/${buildLabel}/${archiveName}" />
</java>
</target>
<target
name="createPackFilesIfDesired"
if="doPack"
depends="init">
<java
jar="${pde.builder.path}/plugins/org.eclipse.equinox.launcher.jar"
fork="true"
jvm="${env.JAVA_5_HOME}/bin/java"
failonerror="true"
maxmemory="256m"
dir="${buildDirectory}">
<arg line="${logIfDebug}" />
<arg line="-application org.eclipse.update.core.siteOptimizer" />
<arg
line="-jarProcessor ${verboseIfDebug} -outputDir ${buildDirectory}/${buildLabel}/updateSite -pack ${buildDirectory}/${buildLabel}/updateSite" />
</java>
</target>
<!-- no sense in making update dir, if not normalized -->
<target
name="makeCopyForUpdate"
if="doNormalize">
<mkdir dir="${buildDirectory}/${buildLabel}/updateSite" />
<copy
todir="${buildDirectory}/${buildLabel}/updateSite"
overwrite="false">
<fileset dir="${tmpsite}/eclipse" />
</copy>
</target>
<target
name="makeBackupCopyForDebugging"
if="keepIfDebug">
<!-- temporary copy while confirming build to be able to do side-by-side comparisons -->
<mkdir dir="${buildDirectory}/backuporiginalzips" />
<copy
file="${buildDirectory}/${buildLabel}/${archiveName}"
todir="${buildDirectory}/backuporiginalzips" />
</target>
<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}"
property="md5" />
<echo
message="${md5} *${archiveName}"
file="${buildDirectory}/${buildLabel}/checksum/${archiveName}.md5" />
<echo
message="${md5}"
file="${buildDirectory}/${buildLabel}/checksum/${archiveName}.md5antformat" />
</target>
<target name="nodefault">
<echo
message="There is no default target for this buildutililites.xml ant script." />
</target>
</project>