|
6 | 6 | <property environment="env" /> |
7 | 7 | <property name="streams.install" value="${env.STREAMS_INSTALL}" /> |
8 | 8 | <property name="toolkit" location="com.ibm.streamsx.inet"/> |
9 | | - <property name="release.base" location="release-${ant.project.name}-" /> |
10 | 9 | <property name="toolkit.test" location="tests" /> |
| 10 | + <property name="release.dir" location="release" /> |
| 11 | + <property name="release.info.file" value="${toolkit}/build.info"/> |
| 12 | + <property name="spl-md" value="${env.STREAMS_INSTALL}/bin/spl-make-doc" /> |
| 13 | + <property name="spl-st" value="${env.STREAMS_INSTALL}/bin/streamtool" /> |
| 14 | + |
| 15 | + <!-- Create the time stamp --> |
| 16 | + <tstamp/> |
11 | 17 |
|
12 | 18 | <target name="all" |
13 | 19 | description="Build the toolkit code, build the samples index and generate the spl documentation" |
14 | 20 | depends="toolkit,samples, spldoc_work, toolkitIndexOnly" |
15 | 21 | /> |
16 | 22 |
|
17 | 23 | <target name="setcommitversion"> |
18 | | - <!-- Create the time stamp --> |
19 | | - <tstamp/> |
20 | 24 |
|
21 | 25 | <!-- Extract the git commit hash --> |
22 | 26 | <exec executable="git" outputproperty="commithash"> |
|
44 | 48 | </exec> |
45 | 49 | </target> |
46 | 50 |
|
47 | | - <target name="clean" depends="cleansamples" |
| 51 | + <target name="clean" depends="cleansamples,releaseinfo-clean" |
48 | 52 | description="clean up toolkit code and samples"> |
49 | 53 | <delete includeemptydirs="true"> |
50 | 54 | <fileset dir="${basedir}" includes="release-*/"/> |
|
152 | 156 | </target> |
153 | 157 |
|
154 | 158 | <!-- Targets to build releases --> |
155 | | - <target name="release" description="Build the release bundle" |
156 | | - depends="clean,setcommitversion,create_release_bundle,revertversion,toolkitIndexOnly" |
157 | | - /> |
158 | | - <target name="create_release_bundle" depends="all"> |
159 | | - <property name="release.dir" location="${release.base}${commithash}" /> |
160 | | - <mkdir dir="${release.dir}" /> |
161 | | - <property name="releasefilename" value="${release.dir}/streamsx.inet.toolkits-${tkinfo.identity.version}-${DSTAMP}-${TSTAMP}.tgz"/> |
162 | | - <tar compression="gzip" longfile="gnu" |
| 159 | + <target name="release" description="Make a toolkit release archive - purge workspace and build toolkit from scratch" depends="clean"> |
| 160 | + <antcall target="release-target" inheritAll="true"/> |
| 161 | + </target> |
| 162 | + |
| 163 | + <target name="release-target" depends="releaseinfo"> |
| 164 | + <!-- prepare toolkit code and docs --> |
| 165 | + <antcall target="all" inheritAll="true"/> |
| 166 | + <antcall target="cleansamples" inheritAll="true"/> <!-- remove toolkit index from samples --> |
| 167 | + <!-- get os type string --> |
| 168 | + <property name="osVersion" value="${os.version}"/> |
| 169 | + <condition property="osPlat" value="el7"> |
| 170 | + <contains string="${osVersion}" substring="el7" casesensitive="false"/> |
| 171 | + </condition> |
| 172 | + <condition property="osPlat" value="el6"> |
| 173 | + <contains string="${osVersion}" substring="el6" casesensitive="false"/> |
| 174 | + </condition> |
| 175 | + <!-- Extract the git commit hash --> |
| 176 | + <exec executable="git" outputproperty="commithash.short"> |
| 177 | + <arg value="rev-parse"/> |
| 178 | + <arg value="--short"/> |
| 179 | + <arg value="HEAD"/> |
| 180 | + </exec> |
| 181 | + <!-- create release bundle --> |
| 182 | + <mkdir dir="${release.dir}" /> |
| 183 | + <property name="releasefilename" value="${release.dir}/streamsx.inet.toolkit-${tkinfo.identity.version}-${osPlat}-${os.arch}-${commithash.short}-${DSTAMP}-${TSTAMP}.tgz"/> |
| 184 | + <tar compression="gzip" longfile="gnu" |
163 | 185 | destfile="${releasefilename}" |
164 | 186 | basedir="${basedir}" |
165 | 187 | includes="${tkinfo.identity.name}/** samples/**" |
166 | | - excludes="**/.gitignore **/.gitkeep **/.settings/** **/.settings **/.project **/.classpath com.ibm.streamsx.inet/impl/java/src-gen/** com.ibm.streamsx.inet/impl/java/classes/** com.ibm.streamsx.inet/impl/cpp/bin/**" |
167 | | - /> |
168 | | - <checksum file="${releasefilename}"/> |
169 | | - <checksum algorithm="sha1" file="${releasefilename}"/> |
| 188 | + excludes="**/.gitignore **/.gitkeep com.ibm.streamsx.inet/impl/java/src-gen/** com.ibm.streamsx.inet/impl/java/classes/** com.ibm.streamsx.inet/impl/cpp/bin/** com.ibm.streamsx.inet/.project com.ibm.streamsx.inet/.settings/** com.ibm.streamsx.inet/.classpath " |
| 189 | + /> |
| 190 | + <checksum file="${releasefilename}"/> |
| 191 | + <checksum algorithm="sha1" file="${releasefilename}"/> |
| 192 | + <!-- revert commithash --> |
| 193 | + <antcall target="revertversion" inheritAll="true"/> |
| 194 | + </target> |
| 195 | + |
| 196 | + <!-- Extract the git commit hash and make release info --> |
| 197 | + <target name="releaseinfo" depends="clean-ignored" description="Make the release information file ${release.info.file}"> |
| 198 | + <exec executable="git" outputproperty="commithash.long" failonerror="true"> |
| 199 | + <arg value="rev-parse" /> |
| 200 | + <arg value="HEAD" /> |
| 201 | + </exec> |
| 202 | + <exec executable="bash" outputproperty="streamsversion" failonerror="true"> |
| 203 | + <arg value="-c"/> |
| 204 | + <arg value="${spl-st} version | grep Version="/> |
| 205 | + </exec> |
| 206 | + <exec executable="bash" failonerror="true"> |
| 207 | + <arg value="-c" /> |
| 208 | + <arg value="echo -e "commit_hash=${commithash.long}\nos=${os.version}\nStreams_${streamsversion}" > ${release.info.file}"/> |
| 209 | + </exec> |
| 210 | + <echo message="Generated release info file ${release.info.file}"/> |
| 211 | + <exec executable="bash" failonerror="true"> |
| 212 | + <arg value="-c" /> |
| 213 | + <arg value="cat ${release.info.file}" /> |
| 214 | + </exec> |
| 215 | + <!-- Extract info from the toolkit's info.xml --> |
| 216 | + <xmlproperty file="${toolkit}/info.xml" prefix="tkinfo" keepRoot="no"/> |
| 217 | + </target> |
| 218 | + |
| 219 | + <target name="releaseinfo-clean" description="remove the release information file ${release.info.file}"> |
| 220 | + <delete file="${release.info.file}"/> |
| 221 | + </target> |
| 222 | + |
| 223 | + <!--- Targets to purge the workspace before a release archive is ptroduced --> |
| 224 | + <target name="clean-ignored" depends="warn-unclean" description="Remove all git-ignored files (exclude model files) and warn if workspace has uncommited changes"/> |
| 225 | + |
| 226 | + <target name="warn-unclean" depends="check-unclean" if="has.uncommited"> |
| 227 | + <echo>!Your workspace is not clean!</echo> |
| 228 | + <echo>Commit all changes before you produce a release</echo> |
| 229 | + <echo>commitstatus:</echo> |
| 230 | + <echo>${commitstatus}</echo> |
| 231 | + <input>Press Return key to continue or ^C to exit...</input> |
| 232 | + </target> |
| 233 | + |
| 234 | + <target name="check-unclean" depends="warn-untracked"> |
| 235 | + <exec executable="git" outputproperty="commitstatus"> |
| 236 | + <arg value="status" /> |
| 237 | + <arg value="--porcelain" /> |
| 238 | + </exec> |
| 239 | + <!-- set condition true if there are any non-whitespaces --> |
| 240 | + <condition property="has.uncommited"> |
| 241 | + <matches string="${commitstatus}" pattern="\S" multiline="true"/> |
| 242 | + </condition> |
| 243 | + <echo message="has.uncommited=${has.uncommited}"/> |
| 244 | + </target> |
| 245 | + |
| 246 | + <target name="warn-untracked" depends="check-untracked" if="has.untracked"> |
| 247 | + <echo>!!! DANGER: Git-ignored files to be removed from your workspace:</echo> |
| 248 | + <echo>${untracked}</echo> |
| 249 | + <input>Press Return key to continue or ^C to exit...</input> |
| 250 | + <exec executable="git" failonerror="true"> |
| 251 | + <arg value="clean"/> |
| 252 | + <arg value="--force"/> |
| 253 | + <arg value="-d"/> |
| 254 | + <arg value="-x"/> |
| 255 | + <arg value="--"/> |
| 256 | + <arg value="${toolkit}/"/> |
| 257 | + <arg value="samples/"/> |
| 258 | + <arg value="README.md"/> |
| 259 | + <arg value="doc/"/> |
| 260 | + </exec> |
170 | 261 | </target> |
| 262 | + |
| 263 | + <target name="check-untracked"> |
| 264 | + <exec executable="git" outputproperty="untracked" failonerror="true"> |
| 265 | + <arg value="clean"/> |
| 266 | + <arg value="--dry-run"/> |
| 267 | + <arg value="-d"/> |
| 268 | + <arg value="-x"/> |
| 269 | + <arg value="--"/> |
| 270 | + <arg value="${toolkit}/"/> |
| 271 | + <arg value="samples/"/> |
| 272 | + <arg value="README.md"/> |
| 273 | + <arg value="doc/"/> |
| 274 | + </exec> |
| 275 | + <!-- set condition true if there are any non-whitespaces --> |
| 276 | + <condition property="has.untracked"> |
| 277 | + <matches string="${untracked}" pattern="\S" multiline="true"/> |
| 278 | + </condition> |
| 279 | + <echo message="has.untracked=${has.untracked}"/> |
| 280 | + </target> |
| 281 | + |
171 | 282 | </project> |
0 commit comments