blob: f99d2ff5276ea287e020abdb6be491d72415d2d2 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<project
name="signJarsInArchive"
default="signJarsInArchive"
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 = = = -->
<property
name="stagingDirectory"
value="/our/staging/directory" />
<fail
unless="buildDirectory"
message="buildDirectory must be specified by caller" />
<fail
unless="archiveName"
message="archiveName must be specified by caller" />
<fail
unless="buildLabel"
message="buildLabel must be specified by caller" />
<fail
unless="buildId"
message="buildId must be specified by caller" />
<fail
unless="wtp.builder.home"
message="wtp.builder.home must be specified by caller" />
<target
name="compareAttribs">
<!--poll file for change in attributes-->
<exec
dir="${buildDirectory}"
executable="ssh"
outputProperty="polledAttribs">
<arg
line="${sshline}" />
</exec>
<echo
message="original: ${originalAttribs}" />
<condition
property="attribChanged">
<not>
<contains
string="${polledAttribs}"
substring="No such file or directory"
casesensitive="no" />
</not>
</condition>
<echo
message="polled: ${polledAttribs}" />
<antcall
target="writeDiffResult" />
<sleep
seconds="120" />
<available
property="attribs.changed"
file="${buildDirectory}/attribDiff.txt" />
<antcall
target="waitForChangedAttribs" />
</target>
<target
name="writeDiffResult"
if="attribChanged">
<echo
message="original: ${originalAttribs}"
file="${buildDirectory}/attribDiff.txt" />
<echo
message="new: ${polledAttribs}"
file="${buildDirectory}/attribDiff.txt"
append="true" />
</target>
<target
name="signJarsInArchive"
if="sign">
<property
name="packtmp"
value="${buildDirectory}/packtmp" />
<property
name="stagingDirectoryOutput"
value="${stagingDirectory}/${buildId}-out" />
<property
name="outputFile"
value="${stagingDirectoryOutput}/${archiveName}" />
<mkdir
dir="${packtmp}" />
<move
file="${buildDirectory}/${buildLabel}/${archiveName}"
tofile="${packtmp}/${archiveName}" />
<!-- add pack.properties file that specifies effort level -->
<exec
dir="."
executable="zip">
<arg
line="-r ${packtmp}/${archiveName} ${wtp.builder.home}/scripts/build/pack.properties" />
</exec>
<!--push drop to staging directory-->
<echo
message="push drop to staging directory" />
<exec
dir="${packtmp}"
executable="scp"
output="signing.txt">
<arg
line="${archiveName} build.eclipse.org:${stagingDirectory}" />
</exec>
<exec
dir="${buildDirectory}"
executable="ssh"
output="signing.txt"
append="true">
<arg
line="build.eclipse.org /bin/chmod ugo+rw ${stagingDirectory}/${archiveName} " />
</exec>
<!--invoke sign script and wait-->
<echo
message="invoke sign script and wait" />
<exec
dir="${basedir}"
executable="ssh"
output="signing.txt"
append="true">
<arg
line="build.eclipse.org cd ${stagingDirectory}; /usr/bin/sign ${stagingDirectory}/${archiveName} mail ${stagingDirectoryOutput}" />
</exec>
<!--Wait for signed build to be available -->
<antcall
target="waitForChangedAttribs">
<param
name="sshline"
value="build.eclipse.org cd ${stagingDirectoryOutput};ls ${archiveName}" />
</antcall>
<!--copy zip back to build machine -->
<echo
message="copy zip back to build machine" />
<exec
dir="${basedir}"
executable="scp"
output="signing.txt"
append="true">
<arg
line="build.eclipse.org:${stagingDirectory}/${buildId}-out/${archiveName} ${buildDirectory}/${buildLabel}" />
</exec>
<!--delete files on build.eclipse.org-->
<echo
message="delete temp files on build.eclipse.org" />
<exec
dir="${basedir}"
executable="ssh"
output="signing.txt"
append="true">
<arg
line="build.eclipse.org /bin/rm -rf ${stagingDirectory}/${buildId}-out ${stagingDirectory}/${archiveName}" />
</exec>
</target>
<target
name="waitForChangedAttribs"
unless="attribs.changed">
<antcall
target="compareAttribs"
inheritAll="false">
<param
name="originalAttribs"
value="${originalAttribs}" />
</antcall>
</target>
</project>