-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathbuild.xml
189 lines (167 loc) · 7.2 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<!--
==============================================
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2019
==============================================
-->
<project name="streamsx.sparkMLLib" default="all">
<description>Build file for streamsx.sparkmllib project, built the toolkits.</description>
<!-- check streams install -->
<property environment="env" />
<!-- Exit if there is a bad value in streams.install -->
<fail unless="env.STREAMS_INSTALL" message="No streams installation found. Exiting!"/>
<!-- set global properties for this build -->
<property name="toolkit.dir" value="com.ibm.streamsx.sparkmllib" />
<property name="toolkit.test" value="tests" />
<property name="doc.string" value="doc"/>
<property name="doc.dir" value="doc/spldoc" />
<property name="samples.dir" value="samples" />
<property name="release.dir" value="release"/>
<property name="release.info.file" value="${toolkit.dir}/build.info"/>
<property name="test.dir" location="tests/frameworktests"/>
<property name="out.dir" location="${toolkit.dir}/output"/> <!-- streams studio bin dir / used only on clean target -->
<property name="spl-md" value="${env.STREAMS_INSTALL}/bin/spl-make-doc"/>
<property name="spl-st" value="${env.STREAMS_INSTALL}/bin/streamtool"/>
<!-- Create the time stamp -->
<tstamp/>
<!-- these targets are here due to compatibility -->
<target name="all" depends="spldoc,releaseinfo"
description="Build all toolkit artifacts and spl docs - incremental build"/>
<target name="clean" depends="toolkit-clean,spldoc-clean,releaseinfo-clean"
description="Clean all generated and downloaded toolkit files, clean samples and clean the documentation">
<delete dir="${out.dir}"/>
</target>
<target name="init">
<xmlproperty file="${toolkit.dir}/info.xml" prefix="tkinfo" keepRoot="no"/>
<echo>Build tk version: ${tkinfo.info:identity.info:version}</echo>
</target>
<target name="toolkit" depends="init"
description="Build toolkit code and index the toolkit - incremental build.">
<ant dir="${toolkit.dir}" target="all" />
</target>
<target name="toolkit-clean" depends="samples-clean"
description="Clean all generated and downloaded toolkit files and cleans samples">
<ant dir="${toolkit.dir}" target="clean" />
<delete dir="${tmp}" />
</target>
<target name="spldoc" depends="toolkit"
description="Generate the toolkit documentation">
<property name="tktitle" value="IBMStreams ${ant.project.name} Toolkit" />
<property name="tkauthor" value="IBMStreams Open Source Community at GitHub - https://github.com/IBMStreams/${ant.project.name}" />
<echo message="Tookit to SPLDOC: ${doc.dir}" />
<exec executable="${spl-md}">
<arg value="--include-composite-operator-diagram" />
<arg value="--author" />
<arg value="${tkauthor}" />
<arg value="--doc-title" />
<arg value="${tktitle}" />
<arg value="--directory" />
<arg value="${toolkit.dir}" />
<arg value="--copy-image-files" />
<arg value="--output-directory" />
<arg value="${doc.dir}" />
</exec>
</target>
<target name="spldoc-clean"
description="Clean the toolkit documentation">
<delete dir="${doc.dir}"/>
</target>
<!-- Targets called on samples -->
<target name="samples" depends="toolkit"
description="Build all samples">
<subant target="samplebuild" genericantfile="${basedir}/build.xml" failonerror="true">
<dirset dir="${samples.dir}" includes="*"/>
</subant>
</target>
<target name="samples-clean"
description="Clean all samples">
<subant target="sampleclean" genericantfile="${basedir}/build.xml" failonerror="true">
<dirset dir="${samples.dir}" includes="*"/>
</subant>
</target>
<target name="samplebuild">
<echo message="Sample to build: ${basedir}"/>
<exec executable="make" failonerror="true" dir="${basedir}">
<arg value="-f"/>
<arg value="Makefile"/>
<arg value="build"/>
</exec>
</target>
<target name="sampleclean">
<echo message="Sample to clean: ${basedir}"/>
<exec executable="make" failonerror="true" dir="${basedir}">
<arg value="-f"/>
<arg value="Makefile"/>
<arg value="clean"/>
</exec>
</target>
<!-- Test targets -->
<target name="test" depends="toolkit"
description="Execute the toolkit test. Requires an up to date toolkit build">
<echo message="Start full test"/>
<exec executable="./runTest.sh" dir="${test.dir}" failonerror="true">
<arg value="--noprompt"/>
<arg value="--no-browser"/>
</exec>
</target>
<target name="test-quick" depends="toolkit"
description="Execute the toolkit quick test. Requires an up to date toolkit build">
<echo message="Start quick test"/>
<exec executable="./runTest.sh" dir="${test.dir}" failonerror="true">
<arg value="--noprompt"/>
<arg value="--no-browser"/>
<arg value="--category"/>
<arg value="quick"/>
</exec>
</target>
<!-- Targets to build releases -->
<target name="release" depends="clean"
description="Make a toolkit release archive">
<antcall target="all"/>
<antcall target="samples"/> <!-- check if samples are compile clean -->
<antcall target="samples-clean"/> <!-- remove samples build artifacts -->
<mkdir dir="${release.dir}"/>
<!-- Extract the git commit hash -->
<exec executable="git" outputproperty="commithash">
<arg value="rev-parse" />
<arg value="--short" />
<arg value="HEAD" />
</exec>
<xmlproperty file="${toolkit.dir}/info.xml" prefix="tkinfo" keepRoot="no"/>
<echo message="Make releasefile Toolkit Version: ${tkinfo.info:identity.info:version}"/>
<property name="releasefilename" value="${release.dir}/${ant.project.name}-${tkinfo.info:identity.info:version}-${commithash}-${DSTAMP}-${TSTAMP}.tgz"/>
<tar compression="gzip" longfile="gnu"
destfile="${releasefilename}"
basedir="${basedir}"
includes="${toolkit.dir}/** ${samples.dir}/** ${doc.string}/** README.md LICENSE"
excludes="**/.toolkitList **/.gitignore ${toolkit.dir}/.settings/ ${toolkit.dir}/.project ${toolkit.dir}/.classpath ${toolkit.dir}/build.xml ${toolkit.dir}/pom.xml ${toolkit.dir}/impl/java/ ${samples.dir}/*/output/ **/.apt_generated"
/>
<checksum file="${releasefilename}"/>
<checksum algorithm="sha1" file="${releasefilename}"/>
</target>
<!-- Extract the git commit hash and make release info -->
<target name="releaseinfo" depends="init"
description="Make the release information file">
<exec executable="git" outputproperty="commithash.long" failonerror="true">
<arg value="rev-parse" />
<arg value="HEAD" />
</exec>
<exec executable="bash" outputproperty="streamsversion" failonerror="true">
<arg value="-c"/>
<arg value="${spl-st} version | grep Version="/>
</exec>
<exec executable="bash" failonerror="true">
<arg value="-c" />
<arg value="echo -e "commit_hash=${commithash.long}\nos=${os.version}\nStreams_${streamsversion}" > ${release.info.file}"/>
</exec>
<echo message="Generated release info file ${release.info.file}"/>
<exec executable="bash" failonerror="true">
<arg value="-c" />
<arg value="cat ${release.info.file}" />
</exec>
</target>
<target name="releaseinfo-clean"
description="Remove the release information file">
<delete file="${release.info.file}"/>
</target>
</project>