forked from energia/Energia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
815 lines (664 loc) · 29.5 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
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
<?xml version="1.0"?>
<project name="Energia" default="build">
<!--echo message="os.name = ${os.name}" /-->
<!--echo message="os.arch = ${os.arch}" /-->
<!--echo message="os.version = ${os.version}" /-->
<!-- Sets properties for macosx/windows/linux depending on current system -->
<condition property="macosx"><os family="mac" /></condition>
<condition property="windows"><os family="windows" /></condition>
<condition property="linux"><os family="unix" /></condition>
<condition property="linux32"><os family="unix" arch="i386" /></condition>
<condition property="linux64"><os family="unix" arch="amd64" /></condition>
<condition property="platform"
value="macosx"><os family="mac" /></condition>
<condition property="platform"
value="windows"><os family="windows" /></condition>
<condition property="platform"
value="linux32"><os family="unix" arch="i386" /></condition>
<condition property="platform"
value="linux64"><os family="unix" arch="amd64" /></condition>
<condition property="build-dir" value="macosx">
<os family="mac" /></condition>
<condition property="build-dir" value="linux">
<os family="unix" /></condition>
<condition property="build-dir" value="windows">
<os family="windows" /></condition>
<condition property="dep.common.default.ok" value="true"><os family="mac"/></condition>
<condition property="dep.common.default.ok" value="true"><os family="windows"/></condition>
<condition property="dep.common.default.ok" value="true"><os family="unix"/></condition>
<!-- Libraries required for running energia -->
<fileset dir=".." id="runtime.jars">
<include name="core/core.jar" />
<include name="app/pde.jar" />
<include name="app/lib/ecj.jar" />
<include name="app/lib/jna.jar" />
<include name="app/lib/RXTXcomm.jar" />
<include name="app/lib/ant.jar" />
<include name="app/lib/ant-launcher.jar" />
</fileset>
<property name="version.suffix" value=""/>
<property name="closure-version" value="emt-b07"/>
<target name="check-closure">
<condition property="closure.exists">
<available file="${build-dir}/closure-${closure-version}.tar.gz"/>
</condition>
</target>
<condition property="closure-dest" value="macosx/work/Energia.app/Contents/Resources/Java/hardware/emt">
<os family="mac" /></condition>
<condition property="closure-dest" value="linux/work/hardware/emt">
<os family="unix" /></condition>
<condition property="closure-dest" value="windows/work/hardware/emt">
<os family="windows" /></condition>
<target name="download-closure" depends="check-closure" unless="closure.exists">
<echo message="Downloading closure"/>
<get src="http://energia.nu/files/closure-${closure-version}.tar.gz" dest="${build-dir}/closure-${closure-version}.tar.gz"/>
</target>
<target name="unzip-closure" depends="download-closure">
<untar compression="gzip" dest="${closure-dest}" src="${build-dir}/closure-${closure-version}.tar.gz" overwrite="false"/>
</target>
<condition property="common-tools-dest" value="macosx/work/Energia.app/Contents/Resources/Java">
<os family="mac" /></condition>
<condition property="common-tools-dest" value="windows/work">
<os family="windows" /></condition>
<condition property="common-tools-dest" value="linux/work">
<os family="unix" /></condition>
<target name="check-common-tools">
<condition property="common-tools.exists">
<available file="${build-dir}/tools-common.tar.bz2"/>
</condition>
</target>
<target name="build" description="Build Energia.">
<antcall target="${platform}-build" />
</target>
<target name="run" description="Run Energia.">
<antcall target="${platform}-run" />
</target>
<target name="dist" depends="revision-check"
description="Build Energia for distribution.">
<input message="Enter version number:"
addproperty="version"
defaultvalue="${revision}" />
<antcall target="${platform}-dist" />
</target>
<!-- "§$§$&, ant doesn't have a built-in help target :( -->
<target name="help" description="Show project help">
<java classname="org.apache.tools.ant.Main">
<arg value="-p" />
</java>
</target>
<!-- - - - - - - - - - - - - - - - - - -->
<!-- Subprojects: Core, App, Libraries -->
<!-- - - - - - - - - - - - - - - - - - -->
<target name="subprojects-clean">
<subant buildpath="../core" target="clean"/>
<subant buildpath="../app" target="clean"/>
</target>
<target name="subprojects-build">
<subant buildpath="../core" target="build"/>
<subant buildpath="../app" target="build"/>
</target>
<!-- - - - - - - - - -->
<!-- Basic Assembly -->
<!-- - - - - - - - - -->
<target name="assemble">
<fail unless="target.path"
message="Do not call assemble from the command line." />
<!-- copy shared tools folder -->
<copy todir="${target.path}/tools">
<fileset dir="shared/tools">
<exclude name="*avr*" />
</fileset>
</copy>
<!-- copy library folder -->
<!--
<copy todir="${target.path}/libraries">
<fileset dir="../libraries" />
</copy>
-->
<!-- copy hardware folder -->
<copy todir="${target.path}/hardware">
<fileset dir="../hardware">
<exclude name="**/arduino/" />
<exclude name="**/cc3200emt/libraries/WiFi/" />
</fileset>
</copy>
<!-- create the emt directory -->
<mkdir dir="${target.path}/hardware/emt" />
<!-- copy emt sources
<copy todir="${target.path}/hardware/emt/ti/runtime/wiring/">
<fileset dir="../emt/src/ti/runtime/wiring/">
</fileset>
</copy>
-->
<macrodef name="copylibs">
<attribute name="todir"/>
<sequential>
<copy todir="@{todir}">
<fileset dir="../libraries"
includes="**/Adafruit_TMP006/, **/OneWire/, **/CogLCD/, **/aJson,
**/PubNub/, **/Temboo/, **/MQTTClient, **/PubSubClient,
**/OPT3001/, **/M2XStreamClient/, **/OneMsTaskTimer/,
**/LCD_SharpBoosterPack_SPI/"
/>
</copy>
</sequential>
</macrodef>
<copylibs todir="${target.path}/hardware/cc2600emt/libraries"/>
<copylibs todir="${target.path}/hardware/msp430/libraries"/>
<copylibs todir="${target.path}/hardware/lm4f/libraries"/>
<copylibs todir="${target.path}/hardware/cc3200/libraries"/>
<copylibs todir="${target.path}/hardware/msp432/libraries"/>
<copylibs todir="${target.path}/hardware/cc3200emt/libraries"/>
<!-- download and unzip TI-RTOS closure -->
<antcall target="unzip-closure"/>
<!-- get WiFi library from emt closure, but get examples from Energia -->
<move todir="${target.path}/hardware/cc3200emt/libraries/WiFi">
<fileset dir="${target.path}/hardware/emt/ti/runtime/wiring/cc3200/libraries/WiFi">
</fileset>
</move>
<copy todir="${target.path}/hardware/cc3200emt/libraries/WiFi/examples">
<fileset dir="../hardware/cc3200emt/libraries/WiFi/examples">
</fileset>
</copy>
<!-- copy shared examples folder -->
<copy todir="${target.path}/examples">
<fileset dir="shared/examples">
<exclude name="**/ArduinoISP/"/>
</fileset>
</copy>
<!-- Unzip documentation -->
<unzip dest="${target.path}" src="shared/reference.zip" overwrite="false"/>
<!-- Write the revision file! -->
<echo file="${target.path}/lib/version.txt" message="${version}${version.suffix}" />
</target>
<!-- - - - - - - - - -->
<!-- Revision check -->
<!-- - - - - - - - - -->
<target name="revision-check">
<!-- figure out the revision number -->
<loadfile srcfile="../todo.txt" property="revision">
<filterchain>
<headfilter lines="1"/>
<tokenfilter>
<stringtokenizer suppressdelims="true"/>
<!-- grab the thing from the first line that's 4 digits -->
<containsregex pattern="(\d\d\d\d\w\d\d\d\d)" />
</tokenfilter>
</filterchain>
</loadfile>
<!-- <echo message="revision is ${revision}." /> -->
<!-- figure out the revision number in base.java -->
<loadfile srcfile="../app/src/processing/app/Base.java"
property="revision.base">
<filterchain>
<tokenfilter>
<linetokenizer />
<containsregex pattern="String VERSION_NAME = "/>
<replaceregex pattern="[^0-9E]*" flags="g" replace=""/>
</tokenfilter>
</filterchain>
</loadfile>
<!-- <echo message="base revision is ${revision.base}." /> -->
<condition property="revision.correct">
<!-- Using contains because I can't figure out how to get rid of the
LF in revision.base. Please file a bug if you have a fix. -->
<contains string="${revision.base}" substring="${revision}"/>
</condition>
<!-- the revision.base property won't be set
if $revision wasn't found... -->
<fail unless="revision.correct"
message="Fix revision number in Base.java" />
</target>
<!-- - - - - - - - -->
<!-- Mac OS X -->
<!-- - - - - - - - -->
<target name="macosx-clean" depends="subprojects-clean" description="Clean Mac OS X build">
<delete dir="macosx/work" />
<delete dir="macosx/working_dir" />
<delete dir="macosx/working.dmg" />
<delete file="macosx/energia-*.dmg" />
</target>
<target name="macosx-checkos" unless="macosx">
<echo>
=======================================================
Energia for Mac OS X can only be built on Mac OS X.
Bye.
=======================================================
</echo>
<fail message="wrong platform (${os.name})" />
</target>
<property name="arm.tools.mac.local" value="arm_tools_mac.zip"/>
<property name="msp430.tools.mac.local" value="msp430_tools_mac_05_2015.zip"/>
<condition property="exists.tools.mac">
<and>
<available property="exists.dep.arm.mac" file="macosx/${arm.tools.mac.local}"/>
<available property="exists.dep.msp430.mac" file="macosx/${msp430.tools.mac.local}"/>
</and>
</condition>
<property name="dep.arm.default.ok" value="true"/>
<target name="download-common-tools-mac" depends="check-common-tools" unless="common-tools.exists">
<echo message="Downloading common tools"/>
<get src="http://energia.nu/files/tools-common-${platform}.tar.bz2" dest="${build-dir}/tools-common.tar.bz2"/>
</target>
<target name="unzip-common-tools-mac" if="dep.common.default.ok" depends="download-common-tools-mac">
<untar src="${build-dir}/tools-common.tar.bz2" dest="${common-tools-dest}" compression="bzip2" overwrite="false"/>
<chmod file="macosx/work/Energia.app/Contents/Resources/Java/tools/common/bin/make" perm="755" />
<chmod file="macosx/work/Energia.app/Contents/Resources/Java/tools/common/DSLite/DebugServer/bin/DSLite" perm="755" />
</target>
<target name="check.deps.mac"
if="dep.arm.default.ok"
unless="exists.tools.mac">
<property name="arm.tools.mac.remote" value="http://energia.nu/files/arm_tools_mac.zip"/>
<property name="msp430.tools.mac.remote" value="http://energia.nu/files/msp430_tools_mac_05_2015.zip"/>
<!-- Get tools tools -->
<get src="${arm.tools.mac.remote}" dest="macosx/${arm.tools.mac.local}"/>
<get src="${msp430.tools.mac.remote}" dest="macosx/${msp430.tools.mac.local}"/>
</target>
<target name="macosx-build" if="macosx" depends="revision-check, macosx-checkos, check.deps.mac, unzip-common-tools-mac, subprojects-build" description="Build Mac OS X version">
<mkdir dir="macosx/work" />
<!-- assemble the pde -->
<copy todir="macosx/work/Energia.app">
<fileset dir="macosx/template.app" includes="**"/>
</copy>
<!-- <rename src="macosx/work/template.app"
dest="macosx/work/Energia.app" />
<move file="macosx/work/template.app"
tofile="macosx/work/Energia.app" />-->
<chmod file="macosx/work/Energia.app/Contents/MacOS/JavaApplicationStub" perm="755" />
<copy todir="macosx/work/Energia.app/Contents/Resources/Java" flatten="true">
<fileset refid="runtime.jars"/>
</copy>
<copy todir="macosx/work/Energia.app/Contents/Resources/Java">
<fileset dir="shared" includes="lib/**" />
<fileset file="shared/revisions.txt" />
</copy>
<mkdir dir="macosx/work/Energia.app/Contents/Resources/Java/hardware/tools"/>
<!-- Unzip msp430 tools -->
<exec executable="unzip" failonerror="true">
<arg value="-q" />
<arg value="-n" />
<arg value="-d" />
<arg value="macosx/work/Energia.app/Contents/Resources/Java/hardware/tools" />
<arg value="macosx/msp430_tools_mac_05_2015.zip" />
</exec>
<!-- Unzip arm tools -->
<exec executable="unzip" failonerror="true">
<arg value="-q" />
<arg value="-n" />
<arg value="-d" />
<arg value="macosx/work/Energia.app/Contents/Resources/Java/hardware/tools" />
<arg value="macosx/arm_tools_mac.zip" />
</exec>
<antcall target="assemble">
<param name="target.path" value="macosx/work/Energia.app/Contents/Resources/Java" />
</antcall>
</target>
<target name="macosx-run" depends="macosx-build" description="Run Mac OS X version">
<exec executable="macosx/work/Energia.app/Contents/MacOS/JavaApplicationStub" spawn="true"/>
</target>
<target name="macosx-dist" if="macosx" depends="macosx-build" description="Create a downloadable .zip for the Mac OS X version">
<!-- The ant copy command does not preserve permissions. -->
<chmod file="macosx/work/Energia.app/Contents/MacOS/JavaApplicationStub" perm="+x" />
<replace file="macosx/work/Energia.app/Contents/Info.plist"
token="VERSION" value="${version}" />
<replace file="macosx/work/Energia.app/Contents/Info.plist"
token="REVISION" value="${revision}" />
<exec executable="ditto" dir="macosx/work">
<arg line="-c -k -rsrc . ../energia-${version}-macosx.zip" />
</exec>
<echo>
=======================================================
Energia for Mac OS X was built. Grab the image from
macosx/energia-${version}-macosx.zip
=======================================================
</echo>
</target>
<target name="macosx-dist-old" if="macosx" depends="macosx-build" description="Create a .dmg of the Mac OS X version">
<!-- now build the dmg -->
<gunzip src="macosx/template.dmg.gz" dest="macosx/working.dmg" />
<mkdir dir="macosx/working_dir" />
<exec executable="hdiutil">
<arg line="attach macosx/working.dmg -noautoopen -mountpoint macosx/working_dir" />
<!--<arg line="attach macosx/working.dmg -noautoopen -quiet -mountpoint macosx/working_dir" />-->
</exec>
<copy todir="macosx/working_dir">
<fileset dir="macosx/work" />
</copy>
<!-- The ant copy command does not preserve permissions. -->
<chmod file="macosx/working_dir/Energia.app/Contents/MacOS/JavaApplicationStub" perm="+x" />
<!-- Pause briefly for the OS to catch up with the DMG changes.
This prevents "hdiutil: couldn't eject "disk3" - Resource busy"
errors when ejecting the disk in the next step.
You may need to set this value higher for your system. -->
<sleep seconds="3" />
<exec executable="hdiutil">
<!--<arg line="detach macosx/working_dir -quiet -force" />-->
<arg line="detach macosx/working_dir" />
</exec>
<delete file="macosx/energia-*.dmg" />
<exec executable="hdiutil">
<arg line="convert macosx/working.dmg -quiet -format UDZO -imagekey zlib-level=9 -o macosx/energia-${version}.dmg" />
</exec>
<!-- Clean up the interim files. -->
<delete file="macosx/working.dmg" />
<delete dir="macosx/working_dir" />
<echo>
=======================================================
Energia for Mac OS X was built. Grab the image from
macosx/energia-${version}.dmg
=======================================================
</echo>
</target>
<!-- - - - - - - - -->
<!-- Linux -->
<!-- - - - - - - - -->
<target name="linux-clean" depends="subprojects-clean" description="Clean linux version">
<delete dir="linux/work" />
</target>
<target name="linux-checkos" unless="linux">
<echo>
=======================================================
Energia for Linux can only be built on on unix systems.
Bye.
=======================================================
</echo>
<fail message="wrong platform (${os.name})" />
</target>
<target name="linux-build" depends="revision-check, linux-checkos, subprojects-build, unzip-common-tools-linux" description="Build linux version">
<mkdir dir="linux/work" />
<copy todir="linux/work">
<fileset dir="shared" includes="lib/**" />
<fileset file="shared/revisions.txt" />
</copy>
<copy todir="linux/work">
<fileset dir="linux/dist" includes="lib/**" />
</copy>
<copy todir="linux/work/lib" flatten="true">
<fileset refid="runtime.jars" />
</copy>
<antcall target="assemble">
<param name="target.path" value="linux/work" />
</antcall>
<copy todir="linux/work" file="linux/dist/energia" />
<chmod perm="755" file="linux/work/energia" />
<copy todir="linux/work/hardware">
<fileset dir="linux/dist" includes="tools/**">
<exclude name="**/avr*" />
</fileset>
</copy>
</target>
<!-- Linux 32 build -->
<property name="arm.tools.linux.local" value="arm_tools_linux32.tar.bz2"/>
<property name="msp430.tools.linux.local" value="msp430_tools_linux32_05_2015.tar.bz2"/>
<condition property="exists.tools.linux">
<and>
<available property="exists.dep.arm.linux" file="linux/${arm.tools.linux.local}"/>
<available property="exists.dep.msp430.linux" file="linux/${msp430.tools.linux.local}"/>
</and>
</condition>
<property name="dep.arm.default.ok" value="true"/>
<target name="download-common-tools-linux" depends="check-common-tools" unless="common-tools.exists">
<echo message="Downloading common tools"/>
<get src="http://energia.nu/files/tools-common-${platform}.tar.bz2" dest="${build-dir}/tools-common.tar.bz2"/>
</target>
<target name="unzip-common-tools-linux" if="dep.common.default.ok" depends="download-common-tools-linux">
<untar src="${build-dir}/tools-common.tar.bz2" dest="${common-tools-dest}" compression="bzip2" overwrite="false"/>
<chmod file="linux/work/tools/common/DSLite/DebugServer/bin/DSLite" perm="755" />
</target>
<target name="check.deps.linux"
if="dep.arm.default.ok"
unless="exists.tools.linux">
<property name="arm.tools.linux.remote" value="http://energia.nu/files/arm_tools_linux32.tar.bz2"/>
<property name="msp430.tools.linux.remote" value="http://energia.nu/files/msp430_tools_linux32_05_2015.tar.bz2"/>
<!-- Get tools -->
<get src="${arm.tools.linux.remote}" dest="linux/${arm.tools.linux.local}"/>
<get src="${msp430.tools.linux.remote}" dest="linux/${msp430.tools.linux.local}"/>
</target>
<target name="linux32-build" depends="linux-build, check.deps.linux" description="Build linux (32-bit) version">
<echo>${user.dir}</echo>
<!-- Unzip msp430 tools -->
<exec executable="tar" dir="linux/work/hardware/tools" failonerror="true">
<arg value="-xjf"/>
<arg value="${user.dir}/linux/msp430_tools_linux32_05_2015.tar.bz2"/>
</exec>
<!-- Unzip lm4f tools -->
<exec executable="tar" dir="linux/work/hardware/tools" failonerror="true">
<arg value="-xjf"/>
<arg value="${user.dir}/linux/arm_tools_linux32.tar.bz2"/>
</exec>
</target>
<!-- Linux 64 build -->
<property name="arm.tools.linux64.local" value="arm_tools_linux64.tar.bz2"/>
<property name="msp430.tools.linux64.local" value="msp430_tools_linux64_05_2015.tar.bz2"/>
<condition property="exists.tools.linux64">
<and>
<available property="exists.dep.arm.linux64" file="linux/${arm.tools.linux64.local}"/>
<available property="exists.dep.msp430.linux64" file="linux/${msp430.tools.linux64.local}"/>
</and>
</condition>
<property name="dep.arm.default.ok" value="true"/>
<target name="check.deps.linux64"
if="dep.arm.default.ok"
unless="exists.tools.linux64">
<property name="arm.tools.linux64.remote" value="http://energia.nu/files/arm_tools_linux64.tar.bz2"/>
<property name="msp430.tools.linux64.remote" value="http://energia.nu/files/msp430_tools_linux64_05_2015.tar.bz2"/>
<!-- Get tools -->
<get src="${arm.tools.linux64.remote}" dest="linux/${arm.tools.linux64.local}"/>
<get src="${msp430.tools.linux64.remote}" dest="linux/${msp430.tools.linux64.local}"/>
</target>
<target name="linux64-build" depends="linux-build, check.deps.linux64" description="Build linux (64-bit) version">
<copy tofile="linux/work/lib/librxtxSerial.so" file="linux/dist/lib/librxtxSerial64.so" overwrite="true" />
<exec executable="tar" dir="linux/work/hardware/tools" failonerror="true">
<arg value="-xjf"/>
<arg value="${user.dir}/linux/msp430_tools_linux64_05_2015.tar.bz2"/>
</exec>
<!-- Unzip lm4f tools -->
<exec executable="tar" dir="linux/work/hardware/tools" failonerror="true">
<arg value="-xjf"/>
<arg value="${user.dir}/linux/arm_tools_linux64.tar.bz2"/>
</exec>
</target>
<target name="linux32-run" depends="linux32-build"
description="Run Linux (32-bit) version">
<exec executable="./linux/work/energia" spawn="false"/>
</target>
<target name="linux64-run" depends="linux64-build"
description="Run Linux (64-bit) version">
<exec executable="./linux/work/energia" spawn="false"/>
</target>
<target name="linux-dist" depends="build"
description="Build .tar.gz of linux version">
<!--get src="http://dev.processing.org/build/jre-tools-6u18-linux-i586.tgz"
dest="linux/jre.tgz"
usetimestamp="true" />
<untar compression="gzip"
dest="linux/work"
src="linux/jre.tgz"
overwrite="false"/-->
<!--
<tar compression="gzip" basedir="linux/work"
destfile="linux/energia-${version}.tgz" />
<tar compression="gzip" destfile="linux/energia-${version}-linux.tgz">
<tarfileset dir="linux/work"
prefix="energia-${version}"
excludes="energia,
hardware/tools/avrdude,
java/**"
/>
<tarfileset file="linux/work/energia" filemode="755" prefix="energia-${version}" />
<tarfileset file="linux/work/hardware/tools/avrdude" filemode="755"
prefix="energia-${version}/hardware/tools" />
</tar>
-->
<move file="linux/work" tofile="linux/energia-${version}" />
<exec executable="tar" dir="linux">
<arg value="-z"/>
<arg value="-c"/>
<arg value="-f"/>
<arg value="energia-${version}-linux.tgz"/>
<arg value="energia-${version}"/>
</exec>
<move file="linux/energia-${version}" tofile="linux/work" />
<echo>
=======================================================
Energia for Linux was built. Grab the archive from
build/linux/energia-${version}-linux.tgz
=======================================================
</echo>
</target>
<target name="linux32-dist" depends="linux-dist"
description="Build .tar.gz of linux version" />
<target name="linux64-dist" depends="linux-dist"
description="Build .tar.gz of linux version" />
<!-- - - - - - - - -->
<!-- Windows -->
<!-- - - - - - - - -->
<target name="windows-clean" depends="subprojects-clean"
description="Clean windows version">
<delete dir="windows/work" />
</target>
<target name="windows-checkos" unless="windows">
<echo>
=======================================================
Energia for Windows can only be built on windows.
Bye.
=======================================================
</echo>
<fail message="wrong platform (${os.name})" />
</target>
<property name="arm.tools.windows.local" value="arm_tools_windows.zip"/>
<property name="msp430.tools.windows.local" value="msp430_tools_windows_05_2015.zip"/>
<condition property="exists.tools.windows">
<and>
<available property="exists.dep.arm.windows" file="windows/${arm.tools.windows.local}"/>
<available property="exists.dep.msp430.windows" file="windows/${msp430.tools.windows.local}"/>
</and>
</condition>
<property name="dep.arm.default.ok" value="true"/>
<target name="download-common-tools-win" depends="check-common-tools" unless="common-tools.exists">
<echo message="Downloading common tools"/>
<get src="http://energia.nu/files/tools-common-${platform}.tar.bz2" dest="${build-dir}/tools-common.tar.bz2"/>
</target>
<target name="unzip-common-tools-win" if="dep.common.default.ok" depends="download-common-tools-win">
<untar src="${build-dir}/tools-common.tar.bz2" dest="${common-tools-dest}" compression="bzip2" overwrite="false"/>
</target>
<target name="check.deps.windows"
if="dep.arm.default.ok"
unless="exists.tools.windows">
<property name="arm.tools.windows.remote" value="http://energia.nu/files/arm_tools_windows.zip"/>
<property name="msp430.tools.windows.remote" value="http://energia.nu/files/msp430_tools_windows_05_2015.zip"/>
<!-- Get tools tools -->
<get src="${arm.tools.windows.remote}" dest="windows/${arm.tools.windows.local}"/>
<get src="${msp430.tools.windows.remote}" dest="windows/${msp430.tools.windows.local}"/>
</target>
<target name="windows-build"
depends="revision-check, windows-checkos, check.deps.windows, unzip-common-tools-win, subprojects-build"
description="Build windows version">
<mkdir dir="windows/work" />
<!-- assemble the pde -->
<mkdir dir="windows/work/lib" />
<copy todir="windows/work/lib" flatten="true">
<fileset refid="runtime.jars" />
</copy>
<copy todir="windows/work">
<fileset dir="shared" includes="lib/**" />
<fileset file="shared/revisions.txt" />
</copy>
<copy todir="windows/work">
<fileset dir="windows/dist" includes="*.dll" />
</copy>
<copy todir="windows/work">
<fileset dir="windows/dist" includes="drivers/**" />
</copy>
<!-- Unzip tools -->
<unzip dest="windows/work/hardware/tools" src="windows/msp430_tools_windows_05_2015.zip" overwrite="false"/>
<unzip dest="windows/work/hardware/tools" src="windows/arm_tools_windows.zip" overwrite="false"/>
<antcall target="assemble">
<param name="target.path" value="windows/work" />
</antcall>
<property name="launch4j.dir" value="windows/launcher/launch4j/" />
<taskdef name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${launch4j.dir}/launch4j.jar; ${launch4j.dir}/lib/xstream.jar" />
<copy todir="windows/work">
<fileset dir="windows/launcher"
includes="about.bmp, application.ico, config.xml"/>
</copy>
<launch4j configFile="windows/work/config.xml" />
<delete dir="windows/work"
includes="about.bmp, application.ico, config.xml" />
<!-- cygwin requires html, dll, and exe to have the +x flag -->
<chmod perm="755">
<fileset dir="windows/work" includes="**/*.html, **/*.dll, **/*.exe" />
</chmod>
</target>
<target name="windows-run" depends="windows-build"
description="Run windows version">
<exec executable="windows/work/energia.exe"
dir="windows/work" spawn="true"/>
</target>
<target name="windows-dist" depends="windows-build"
description="Create .zip files of windows version">
<!--get src="http://dev.processing.org/build/jre-tools-6u18-windows-i586.zip"
dest="windows/jre.zip"
usetimestamp="true" /-->
<unzip dest="windows/work" src="windows/jre.zip" overwrite="false"/>
<!--
<zip basedir="windows/work"
prefix="energia-${version}"
destfile="windows/energia-${version}.zip" />
<zip basedir="windows/work"
prefix="energia-${version}"
destfile="windows/energia-${version}-expert.zip"
excludes="java/**" />
-->
<zip destfile="windows/energia-${version}-windows.zip">
<zipfileset dir="windows/work"
prefix="energia-${version}" />
</zip>
<zip destfile="windows/energia-${version}-windows-expert.zip">
<zipfileset dir="windows/work"
prefix="energia-${version}"
excludes="java/**" />
</zip>
<echo>
=======================================================
Energia for Windows was built. Grab the archive from
windows/energia-${version}-windows.zip
windows/energia-${version}-windows-expert.zip
=======================================================
</echo>
</target>
<!-- - - - - - - - -->
<!-- Source -->
<!-- - - - - - - - -->
<target name="source-dist" depends="revision-check"
description="Build .tar.gz of source code">
<input message="Enter version number:"
addproperty="version"
defaultvalue="${revision}" />
<tar compression="gzip" destfile="energia-${version}-src.tar.gz">
<tarfileset dir="../"
prefix="energia-${version}"
excludes="**/*.tgz,
**/macosx/,
**/windows/,
**/work/,
**/.git/,
**/*.class"
/>
</tar>
<echo>
=======================================================
Energia source distribution was built. Grab the archive from
energia-${version}-src.tar.gz
=======================================================
</echo>
</target>
<!-- - - - - - - - -->
<!-- Run It! -->
<!-- - - - - - - - -->
<target name="clean" description="Perform a spring cleaning"
depends="linux-clean, windows-clean, macosx-clean, subprojects-clean">
</target>
</project>