Skip to content

Commit 5bb60ee

Browse files
authored
Merge pull request #317 from joergboe/master
Improved release package
2 parents 8694431 + 94140e3 commit 5bb60ee

File tree

2 files changed

+129
-17
lines changed

2 files changed

+129
-17
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ samples/*/toolkit.xml
3333
samples/*/.toolkitList
3434
samples/*/bin
3535
/samples/*/doc
36-
/release-*
36+
/release/
37+
/com.ibm.streamsx.inet/build.info
3738

3839
## java excludes
3940
*.class

build.xml

Lines changed: 127 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,21 @@
66
<property environment="env" />
77
<property name="streams.install" value="${env.STREAMS_INSTALL}" />
88
<property name="toolkit" location="com.ibm.streamsx.inet"/>
9-
<property name="release.base" location="release-${ant.project.name}-" />
109
<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/>
1117

1218
<target name="all"
1319
description="Build the toolkit code, build the samples index and generate the spl documentation"
1420
depends="toolkit,samples, spldoc_work, toolkitIndexOnly"
1521
/>
1622

1723
<target name="setcommitversion">
18-
<!-- Create the time stamp -->
19-
<tstamp/>
2024

2125
<!-- Extract the git commit hash -->
2226
<exec executable="git" outputproperty="commithash">
@@ -44,7 +48,7 @@
4448
</exec>
4549
</target>
4650

47-
<target name="clean" depends="cleansamples"
51+
<target name="clean" depends="cleansamples,releaseinfo-clean"
4852
description="clean up toolkit code and samples">
4953
<delete includeemptydirs="true">
5054
<fileset dir="${basedir}" includes="release-*/"/>
@@ -152,20 +156,127 @@
152156
</target>
153157

154158
<!-- 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"
163185
destfile="${releasefilename}"
164186
basedir="${basedir}"
165187
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 &quot;commit_hash=${commithash.long}\nos=${os.version}\nStreams_${streamsversion}&quot; > ${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>
170261
</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+
171282
</project>

0 commit comments

Comments
 (0)