forked from MyRobotLab/myrobotlab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
581 lines (503 loc) · 25.9 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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
<!--
Dependencies: git
The goal is always to make the build more simple :)
Currently the only dependencies come with the git clone are in the build directory.
Build Types - Network
noNetwork - no network at all - build number will need to be date time stamp
minNetwork - a quick local build - no remote git pull - only a http://myrobotlab.org/buildnumber.php?increment
this would be appropriate for very fast deployment - more detail should be flushed out for minimal distribution
myrobotlab without root/jars ??? classes only ???
fullNetwork - increment + remote git pull - post release etc
Build Type - Goals
min - local build - min distribution
test - junit and Incubator
TODO - ivy maven build
FIXME !!!- use ivy correctly !
FIXME !!!- manage proxy for ivy
FIXME !!! - not so straightforward
https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin#GitPlugin-AdvancedFeatures
Push notification from repository
curl http://yourserver/jenkins/git/notifyCommit?url=<URL of the Git repository>[&branches=branch1[,branch2]*][&sha1=<commit ID>]
TODO - use more Ivy to actually manage dependencies
TODO use Ivy to place "integration" libraries into build directory for GUIService & Service
TODO test on multiple platforms Linux etc
TODO build native code with virtual vms - put in CI system
TODO - list use cases - all need tags - v1.0.bn - testing - (incremental fast build)
use cases - (local only - no connectivity | post bleeding edge jar | post release.zip)
connectivity - dependencies (none all local | myrobotlab.org/buildnumber.php | github | proxy)
build types - [clean | simple | incremental]
uploads - push release - [ none | release myrobotlab.tag.jar | myrobotlab.tag.zip | both? | (local only)]
build location - [local | jenkins | travis]
tests [multi platform]
TODO - dependencies
build - java 1.7
dist - git token environment variable
Jenkins Notes -
Jenkins->Manage Jenkins->Manage Plugins->Advanced tab to set proxy - git client
The git client will not follow global .gitconfig directives
Jenkins->Node->(master)->configure - configure ANT_HOME JAVA_HOME and PATH
tasks
FIXME - incremental build (no temp)
FIXME - need proxy support
FIXME - git hub release SHOULD NOT be created before compilation/distribution
init
compile
dist
clean
junit
report
mail
javadoc
publishBleedingEdge
publishRelease
definitions
${version} = ${rev}.${DSTAMP}.${TSTAMP}
${tag} = "myrobotlab.${version}
publishBleedingEdge
publishRelease
JSON Urls
https://api.github.com/repos/MyRobotLab/myrobotlab
https://api.github.com/repos/MyRobotLab/myrobotlab/releases
https://api.github.com/repos/MyRobotLab/myrobotlab/contents/
https://api.github.com/repos/MyRobotLab/myrobotlab/git/trees/:sha
repo
https://api.github.com/repos/MyRobotLab/repo
https://api.github.com/repos/MyRobotLab/repo/contents/:org/:module/:version
https://api.github.com/repos/MyRobotLab/repo/contents/com.google.gson/gson
References:
-Dhttps.proxyHost=webproxy -Dhttps.proxyPort=80 -Dhttp.proxyHost=webproxy -Dhttp.proxyPort=80
-->
<!-- FIXME - LOCAL VERSUS NETWORKED - NETWORK-BUILD NUMBER ONLY - INCREMENTAL BUILD -->
<project name="myrobotlab" default="javadoc">
<description>http://myrobotlab.org myrobotlab build file</description>
<!--
${build.properties} external build properties - you can override the location of the build properties file
by using JVM param -Dbuild.properties=newpathlocation or in the ant build call e.g. ant -propertyfile <newPathName>
-->
<!-- TODO - junit tests multiple virtualbox os-->
<!-- set global properties for this build -->
<property name="src" location="src" />
<property name="build" location="build" />
<property name="dist" location="dist" />
<property name="report" location="report" />
<property name="resource.root" location="${build}/resource/root" />
<property name="build.properties" location="build.properties" />
<tstamp />
<taskdef name="http" classname="org.missinglink.ant.task.http.HttpClientTask">
<classpath>
<!-- had to modify the original to not dump header auth token to std out -->
<pathelement location="${build}/lib/ml-ant-http-1.1.3.1.jar" />
</classpath>
</taskdef>
<!-- ================ init begin ================= -->
<target name="init" depends="repoDoesNotExists, repoExists">
<echo message="compiling with ${ant.java.version}" />
<!-- FIXME add unit tests if
<property name="junit.jar" location="../myrobotlab-tests/../lib" />
<property name="junit.src" location="../myrobotlab-tests/src" />
-->
<property name="XMLConstants.FEATURE_SECURE_PROCESSING" value="false" />
<property name="network.available" value="true" />
<!-- mail task properties -->
<property name="mail.host" value="smtp.gmail.com" />
<property name="mail.port" value="464" />
<property name="mail.subjectalert" value="Test build" />
<property name="mail.ssl" value="yes" />
<property name="mail.username" value="" />
<!-- get from local properties file -->
<property name="mail.password" value="" />
<!-- get from local properties file -->
<property name="mail.from" value="[email protected]" />
<property name="mail.tolist" value="" />
<property environment="env" />
<!-- TODO - create a local descriptor for non-build server (dev) builds -->
<!-- or will tag's be sufficient -->
<!-- TODO - get repo's comment -->
<!-- build.number = from main CI
tag = build number ? for incremental builds - unless overridden by dev build directive... -->
<property environment="env" />
<!-- ============ tag begin ================= -->
<!-- FIXME - internet build number if available - if fail use date or local file increment? -->
<!-- Travis and Jenkin build numbers
<echo message="env.BUILD_NUMBER env.BUILD_NUMBER=${env.BUILD_NUMBER}" />
<echo message="travis job id - $TRAVIS_JOB_ID" />
-->
<echo message="date time ${DSTAMP}.${TSTAMP}" />
<property name="build.number" value="${env.BUILD_NUMBER}" />
<!-- property name="tag" value="1.0.${build.number}" / -->
<!-- property name="tag" value="${DSTAMP}.${TSTAMP}" / -->
<!-- TODO add missing link global method http://myrobotlab.org/buildnumber.php !!! -->
<!-- local tag git commit index <property name="tag" value="1.0.${BUILD_NUMBER}" /> -->
<!-- property name="tag" value="${DSTAMP}.${TSTAMP}" /-->
<echo message="tag ${tag}" />
<!-- git log -1 - -pretty=%B -->
<!-- FIXME - OOPS forgot about mrl pull ! only have repo !!! -->
<exec executable="git" dir="./" outputproperty="comment">
<arg value="log" />
<arg value="-1" />
<arg value="--pretty=%B" />
</exec>
<echo message="comment [${comment}]" />
<!-- property name="comment" value="${DSTAMP}.${TSTAMP}" /-->
<!-- ============ tag end ================= -->
<!-- http://larrycai.wordpress.com/2013/02/22/publish-the-artifacts-inside-travis-ci-to-github/ -->
<property name="github.token" value="${env.GITHUB_TOKEN}" />
<!-- echo message="github.token ${env.GITHUB_TOKEN}" / -->
<!-- after_success:
- git commit -a -m "Committed by Travis-CI build number: $TRAVIS_JOB_ID"
-->
<!-- property name="tag" value="${build.number}" / -->
<!-- property name="tag" value="1.0.${build.number}" /-->
<!-- need to depends on getTag() -->
<http method="GET" url="http://myrobotlab.org/buildnumber.php?action=increment" expected="200" printresponseheaders="false" printrequestheaders="false" printresponse="true" entityProperty="buildnumber.response">
<headers />
</http>
<!-- <property name="tag" value="1.0.14" /> -->
<property name="tag" value="1.0.${buildnumber.response}" />
<!-- GOOD <property name="tag" value="1.0.${buildnumber.response}" /> -->
<echo message="tag ${tag}" />
<!-- Create the build directory structure used by compile -->
<!-- TODO set all subsequent directories or resources with appended tag -->
<!-- TODO branch on the tag in release -->
<property name="temp" location="${dist}/temp/${tag}" />
<property name="bin" location="${temp}/bin" />
<property name="toZip" location="${temp}/toZip/${tag}" />
<!-- create all necessary directories -->
<mkdir dir="${dist}" />
<mkdir dir="${dist}/archive" />
<mkdir dir="${dist}/temp" />
<mkdir dir="${dist}/temp/${tag}" />
<mkdir dir="${bin}" />
<mkdir dir="${temp}/toZip" />
<mkdir dir="${toZip}" />
<!-- load local overrides from build.properties -->
<loadproperties srcFile="${build.properties}" />
</target>
<!-- ================ init end ================= -->
<!-- FIXME - fixme with ivy -->
<path id="myrobotlab.classpath">
<pathelement location="bin" />
<pathelement location="../repo/com.centralnexus.joystick/0.7/Joystick.jar" />
<pathelement location="../repo/com.mxgraph.jgraph/1.6.1.2/jgraphx.jar" />
<pathelement location="../repo/com.sun.java3d/1.5.1/j3dcore.jar" />
<pathelement location="../repo/com.sun.java3d/1.5.1/j3dutils.jar" />
<pathelement location="../repo/com.sun.java3d/1.5.1/vecmath.jar" />
<pathelement location="../repo/com.sun.jna/3.2.2/jna.jar" />
<pathelement location="../repo/com.sun.speech.freetts/1.2/freetts.jar" />
<pathelement location="../repo/edu.cmu.sphinx/4-1.0beta6/batch.jar" />
<pathelement location="../repo/edu.cmu.sphinx/4-1.0beta6/jsapi-1.0-base.jar" />
<pathelement location="../repo/edu.cmu.sphinx/4-1.0beta6/sphinx4.jar" />
<pathelement location="../repo/edu.cmu.sphinx/4-1.0beta6/tags.jar" />
<pathelement location="../repo/edu.cmu.sphinx/4-1.0beta6/TIDIGITS_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar" />
<pathelement location="../repo/edu.cmu.sphinx/4-1.0beta6/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar" />
<pathelement location="../repo/edu.cmu.sphinx/4-1.0beta6/WSJ_8gau_13dCep_8kHz_31mel_200Hz_3500Hz.jar" />
<pathelement location="../repo/gnu.io.rxtx/2.1-7r2/RXTXcomm.jar" />
<pathelement location="../repo/javaclient3.playerstage/3/javaclient3.jar" />
<pathelement location="../repo/javaFlacEncoder.FLAC_FileEncoder/0.1/javaFlacEncoder-0.1.jar" />
<pathelement location="../repo/javax.speech.recognition/1.0/jsapi.jar" />
<pathelement location="../repo/javax.vecmath/1.5.1/vecmath.jar" />
<pathelement location="../repo/javazoom.jl.player/1.0.1/jl1.0.1.jar" />
<pathelement location="../repo/net.sourceforge.simbad/1.4/simbad-1.4.jar" />
<pathelement location="../repo/org.apache.ivy/2.4.0-rc1/ivy-2.4.0-rc1.jar" />
<pathelement location="../repo/org.apache.log4j/1.2.14/log4j-1.2.14.jar" />
<pathelement location="../repo/org.jfugue.music/4.0.3/jfugue-4.0.3.jar" />
<pathelement location="../repo/org.op.chess/1.0.0/ChessBoard.jar" />
<pathelement location="../repo/org.python.core/2.5.2/jython.jar" />
<pathelement location="../repo/org.tritonus.share.sampled.floatsamplebuffer/0.3.6/tritonus_share-0.3.6.jar" />
<pathelement location="../repo/simbad.gui/1.4/simbad-1.4.jar" />
<pathelement location="../repo/wiiuse.wiimote/0.12b/wiiusej.jar" />
<pathelement location="../repo/org.slf4j/1.6.1/slf4j-log4j12-1.6.1.jar" />
<pathelement location="../repo/org.slf4j/1.6.1/slf4j-api-1.6.1.jar" />
<pathelement location="../repo/com.sun.mail/1.4.5/dsn.jar" />
<pathelement location="../repo/com.sun.mail/1.4.5/imap.jar" />
<pathelement location="../repo/com.sun.mail/1.4.5/mail.jar" />
<pathelement location="../repo/com.sun.mail/1.4.5/mailapi.jar" />
<pathelement location="../repo/com.sun.mail/1.4.5/pop3.jar" />
<pathelement location="../repo/com.sun.mail/1.4.5/smtp.jar" />
<!-- pathelement location="../repo/com.googlecode.colorutils/r9/colorutils.jar"/ -->
<pathelement location="../repo/net.java.games.jinput/20120914/jinput.jar" />
<pathelement location="../repo/org.fife.rsyntaxtextarea/2.0.4.1/rsyntaxtextarea.jar" />
<pathelement location="../repo/org.fife.autocomplete/2.0.4/autocomplete.jar" />
<pathelement location="../repo/com.googlecode.jssc/0.9.0/jssc.jar" />
<pathelement location="../repo/com.googlecode.chatterbot/1.2.1/chatter-bot-api.jar" />
<pathelement location="../repo/com.pi4j.pi4j/0.0.5/pi4j-core.jar" />
<pathelement location="../repo/com.pi4j.pi4j/0.0.5/pi4j-gpio-extension.jar" />
<pathelement location="../repo/it.sauronsoftware.cron4j/2.2.5/cron4j-2.2.5.jar" />
<pathelement location="../repo/org.drjava.java/20120818/asm-3.1.jar" />
<pathelement location="../repo/org.drjava.java/20120818/dynamicjava-base.jar" />
<pathelement location="../repo/org.drjava.java/20120818/plt.jar" />
<pathelement location="../repo/net.sourceforge.tess4j/1.1/tess4j.jar" />
<pathelement location="../repo/org.apache.commons.httpclient/4.2.5/commons-codec-1.6.jar" />
<pathelement location="../repo/org.apache.commons.httpclient/4.2.5/commons-logging-1.1.1.jar" />
<pathelement location="../repo/org.apache.commons.httpclient/4.2.5/fluent-hc-4.2.5.jar" />
<pathelement location="../repo/org.apache.commons.httpclient/4.2.5/httpclient-4.2.5.jar" />
<pathelement location="../repo/org.apache.commons.httpclient/4.2.5/httpclient-cache-4.2.5.jar" />
<pathelement location="../repo/org.apache.commons.httpclient/4.2.5/httpcore-4.2.4.jar" />
<pathelement location="../repo/org.apache.commons.httpclient/4.2.5/httpmime-4.2.5.jar" />
<pathelement location="../repo/com.wolfram.alpha/1.1/WolframAlpha-1.1.jar" />
<pathelement location="../repo/com.strobel.decompiler/0.3.2/procyon-decompiler-0.3.2.jar" />
<pathelement location="../repo/edu.northwestern.topcodes/1.0/topcodes.jar" />
<pathelement location="../repo/org.simpleframework.xml/2.7/simple-xml-2.7.jar" />
<pathelement location="../repo/org.jivesoftware.smack/3.3.0/smack.jar" />
<pathelement location="../repo/com.google.gson/2.2.4/gson-2.2.4.jar" />
<pathelement location="../repo/com.googlecode.javacv/0.6/javacpp.jar" />
<pathelement location="../repo/com.googlecode.javacv/0.6/javacv-windows-x86_64.jar" />
<pathelement location="../repo/com.googlecode.javacv/0.6/javacv.jar" />
<pathelement location="../repo/net.sourceforge.opencv/2.4.6/opencv-2.4.6.0-windows-x86_64.jar" />
<pathelement location="../repo/net.sourceforge.opencv/2.4.6/opencv-2.4.6.0-windows-x86.jar" />
<pathelement location="../repo/net.sourceforge.opencv/2.4.6/opencv-2.4.6.1-android-arm.jar" />
<pathelement location="../repo/net.sourceforge.opencv/2.4.6/opencv-2.4.6.1-linux-x86_64.jar" />
<pathelement location="../repo/net.sourceforge.opencv/2.4.6/opencv-2.4.6.1-linux-x86.jar" />
<pathelement location="../repo/net.sourceforge.opencv/2.4.6/opencv-2.4.6.1-macosx-x86_64.jar" />
<pathelement location="../repo/org.java_websocket.websocket/1.2/java_websocket.jar" />
<pathelement location="../repo/org.twitter4j.twitter/3.0.5/twitter4j-async-3.0.5.jar" />
<pathelement location="../repo/org.twitter4j.twitter/3.0.5/twitter4j-core-3.0.5.jar" />
<pathelement location="../repo/org.twitter4j.twitter/3.0.5/twitter4j-examples-3.0.5.jar" />
<pathelement location="../repo/org.twitter4j.twitter/3.0.5/twitter4j-media-support-3.0.5.jar" />
<pathelement location="../repo/org.twitter4j.twitter/3.0.5/twitter4j-stream-3.0.5.jar" />
<pathelement location="../repo/com.googlecode.simpleopenni/1.96/SimpleOpenNI.jar" />
<pathelement location="../repo/io.netty/4.0.19/netty-all-4.0.19.Final.jar" />
<pathelement location="../repo/org.junit/4.11/junit-4.11.jar" />
<pathelement location="../repo/org.saintandreas.jovr/0.3.2.4/jovr-0.3.2.4.jar" />
<pathelement location="../repo/org.aitools.programd/4.6/programd-main.jar" />
<pathelement location="../repo/org.aitools.programd/4.6/programd-rhino.jar" />
<pathelement location="../repo/" />
</path>
<!-- class path for testing FIXME - add junit normalize git -->
<path id="ant_ext.classpath" description="for ant extentions">
<fileset dir="${build}/lib">
<include name="**/*.jar" />
</fileset>
</path>
<!-- FIXME !!!- use ivy correctly ! -->
<!-- FIXME !!!- manage proxy for ivy -->
<!-- =============== repo begin =============== -->
<!-- repo added if not already cloned - does update to head -->
<target name="repoCheck">
<available file="../repo" property="repo.present" />
<!-- http://stackoverflow.com/questions/18097555/execute-ant-task-if-two-conditions-are-met -->
<condition property="git.pull">
<and>
<available file="../repo" />
<istrue value="${network.available}" />
</and>
</condition>
<condition property="git.clone">
<and>
<not>
<available file="../repo" />
</not>
<istrue value="${network.available}" />
</and>
</condition>
</target>
<target name="repoExists" depends="repoCheck" if="git.pull">
<echo message="git pull ../repo" />
<echo message="${git.pull}" />
<exec executable="git" dir="../repo">
<!-- <arg value="fetch"/> -->
<arg value="pull" />
</exec>
</target>
<target name="repoDoesNotExists" depends="repoCheck" if="git.clone">
<echo message="git clone https://github.com/MyRobotLab/repo.git ../repo" />
<exec executable="git">
<arg value="clone" />
<arg value="https://github.com/MyRobotLab/repo.git" />
<arg value="../repo" />
</exec>
</target>
<!-- =============== repo end =============== -->
<!--
<taskdef name="upload" classname="no.kinsey.ant.GitHubUploadTask">
<classpath>
<pathelement location="${build}/lib/githubUpdate.jar" />
</classpath>
</taskdef>
-->
<target name="compile" depends="init" description="compile the source ">
<echo>compile start</echo>
<!-- compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${bin}" debug="true" includeantruntime="false">
<exclude name="org/myrobotlab/service/Android.java" />
<exclude name="org/myrobotlab/service/SEAR.java" />
<exclude name="org/myrobotlab/control/SEARGUI.java" />
<exclude name="org/myrobotlab/service/ArduinoBT.java" />
<classpath refid="myrobotlab.classpath" />
</javac>
<!-- copy resource.root -->
<copy todir="${bin}/resource">
<fileset dir="${src}/resource" />
</copy>
<echo file="${bin}/resource/version.txt">${tag}</echo>
<!-- copy the latest serviceData.xml into package -->
<copy file="./../repo/serviceData.xml" todir="${bin}/resource/framework" />
<jar jarfile="${toZip}/libraries/jar/myrobotlab.jar" basedir="${bin}">
<!-- excludes="org/myrobotlab/boot/" -->
<manifest>
<attribute name="Main-Class" value="org.myrobotlab.framework.Bootstrap" />
<attribute name="Built-By" value="${user.name}" />
<!-- section name="myrobotlab" -->
<section name="compile">
<attribute name="Specification-Title" value="myrobotlab" />
<attribute name="Specification-Version" value="${tag}" />
<attribute name="Specification-Vendor" value="myrobotlab" />
<attribute name="Implementation-Title" value="myrobotlab" />
<attribute name="Implementation-Version" value="${tag}" />
<attribute name="Implementation-Vendor" value="myrobotlab.org" />
</section>
</manifest>
</jar>
<property name="myrobotlab.jar" location="${toZip}/libraries/jar/myrobotlab.jar" />
<copy todir="${toZip}">
<fileset dir="${resource.root}" />
</copy>
<!-- FIXME - use Ivy to get the files there ! filebase or url resolver -->
<echo>compile end</echo>
</target>
<!-- FYI - HTTP STATUS 422 - MEANS YOU ALREADY HAVE THAT RELEASE MADE !!! -->
<target name="createGitHubRelease" depends="init">
<echo message="token = ${github.token}" />
<http method="POST" url="https://api.github.com/repos/MyRobotLab/myrobotlab/releases" expected="201" printresponseheaders="false" printrequestheaders="false" printresponse="false" entityProperty="release.response">
<headers>
<header name="Authorization" value="token ${github.token}" />
</headers>
<entity value="{"tag_name": "${tag}","target_commitish": "master","name": "${tag}","body": "${comment}","draft": false,"prerelease": false}">
</entity>
</http>
<echo message="${release.response}" />
</target>
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${build}/lib/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
<target name="getAssetsURL" depends="createGitHubRelease">
<propertyregex property="upload_url" input="${release.response}" regexp="(?<=upload_url":")(.*)(?=\{\?name\})" select="\1" />
<echo message="${upload_url}" />
</target>
<target name="uploadMyrobotlab.jar" depends="compile, getAssetsURL">
<echo message="${myrobotlab.jar}" />
<http method="POST" url="${upload_url}" printresponseheaders="false" printrequestheaders="false" printresponse="false" expected="201">
<!-- http method="POST" url="http://localhost:7979/repos/MyRobotLab/myrobotlab/releases" -->
<headers>
<header name="Authorization" value="token ${github.token}" />
<header name="Accept" value="application/vnd.github.manifold-preview" />
<header name="Content-Type" value="application/java-archive" />
</headers>
<query>
<parameter name="name" value="myrobotlab.jar" />
</query>
<entity file="${myrobotlab.jar}" binary="true" />
</http>
</target>
<target name="uploadZip" depends="dist, getAssetsURL, uploadMyrobotlab.jar">
<echo message="${myrobotlab.jar}" />
<http method="POST" url="${upload_url}" printresponseheaders="false" printrequestheaders="false" printresponse="false" expected="201">
<!-- http method="POST" url="http://localhost:7979/repos/MyRobotLab/myrobotlab/releases" -->
<headers>
<header name="Authorization" value="token ${github.token}" />
<header name="Accept" value="application/vnd.github.manifold-preview" />
<header name="Content-Type" value="application/java-archive" />
</headers>
<query>
<parameter name="name" value="myrobotlab.${tag}.zip" />
</query>
<entity file="${temp}/myrobotlab.${tag}.zip" binary="true" />
</http>
</target>
<target name="dist" depends="compile" description="generate the distribution">
<chmod file="${toZip}/*.sh" perm="ugo+rx" />
<zip destfile="${temp}/myrobotlab.${tag}.zip" basedir="${toZip}" />
</target>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${temp} directory trees -->
<delete dir="${build}" />
<delete dir="${temp}" />
</target>
<target name="junit" depends="dist">
<copy todir="${build}/resource">
<fileset dir="${src}/resource" />
</copy>
<!-- FIXME !!! compile tests -->
<javac srcdir="${junit.src}" destdir="${build}" includeantruntime="false">
<classpath>
<fileset dir="${temp}/libraries/jar">
<include name="myrobotlab.jar" />
</fileset>
<path refid="myrobotlab.classpath" />
</classpath>
</javac>
<!-- run tests - Services will need to be loaded if they don't come
with the default mrl load ie. if they have dependencies on the repo -->
<mkdir dir="${report}" />
<junit printsummary="yes" haltonfailure="yes">
<!-- haltonfailure to bubble up the failure info to ant & jenkins -->
<sysproperty key="java.awt.headless" value="true" />
<!-- any junit tests would fail running on jenkins with gui components -->
<classpath>
<fileset dir="${temp}/libraries/jar">
<include name="**/*.jar" />
</fileset>
<pathelement path="${junit.jar}/junit-4.4.jar" />
<!-- pathelement path="${temp}/${tag}/libraries/jar/myrobotlab.jar"/ -->
<pathelement location="${build}" />
<!-- FIXME - I should be able to pick everything up from the libraries include ?!? -->
</classpath>
<formatter type="xml" />
<batchtest fork="yes" todir="${report}">
<fileset dir="${junit.src}" includes="**/test/**/*.java" />
</batchtest>
</junit>
<!-- <classloaderreport/> -->
</target>
<target name="report" depends="junit">
<junitreport todir="${report}">
<fileset dir="${report}" includes="TEST-*.xml" />
<report todir="${report}" format="noframes">
</report>
</junitreport>
</target>
<target name="mail" depends="report">
<mail mailhost="${mail.host}" mailport="${mail.port}" subject="${mail.subjectalert}" ssl="${mail.ssl}" user="${mail.username}" password="${mail.password}" tolist="${mail.tolist}">
<from address="${mail.from}" />
<!-- <to address="${mail.to}"/> -->
<message>The nightly build has completed</message>
<attachments>
<fileset dir="${report}">
<include name="**/*.html" />
</fileset>
</attachments>
</mail>
</target>
<target name="javadoc">
<javadoc access="public" packagenames="org.myrobotlab.*" author="true" destdir="javadoc" doctitle="myrobotlab" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" source="1.7" sourcepath="src" splitindex="true" use="true" version="true">
<arg value="-notimestamp" />
<classpath refid="myrobotlab.classpath" />
</javadoc>
</target>
<target name="publishBleedingEdge" depends="report" description="publish bleeding edge to google code">
<!--
<input message="Please enter upload userid:" addproperty="gc.upload.userid" />
<input message="Please enter upload password:" addproperty="gc.upload.password" />
<taskdef classname="net.bluecow.googlecode.ant.GoogleCodeUploadTask" name="gcupload" classpathref="ant_ext.classpath" />
<gcupload username="${env.gc.upload.userid}" password="${env.gc.upload.password}" projectname="myrobotlab" verbose="true" filename="${temp}/${tag}/libraries/jar/myrobotlab.jar" targetfilename="myrobotlab.bleeding.edge.${version}.jar" summary="bleeding edge - ${svn.comment}" labels="OpSys-All" />
-->
</target>
<target name="publishRelease" depends="publishBleedingEdge" description="publish release to google code">
<!--
<input message="Please enter upload userid:" addproperty="gc.upload.userid" />
<input message="Please enter upload password:" addproperty="gc.upload.password" />
<taskdef classname="net.bluecow.googlecode.ant.GoogleCodeUploadTask" name="gcupload" classpathref="ant_ext.classpath" />
<gcupload username="${env.gc.upload.userid}" password="${env.gc.upload.password}" projectname="myrobotlab" verbose="true" filename="${temp}/${tag}.zip" targetfilename="myrobotlab.${version}.zip" summary="complete package - ${svn.comment}" labels="OpSys-All,Featured" />
-->
</target>
<!-- TODO - upload javadoc, check in javadoc? -->
<!-- how to call a class directly
<target name="run" depends="compile">
<java fork="true" failonerror="yes" classname="Addition" classpath="build">
<arg line=""/>
</java>
</target>
-->
</project>