-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
315 lines (266 loc) · 12.1 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
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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<?xml version="1.0" encoding="UTF-8"?>
<project name="vLab" default="run.test.server" basedir=".">
<description>Builds, tests, and runs the project vLab.</description>
<property file="build.properties"/>
<path id="classpath">
<pathelement path="${full.classpath}"/>
<fileset dir="${dir.reference.lib}">
<include name="**/*.jar"/>
</fileset>
</path>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${dir.reference.lib}/ant-contrib-1.0b3.jar"/>
<target name="javadoc" depends="javadoc.vl"/>
<target name="javadoc.vl" depends="clean.javadoc">
<javadoc sourcepath="${dir.reference.source.src}"
destdir="${dir.reference.javadoc.src}"
use="true"
classpath="${full.classpath}"
encoding="${project.encoding}"
charset="${project.encoding}"/>
</target>
<target name="clean" depends="clean.temp,clean.dist,clean.build,clean.javadoc,clean.pure,clean.vltest"/>
<target name="clean.build">
<delete quiet="true" dir="${dir.reference.build}"/>
</target>
<target name="clean.pure">
<delete quiet="true" dir="${dir.reference.pure}"/>
</target>
<target name="clean.temp">
<delete quiet="true" dir="${dir.reference.temp}"/>
</target>
<target name="clean.javadoc">
<delete quiet="true" dir="${dir.reference.javadoc}"/>
</target>
<target name="clean.dist">
<delete quiet="true" dir="${dir.reference.dist}"/>
</target>
<target name="clean.vltest">
<delete quiet="true" dir="${dir.reference.vltestdist}"/>
</target>
<target name="clean.academicnt">
<delete quiet="true" dir="${dir.reference.academicntdist}"/>
</target>
<target name="make.pure" depends="clean">
<mkdir dir="${dir.reference.pure}"/>
<copy todir="${dir.reference.pure}">
<fileset dir=".">
<exclude name="${dir.reference.pure}"/>
<exclude name="nbproject*/**"/>
<exclude name=".idea/**"/>
</fileset>
</copy>
</target>
<target name="compile" depends="clean.build">
<mkdir dir="${dir.reference.build}"/>
<echo>${full.classpath}</echo>
<if>
<equals arg1="${dev.language}" arg2="java"/>
<then>
<javac srcdir="${dir.reference.source.src}/vlab/server_java"
destdir="${dir.reference.build}"
encoding="${project.encoding}"
includeantruntime="false"
classpathref="classpath"/>
<copy todir="${dir.reference.build}">
<fileset dir="${dir.reference.source.src}" includes="**/**.xml" excludes="**/*js*.xml"/>
</copy>
<javac srcdir="${dir.test}"
destdir="${dir.reference.build}"
encoding="${project.encoding}"
includeantruntime="false"
classpathref="classpath">
<src path="${dir.test}"/>
<exclude name="*Files*.java"/>
</javac>
<copy todir="${dir.reference.build}">
<fileset dir="${dir.test}" includes="**/**.xml" excludes="**/*js*.xml"/>
</copy>
</then>
<elseif>
<equals arg1="${dev.language}" arg2="js"/>
<then>
<javac srcdir="${dir.reference.source.src}/vlab/server_js"
destdir="${dir.reference.build}"
encoding="${project.encoding}"
includeantruntime="false"
classpathref="classpath"/>
<copy todir="${dir.reference.build}">
<fileset dir="${dir.reference.source.src}" includes="**/**.xml" excludes="**/*java*.xml"/>
<fileset dir="${dir.reference.source.src}" includes="**/**.js"/>
</copy>
<javac destdir="${dir.reference.build}"
encoding="${project.encoding}"
includeantruntime="false"
classpathref="classpath">
<src path="${dir.test}"/>
<exclude name="*Beans*.java"/>
</javac>
<copy todir="${dir.reference.build}">
<fileset dir="${dir.test}" includes="**.xml" excludes="*java*.xml"/>
<fileset dir="${dir.test}" includes="**/**.*Request"/>
<fileset dir="${dir.test}" includes="**/**.*Response"/>
</copy>
</then>
</elseif>
</if>
</target>
<target name="make.server" depends="compile,clean.temp">
<path id="dist.classpath">
<fileset dir="${dir.reference.lib}">
<include name="**/*.jar"/>
</fileset>
</path>
<pathconvert property="manifest.classpath" pathsep=" ">
<path refid="dist.classpath"/>
<mapper>
<chainedmapper>
<flattenmapper/>
<globmapper from="*.jar" to="lib/*.jar"/>
</chainedmapper>
</mapper>
</pathconvert>
<copy todir="${dir.reference.dist.server}/lib">
<fileset dir="${dir.reference.lib}" includes="**/*.jar"/>
</copy>
<if>
<equals arg1="${dev.language}" arg2="java"/>
<then>
<jar destfile="${dir.reference.dist.server}/${dist.server.name}" basedir="${dir.reference.build}">
<manifest>
<attribute name="Main-Class" value="${tool.class.java}"/>
<attribute name="Class-Path" value="${manifest.classpath}"/>
</manifest>
</jar>
</then>
<elseif>
<equals arg1="${dev.language}" arg2="js"/>
<then>
<jar destfile="${dir.reference.dist.server}/${dist.server.name}" basedir="${dir.reference.build}">
<manifest>
<attribute name="Main-Class" value="${tool.class.js}"/>
<attribute name="Class-Path" value="${manifest.classpath}"/>
</manifest>
</jar>
</then>
</elseif>
</if>
<copy todir="${dir.reference.dist.server}">
<fileset dir="." includes="${dir.reference.rsc}/${config.name}.*"/>
</copy>
<copy todir="${dir.reference.dist.server}/${dir.reference.rsc}">
<fileset dir="${dir.reference.rsc}" includes="${dir.reference.resources.general}/**"/>
<fileset dir="${dir.reference.rsc}" includes="${dir.reference.resources.server}/**"/>
</copy>
</target>
<target name="make.vltest.zip" depends="make.server, make.tool">
<mkdir dir="${dir.reference.temp}"/>
<copy todir="${dir.reference.temp}/server">
<fileset file="${dir.reference.dist.server}/${dist.server.name}"/>
<fileset dir="${dir.reference.dist.server}" includes="${dir.reference.lib}/**"/>
<fileset dir="${dir.reference.dist.server}" includes="${dir.reference.rsc}/**"/>
</copy>
<copy todir="${dir.reference.temp}/tool">
<fileset dir="${dir.reference.dist.tool}" includes="**/**"/>
</copy>
<mkdir dir="${dir.reference.temp}/frames"/>
<copy file="${dir.reference.rsc}/LaboratoryFrames.xml"
tofile="${dir.reference.temp}/frames/LaboratoryFrames.xml"/>
<echo file="${dir.reference.temp}/lab.desc" append="true">name=${ant.project.name}</echo>
<zip compress="false" destfile="${dir.reference.vltestdist}/${dist.vltest.name}"
basedir="${dir.reference.temp}"/>
<delete quiet="true" dir="${dir.reference.temp}"/>
</target>
<target name="run.test.server" depends="compile">
<junit printsummary="yes" haltonerror="yes" haltonfailure="yes" fork="yes">
<jvmarg value="-Dfile.encoding=UTF-8"/>
<formatter type="plain" usefile="false"/>
<classpath>
<fileset dir="${dir.reference.lib}">
<include name="**/*.jar"/>
</fileset>
<pathelement path="${dir.reference.build}"/>
</classpath>
<batchtest fork="yes">
<fileset dir="${dir.reference.build}">
<include name="*Tests.class"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="injection.JS">
<basename file="${file.name}" property="nameJS"/>
<basename file="${dir.name}" property="dir"/>
<echo file="${temp.html}" append="true"><script type="text/javascript" src="js/${dir}/${nameJS}"></script>${line.separator}</echo>
</target>
<target name="injection.CSS">
<basename file="${file.name}" property="nameCSS"/>
<basename file="${dir.name}" property="dir"/>
<echo file="${temp.html}" append="true">
<link rel="stylesheet" href="css/${dir}/${nameCSS}" type="text/css" />${line.separator}
</echo>
</target>
<target name="injection.file">
<delete quiet="true" file="${temp.html}"/>
<touch file="${temp.html}"/>
<echo file="${temp.html}" append="true"><!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'/>
<title>ToolViewer</title>
</echo>
<foreach target="injection.CSS" param="file.name">
<fileset dir="${dir.css.src}" casesensitive="yes">
<include name="lib/**/*.css"/>
<exclude name="dev/**/*.css"/>
</fileset>
<param name="dir.name" value="lib"/>
</foreach>
<foreach target="injection.CSS" param="file.name">
<fileset dir="${dir.css.src}" casesensitive="yes">
<include name="dev/**/*.css"/>
<exclude name="lib/**/*.css"/>
</fileset>
<param name="dir.name" value="dev"/>
</foreach>
<echo file="${temp.html}" append="true">
</head>
<body>
<div id="jsLab"></div>
<input type="text" value="genfake" id="preGeneratedCode"/>
<input type="text" value="calcfake" id="calculatedCode"/>
<input type="text" value="prevsolfake" id="previousSolution"/>
</echo>
<foreach target="injection.JS" param="file.name">
<fileset dir="${dir.js.src}" casesensitive="yes">
<include name="lib/**/*.js"/>
<exclude name="dev/**/*.js"/>
</fileset>
<param name="dir.name" value="lib"/>
</foreach>
<foreach target="injection.JS" param="file.name">
<fileset dir="${dir.js.src}" casesensitive="yes">
<include name="dev/**/*.js"/>
<exclude name="lib/**/*.js"/>
</fileset>
<param name="dir.name" value="dev"/>
</foreach>
<echo file="${temp.html}" append="true">
</body>
</html>
</echo>
</target>
<target name="make.tool" depends="compile,clean.temp,injection.file">
<copy todir="${dir.reference.dist.tool}">
<fileset dir="${dir.webapp.src}" includes="**/**"/>
</copy>
<!--<zip destfile="${dir.reference.dist.tool}/${dist.tool.name}" basedir="${dir.webapp.src}"/>-->
</target>
<target name="run.test.tool" depends="make.tool">
<property name="mydirectory" location="${dir.webapp.src}"/>
<script language="javascript"><![CDATA[
location = "file:///"+project.getProperty("mydirectory").toString().replaceAll("\\\\","/")+"/index.html";
java.awt.Desktop.getDesktop().browse(java.net.URI.create(location));
]]>
</script>
</target>
</project>