-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
328 lines (284 loc) · 9.83 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
316
317
318
319
320
321
322
323
324
325
326
327
328
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project name="Brity" default="clean" basedir=".">
<description>
Ant file designed to upload and run a EV3 project using LeJOS project.
</description>
<!-- DEVELOPMENT SECTION -->
<property name="environment" value="EV3" />
<property name="project" value="Brity"/>
<property name="version" value="0.1"/>
<property name="base.dir" value="." />
<property name="src" location="src"/>
<property name="lib" location="${base.dir}/lib" />
<property name="lib-eclipse" location="${base.dir}/lib-eclipse" />
<property name="cobertura.dir" location="${base.dir}/qa/cobertura" />
<property name="report.findbugs.dir" location="${base.dir}/qa/findbugs" />
<property name="javadoc" location="${base.dir}/docs/api" />
<property name="uml.dir" value="${base.dir}/docs/uml"/>
<property name="build" location="build"/>
<property name="dist" location="target"/>
<property name="dist.lib" location="${dist}/lib"/>
<property name="logs" location="${base.dir}/logs" />
<!-- EV3 SSH SECTION -->
<property name="host" value="192.168.43.62"/>
<property name="username" value="root"/>
<property name="password" value=""/>
<!-- EV3 LINUX SECTION -->
<property name="remotePath" value="/home/root/lejos/examples/"/>
<!-- CLASS SECTION -->
<!--
<property name="package" value="jab.lejos.liverobots.brity.fsm.states"/>
<property name="class" value="Observe"/>
<property name="package" value="jab.lejos.db"/>
<property name="class" value="TestDB"/>
<property name="package" value="jab.lejos.utils"/>
<property name="class" value="log4jExample"/>
-->
<!--
<property name="package" value="jab.lejos.ev3.sensors.net"/>
<property name="class" value="EV3TimeSensorTest"/>
<property name="package" value="jab.lejos.liverobots.hfsm"/>
<property name="class" value="HFSMTest"/>
<property name="package" value="jab.lejos.liverobots.fsm.bumpercar"/>
<property name="class" value="BumperCarFSMTest"/>
<property name="package" value="jab.lejos.liverobots.websocket"/>
<property name="class" value="RemoteControlTest"/>
<property name="package" value="jab.lejos.liverobots.fsm.beetle"/>
<property name="class" value="BeetleFSMTest"/>
-->
<property name="package" value="jab.lejos.ev3.mapping"/>
<property name="class" value="OccupancyGridTest1"/>
<!-- TARGET SECTION -->
<target name="init">
<tstamp/>
<echo message="Initializating ANT."/>
<condition property="debugging">
<equals arg1="${environment}" arg2="LOCAL" />
</condition>
</target>
<target name="development" depends="init">
<tstamp/>
<echo message="Development phase."/>
<antcall target="infraestructure" />
<antcall target="packaging" />
<!-- <antcall target="docs" />
<antcall target="qa" />-->
</target>
<target name="infraestructure">
<tstamp/>
<echo message="Initializating environment."/>
<antcall target="local-init" />
<antcall target="remote-init" />
</target>
<target name="local-init" description="Initializating local environment" >
<tstamp/>
<echo message="Initializating local environment."/>
<mkdir dir="${build}"/>
<mkdir dir="${uml.dir}"/>
<mkdir dir="${logs}"/>
<mkdir dir="${dist}"/>
<mkdir dir="${dist.lib}"/>
<mkdir dir="${javadoc}"/>
<mkdir dir="${cobertura.dir}"/>
</target>
<target name="remote-init" unless="debugging" description="Initializating local environment" >
<tstamp/>
<echo message="Initializating remote environment."/>
<sshexec host="${host}"
username="${username}"
password="${password}"
command="cd ${remotePath}; rm -f -r ${project}; mkdir ${project}; cd ${project}; mkdir lib;"
/>
</target>
<target name="compilation" description="Compile your project" >
<tstamp/>
<echo message="Compiling project."/>
<javac srcdir="${src}" destdir="${build}">
<classpath>
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
</javac>
</target>
<target name="packaging" depends="compilation" description="generate the distribution" >
<tstamp/>
<echo message="Packaging project."/>
<jar jarfile="${dist}/${project}-${DSTAMP}.jar" basedir="${build}">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Title" value="${project}"/>
<attribute name="Specification-Version" value="${version}"/>
<attribute name="Specification-Vendor" value="JAB"/>
<attribute name="Implementation-Title" value="${project}"/>
<attribute name="Implementation-Version" value="${version} ${TODAY}"/>
<attribute name="Implementation-Vendor" value="JAB"/>
<attribute name="Main-Class" value="${package}.${class}"/>
<attribute name="Class-Path" value="
lib/log4j-1.2.17.jar
lib/hsqldb.jar
lib/joda-time-2.3.jar
lib/commons-beanutils-1.8.2.jar
lib/commons-digester-1.8.1.jar
lib/commons-jexl-1.1.jar
lib/commons-logging-1.1.1.jar
lib/commons-scxml-0.9.jar
lib/xalan-2.6.0.jar
lib/java_websocket.jar
/home/root/lejos/lib/ev3classes.jar
/home/root/lejos/libjna/usr/share/java/jna.jar
"
/>
</manifest>
</jar>
<echo message="Packaging project dependencies."/>
<copy todir="${dist.lib}">
<fileset dir="${lib}">
<exclude name="ev3classes.jar"/>
</fileset>
</copy>
</target>
<target name="docs">
<echo message="Generating project's documentation."/>
<antcall target="javadocs" />
<antcall target="uml" />
<antcall target="publish" />
</target>
<target name="javadocs">
<javadoc
destdir="${javadoc}"
private="true"
author="true"
version="true">
<doclet name="org.umlgraph.doclet.UmlGraphDoc" path="${lib-eclipse}/umlgraph-5.6.jar">
<!--
<param name="-inferrel"/>
<param name="-inferdep"/>
<param name="-hide" value="java.*"/>
<param name="-collpackages" value="java.util.*"/>
<param name="-qualify"/>
<param name="-postfixpackage"/>
<param name="-nodefontsize" value="9"/>
<param name="-nodefontpackagesize" value="7"/>
<param name="-link" value="http://java.sun.com/j2se/1.5.0/docs/guide/javadoc/doclet/spec"/>
<param name="-link" value="http://java.sun.com/j2se/1.5/docs/api"/>
-->
<param name="-all" />
</doclet>
<fileset dir="src" defaultexcludes="yes">
<include name="**/*.java"/>
<exclude name="**/*Test*"/>
</fileset>
</javadoc>
</target>
<target name="uml">
<javadoc
destdir="${javadoc}"
private="true"
author="true"
version="true">
<doclet name="org.umlgraph.doclet.UmlGraph" path="${lib-eclipse}/umlgraph-5.6.jar">
<param name="-d" value="${uml.dir}"/>
<param name="-all" />
</doclet>
<fileset dir="src" defaultexcludes="yes">
<include name="**/*.java"/>
<exclude name="**/*Test*"/>
</fileset>
</javadoc>
<apply executable="dot" dest="${uml.dir}" parallel="false">
<arg value="-Tpng"/>
<arg value="-o"/>
<targetfile/>
<srcfile/>
<fileset dir="${uml.dir}" includes="*.dot"/>
<mapper type="glob" from="*.dot" to="*.png"/>
</apply>
</target>
<target name="publish">
<exec executable="/bin/bash">
<arg value="publish.sh"/>
</exec>
</target>
<target name="qa" >
<tstamp/>
<echo message="QA phase."/>
<antcall target="findbugs" />
</target>
<target name='findbugs2' depends="packaging">
<echo>${user.dir}</echo>
<mkdir dir="${report.findbugs.dir}" />
<taskdef name='findbugs'
classname='edu.umd.cs.findbugs.anttask.FindBugsTask'
classpath='${lib-eclipse}/findbugs-ant.jar'
/>
<findbugs home='${user.dir}/lib-eclipse/'
effort="max"
debug="true"
output="xml:withMessages"
outputFile='${report.findbugs.dir}/report.xml' >
<sourcePath path="${base.dir}/src/" />
<class location="${dist}/${project}-${DSTAMP}.jar" />
</findbugs>
<echo message='Findbugs complete, output in ${report.findbugs.dir}'/>
</target>
<target name="deployment" depends="development">
<tstamp/>
<echo message="Deployment phase."/>
<antcall target="run" />
</target>
<target name="deploy" unless="debugging">
<tstamp/>
<echo message="Deploying software."/>
<antcall target="local-deployment" />
<antcall target="remote-deployment" />
</target>
<target name="local-deployment">
<tstamp/>
<echo message="Deploying in local."/>
</target>
<target name="remote-deployment">
<tstamp/>
<echo message="Deploying software into EV3 Brick."/>
<scp file="${dist}/${project}-${DSTAMP}.jar"
todir="${username}:@${host}:${remotePath}${project}/"
/>
<echo message="Deploying software dependencies into EV3 Brick."/>
<scp todir="${username}:@${host}:${remotePath}${project}/lib/">
<fileset dir="${dist.lib}"/>
</scp>
</target>
<target name="run" unless="debugging" depends="deploy">
<tstamp/>
<echo message="Running software."/>
<antcall target="local-run" />
<antcall target="remote-run" />
</target>
<target name="local-run">
<tstamp/>
<echo message="Running software in local."/>
</target>
<target name="remote-run">
<tstamp/>
<echo message="Running software in remote."/>
<sshexec host="${host}"
username="${username}"
password="${password}"
command="cd ${remotePath}${project}/; jrun -jar ${project}-${DSTAMP}.jar "
/>
</target>
<target name="clean" depends="deployment" description="Clean up" >
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
<!-- UTILITIES -->
<target name="halt">
<tstamp/>
<echo message="Shutdown EV3 brick."/>
<sshexec host="${host}"
username="${username}"
password="${password}"
command="halt "
/>
</target>
</project>