david_williams | e39ca40 | 2008-02-07 05:58:31 +0000 | [diff] [blame^] | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <project |
| 3 | name="signJarsInArchive" |
| 4 | default="signJarsInArchive" |
| 5 | basedir="."> |
| 6 | |
| 7 | <!-- = = = standard properties pattern = = = --> |
| 8 | <!-- |
| 9 | Note to be cross-platform, "environment variables" are only appropriate for |
| 10 | some variables, e.g. ones we set, since properties are case sensitive, even if |
| 11 | the environment variables on your operating system are not, e.g. it will |
| 12 | be ${env.Path} not ${env.PATH} on Windows --> |
| 13 | <property |
| 14 | environment="env" /> |
| 15 | |
| 16 | <!-- |
| 17 | Let users override standard properties, if desired. |
| 18 | If directory, file, or some properties do not exist, |
| 19 | then standard properties will be used. |
| 20 | --> |
| 21 | <property |
| 22 | file="${env.LOCAL_BUILD_PROPERTIES_DIR}/${ant.project.name}.properties" /> |
| 23 | |
| 24 | <!-- = = = end standard properties pattern = = = --> |
| 25 | <property |
| 26 | name="stagingDirectory" |
| 27 | value="/our/staging/directory" /> |
| 28 | <fail |
| 29 | unless="buildDirectory" |
| 30 | message="buildDirectory must be specified by caller" /> |
| 31 | <fail |
| 32 | unless="archiveName" |
| 33 | message="archiveName must be specified by caller" /> |
| 34 | <fail |
| 35 | unless="buildLabel" |
| 36 | message="buildLabel must be specified by caller" /> |
| 37 | <fail |
| 38 | unless="buildId" |
| 39 | message="buildId must be specified by caller" /> |
| 40 | <fail |
| 41 | unless="wtp.builder.home" |
| 42 | message="wtp.builder.home must be specified by caller" /> |
| 43 | <target |
| 44 | name="compareAttribs"> |
| 45 | <!--poll file for change in attributes--> |
| 46 | <exec |
| 47 | dir="${buildDirectory}" |
| 48 | executable="ssh" |
| 49 | outputProperty="polledAttribs"> |
| 50 | <arg |
| 51 | line="${sshline}" /> |
| 52 | </exec> |
| 53 | <echo |
| 54 | message="original: ${originalAttribs}" /> |
| 55 | <condition |
| 56 | property="attribChanged"> |
| 57 | <not> |
| 58 | <contains |
| 59 | string="${polledAttribs}" |
| 60 | substring="No such file or directory" |
| 61 | casesensitive="no" /> |
| 62 | </not> |
| 63 | </condition> |
| 64 | <echo |
| 65 | message="polled: ${polledAttribs}" /> |
| 66 | <antcall |
| 67 | target="writeDiffResult" /> |
| 68 | <sleep |
| 69 | seconds="120" /> |
| 70 | <available |
| 71 | property="attribs.changed" |
| 72 | file="${buildDirectory}/attribDiff.txt" /> |
| 73 | <antcall |
| 74 | target="waitForChangedAttribs" /> |
| 75 | </target> |
| 76 | <target |
| 77 | name="writeDiffResult" |
| 78 | if="attribChanged"> |
| 79 | <echo |
| 80 | message="original: ${originalAttribs}" |
| 81 | file="${buildDirectory}/attribDiff.txt" /> |
| 82 | <echo |
| 83 | message="new: ${polledAttribs}" |
| 84 | file="${buildDirectory}/attribDiff.txt" |
| 85 | append="true" /> |
| 86 | </target> |
| 87 | <target |
| 88 | name="signJarsInArchive" |
| 89 | if="sign"> |
| 90 | <property |
| 91 | name="packtmp" |
| 92 | value="${buildDirectory}/packtmp" /> |
| 93 | <property |
| 94 | name="stagingDirectoryOutput" |
| 95 | value="${stagingDirectory}/${buildId}-out" /> |
| 96 | <property |
| 97 | name="outputFile" |
| 98 | value="${stagingDirectoryOutput}/${archiveName}" /> |
| 99 | <mkdir |
| 100 | dir="${packtmp}" /> |
| 101 | <move |
| 102 | file="${buildDirectory}/${buildLabel}/${archiveName}" |
| 103 | tofile="${packtmp}/${archiveName}" /> |
| 104 | <!-- add pack.properties file that specifies effort level --> |
| 105 | <exec |
| 106 | dir="." |
| 107 | executable="zip"> |
| 108 | <arg |
| 109 | line="-r ${packtmp}/${archiveName} ${wtp.builder.home}/scripts/build/pack.properties" /> |
| 110 | </exec> |
| 111 | |
| 112 | <!--push drop to staging directory--> |
| 113 | <echo |
| 114 | message="push drop to staging directory" /> |
| 115 | <exec |
| 116 | dir="${packtmp}" |
| 117 | executable="scp" |
| 118 | output="signing.txt"> |
| 119 | <arg |
| 120 | line="${archiveName} build.eclipse.org:${stagingDirectory}" /> |
| 121 | </exec> |
| 122 | <exec |
| 123 | dir="${buildDirectory}" |
| 124 | executable="ssh" |
| 125 | output="signing.txt" |
| 126 | append="true"> |
| 127 | <arg |
| 128 | line="build.eclipse.org /bin/chmod ugo+rw ${stagingDirectory}/${archiveName} " /> |
| 129 | </exec> |
| 130 | |
| 131 | <!--invoke sign script and wait--> |
| 132 | <echo |
| 133 | message="invoke sign script and wait" /> |
| 134 | <exec |
| 135 | dir="${basedir}" |
| 136 | executable="ssh" |
| 137 | output="signing.txt" |
| 138 | append="true"> |
| 139 | <arg |
| 140 | line="build.eclipse.org cd ${stagingDirectory}; /usr/bin/sign ${stagingDirectory}/${archiveName} mail ${stagingDirectoryOutput}" /> |
| 141 | </exec> |
| 142 | |
| 143 | <!--Wait for signed build to be available --> |
| 144 | <antcall |
| 145 | target="waitForChangedAttribs"> |
| 146 | <param |
| 147 | name="sshline" |
| 148 | value="build.eclipse.org cd ${stagingDirectoryOutput};ls ${archiveName}" /> |
| 149 | </antcall> |
| 150 | |
| 151 | <!--copy zip back to build machine --> |
| 152 | <echo |
| 153 | message="copy zip back to build machine" /> |
| 154 | <exec |
| 155 | dir="${basedir}" |
| 156 | executable="scp" |
| 157 | output="signing.txt" |
| 158 | append="true"> |
| 159 | <arg |
| 160 | line="build.eclipse.org:${stagingDirectory}/${buildId}-out/${archiveName} ${buildDirectory}/${buildLabel}" /> |
| 161 | </exec> |
| 162 | |
| 163 | <!--delete files on build.eclipse.org--> |
| 164 | <echo |
| 165 | message="delete temp files on build.eclipse.org" /> |
| 166 | <exec |
| 167 | dir="${basedir}" |
| 168 | executable="ssh" |
| 169 | output="signing.txt" |
| 170 | append="true"> |
| 171 | <arg |
| 172 | line="build.eclipse.org /bin/rm -rf ${stagingDirectory}/${buildId}-out ${stagingDirectory}/${archiveName}" /> |
| 173 | </exec> |
| 174 | </target> |
| 175 | <target |
| 176 | name="waitForChangedAttribs" |
| 177 | unless="attribs.changed"> |
| 178 | <antcall |
| 179 | target="compareAttribs" |
| 180 | inheritAll="false"> |
| 181 | <param |
| 182 | name="originalAttribs" |
| 183 | value="${originalAttribs}" /> |
| 184 | </antcall> |
| 185 | </target> |
| 186 | </project> |