-
Notifications
You must be signed in to change notification settings - Fork 1
/
VDCTBuild.xml
297 lines (261 loc) · 10.8 KB
/
VDCTBuild.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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<project name="VisualDCT" default="jar" basedir=".">
<property name="build.output" value="${basedir}/build"/>
<property name="project.name" value="VisualDCT"/>
<property name="build.version" value="Source"/>
<!--
<taskdef classname="au.com.Langdale.styler.StylerTask" name="styler"/>
<taskdef name="webdoc" classname="com.cosylab.vdct.ant.WebGeneratorTask"/>
<taskdef name="webrt" classname="com.cosylab.vdct.ant.WebRTTicketGeneratorTask"/>
<taskdef name="projectwebdoc" classname="com.cosylab.vdct.ant.ProjectWebGeneratorTask"/>
<taskdef name="versioner" classname="com.cosylab.vdct.ant.VersionTask"/>-->
<property name="build.software" value="./3rdParty"/>
<property name="dir.src" value="."/>
<property name="doc.xsl" value="../Common/Documentation/Normal.xsl"/>
<property name="web.xsl" value="../Common/Documentation/ProjectsWeb.xsl"/>
<!--property name="build.type" value="N/A"/-->
<path id="build.classpath">
<pathelement path="${java.class.path}"/>
</path>
<target name="check" unless="build.output">
<echo message="*** This is the default Cosylab ANT buildfile for VisualDCT software. ***"/>
<echo message=""/>
<echo message="It requires the following parameters to be passed to the ANT JVM using the -D cmdline parameter:"/>
<echo message="build.output - The target directory where the results of the build process should be stored."/>
<echo message="build.version - The version of the build to override automatic versioning (optional)."/>
<echo message=""/>
<fail message="Property 'build.output' not set."/>
</target>
<target name="intro" depends="check">
<echo message="*** This is the default Cosylab ANT buildfile for VisualDCT software. ***"/>
<echo message=""/>
</target>
<target name="init" depends="intro">
<tstamp>
<format property="YEAR" pattern="yyyy"/>
</tstamp>
<property name="dir.dist" value="${build.output}/${project.name}/${build.version}"/>
<property name="dir.build" value="${dir.dist}/build"/>
<property name="dir.temp" value="${dir.dist}/temp"/>
<property name="dir.tests" value="${dir.build}"/>
<property name="dir.doc" value="${dir.dist}/doc"/>
<property name="dir.javadoc" value="${dir.doc}/api"/>
<mkdir dir="${dir.build}"/>
<record name="${dir.build}/buildlog.txt" append="no" loglevel="info"/>
<echo message="Building project ${project.name}"/>
<echo message="Software for build process is installed in: ${build.software}."/>
<echo message="Version: ${build.version}."/>
<echo message="Distribution will be created in: ${dir.dist}."/>
<property name="cp" refid="build.classpath"/>
<echo message="External classpath is ${cp}."/>
<mkdir dir="${dir.temp}"/>
</target>
<target name="replaceversions" depends="init" if="build.version">
<replace dir="${dir.src}" token="@@VERSION@@" value="${build.version}" includes="*.java"/>
</target>
<target name="replacecopyrights" depends="init" if="build.copyright">
<replace dir="${dir.src}" token="@@COPYRIGHT@@" includes="*.java">
<replacevalue>
<![CDATA[
/**
* Copyright (c) @@YEAR@@, Cosylab, Ltd., Control System Laboratory, www.cosylab.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of the Cosylab, Ltd., Control System Laboratory nor the names
* of its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
]]>
</replacevalue>
</replace>
</target>
<target name="replaces" depends="replacecopyrights">
<replace dir="${dir.src}" token="@@PROJECT@@" value="${project.name}" includes="*.java"/>
<replace dir="${dir.src}" token="@@LICENCE@@" value="${build.copyright}" includes="*.java"/>
<replace dir="${dir.src}" token="@@YEAR@@" value="${YEAR}" includes="*.java"/>
</target>
<!--target name="compile" depends="replaces, replaceversions"-->
<target name="compile" depends="init">
<property name="build.compiler" value="modern"/>
<javac srcdir="${dir.src}/src" destdir="${dir.temp}" classpathref="build.classpath" source="1.4">
<classpath refid="build.classpath"/>
</javac>
</target>
<target name="copyresources" depends="compile">
<mkdir dir="${dir.temp}/docs"/>
<copy todir="${dir.temp}/docs">
<fileset dir="${dir.src}/src/docs"/>
</copy>
<mkdir dir="${dir.temp}/images"/>
<copy todir="${dir.temp}/images">
<fileset dir="${dir.src}/src/images"/>
</copy>
<mkdir dir="${dir.temp}/config"/>
<copy todir="${dir.temp}/config">
<fileset dir="${dir.src}/src/config"/>
</copy>
</target>
<target name="test" depends="copyresources" if="test.class">
<mkdir dir="${dir.tests}"/>
<junit printsummary="yes" fork="on">
<classpath refid="build.classpath"/>
<test name="${test.class}" todir="${dir.tests}">
<formatter type="xml"/>
</test>
</junit>
<junitreport todir="${dir.tests}">
<fileset dir="${dir.tests}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${dir.tests}"/>
</junitreport>
</target>
<target name="jar" depends="copyresources">
<mkdir dir="${dir.dist}"/>
<jar jarfile="${dir.dist}/${project.name}.jar">
<fileset dir="${dir.temp}"/>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<section name="com/cosylab/vdct">
<attribute name="Implementation-Title" value="com.cosylab.vdct" />
<attribute name="Implementation-Version" value="${build.version}" />
<attribute name="Implementation-Vendor" value="Cosylab Ltd." />
</section>
<attribute name="Main-Class" value="com.cosylab.vdct.VisualDCT" />
<!--attribute name="Class-Path" value="" /-->
</manifest>
</jar>
</target>
<target name="srcjar" depends="test">
<mkdir dir="${dir.dist}"/>
<jar jarfile="${dir.dist}/${project.name}-src-${build.version}.jar">
<fileset dir="${dir.src}" includes="src/**,VDCTBuild.xml,VDCTBuildSimple.xml,build.xml" excludes="**/*.class"/>
</jar>
</target>
<target name="docjar" depends="doc">
<mkdir dir="${dir.dist}"/>
<zip zipfile="${dir.dist}/${project.name}-doc-${build.version}.zip">
<zipfileset dir="${dir.doc}" prefix="doc"/>
</zip>
</target>
<target name="doall" depends="test, srcjar, signjar, doc, docjar, web">
<antcall target="cleanup"/>
<property name="zip.file" value="${dir.dist}/${project.name}-dist-${build.version}.zip"/>
<zip zipfile="${zip.file}" encoding="UTF8">
<zipfileset dir="${dir.dist}" excludes="**/${project.name}*.zip" prefix="${build.version}"/>
<zipfileset dir="${dir.dist}/../" includes="index.html"/>
</zip>
<property name="zip.file" value="${dir.dist}/${project.name}-dist-${build.version}.zip"/>
</target>
<target name="distribution">
<property name="build.version.new" value=""/>
<antcall target="doall"/>
</target>
<target name="javadoc" depends="init" if="javadoc.packages">
<javadoc sourcepath="${dir.src}/src" destdir="${dir.javadoc}" packagenames="${javadoc.packages}" windowtitle="${project.name} API">
<classpath refid="build.classpath"/>
</javadoc>
</target>
<target name="cleanup">
<delete dir="${dir.temp}"/>
</target>
<target name="doc" depends="init, javadoc">
<styler>
<fileset dir="${dir.src}/doc">
<include name="*.xml"/>
</fileset>
<transform file="${doc.xsl}"/>
<output dir="${dir.doc}" type="html">
<mapper type="glob" from="*.xml" to="*.html"/>
</output>
</styler>
<copy todir="${dir.doc}">
<fileset dir="${dir.src}/doc">
<exclude name="*.xsl"/>
<exclude name="*.xml"/>
</fileset>
</copy>
<copy todir="${dir.dist}">
<fileset dir="${dir.src}">
<include name="*.html"/>
</fileset>
</copy>
</target>
<target name="signjar" depends="jar">
<!--signjar jar="${dir.dist}/${project.name}.jar" alias="Cosylab" .../-->
</target>
<target name="web" depends="doc">
<copy file="${dir.src}/runScript" todir="${dir.dist}"/>
<copy file="${dir.src}/flatdb" todir="${dir.dist}"/>
<webdoc dir="${dir.dist}" targetProject="${project.name}" version="${build.version}" type="${build.type}"/>
<styler>
<transform file="${web.xsl}"/>
<fileset dir="${dir.dist}">
<include name="index.xml"/>
</fileset>
<output dir="${dir.dist}" type="html">
<mapper type="glob" from="*.xml" to="*.html"/>
</output>
</styler>
<projectwebdoc dir="${dir.dist}" targetProject="${project.name}" version="${build.version}" type="${build.type}"/>
<styler>
<transform file="${web.xsl}"/>
<fileset dir="${dir.dist}">
<include name="index.xml"/>
</fileset>
<output dir="${dir.dist}" type="html">
<mapper type="glob" from="*.xml" to="*.phtml"/>
</output>
</styler>
<move file="${dir.dist}/index.phtml" tofile="${dir.dist}/../index.html"/>
<delete file="${dir.dist}/index.xml"/>
</target>
<target name="typechk" unless="build.type">
<property name="build.type" value="N/A"/>
</target>
<target name="rt" depends="init, typechk">
<webrt dir="${dir.dist}" targetProject="${project.name}" version="${build.version}" type="${build.type}"/>
<styler>
<transform file="${web.xsl}"/>
<fileset dir="${dir.dist}">
<include name="rt.xml"/>
</fileset>
<output dir="${dir.dist}" type="html">
<mapper type="glob" from="*.xml" to="*.html"/>
</output>
</styler>
<delete file="${dir.dist}/rt.xml"/>
</target>
<target name="release">
<property name="build.type" value="release"/>
<property name="build.changelog" value=""/>
<antcall target="distribution"/>
</target>
<target name="build">
<property name="build.type" value="integration build"/>
<property name="build.changelog" value=""/>
<antcall target="distribution"/>
</target>
<target name="all">
<property name="build.type" value="integration build"/>
<antcall target="doall"/>
</target>
</project>