forked from chipKIT32/chipKIT-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
462 lines (384 loc) · 18.6 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
<?xml version="1.0" ?>
<project default="setup" name="chipkit-core">
<!--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 -->
<!--
Need to git pull the pic32 sub modules.
git submodule foreach git pull
Adding submodules:
git submodule add https://github.com/majenkotech/pic32prog-autotools modules/pic32prog-autotools
-->
<available file=".git" property="git.present" type="dir"/>
<property file="upload.properties"/>
<property file="version.properties"/>
<property name="aws.bucket" value="chipkit"/>
<condition property="macosx">
<os family="mac"/>
</condition>
<condition property="windows">
<os family="windows"/>
</condition>
<condition property="linux">
<os family="unix"/>
</condition>
<condition property="linux64">
<os arch="amd64" family="unix"/>
</condition>
<condition property="arm">
<os arch="arm" family="unix"/>
</condition>
<condition property="platform" value="macosx">
<os family="mac"/>
</condition>
<condition property="platform" value="windows">
<os family="windows"/>
</condition>
<condition property="platform" value="linux">
<os arch="i386" family="unix"/>
</condition>
<condition property="platform" value="linux64">
<os arch="amd64" family="unix"/>
</condition>
<condition property="platform" value="arm">
<os arch="arm" family="unix"/>
</condition>
<!-- set time property -->
<tstamp>
<format pattern="yyyyMMdd" property="TODAY"/>
</tstamp>
<target description="Build mpide." name="build">
<antcall target="${platform}-build"/>
</target>
<!-- Commenting this out (BPS Feb 18th, 2017) because there are multiple builds we do now,
and we want to have manual control over the core version number so that no matter what
builds we do, in what order, the version number always just increments once. -->
<target description="increment build version number" name="increment">
<!--
<propertyfile file="version.properties">
<entry default="16777998" key="CHIPKITCOREVER" operation="+" pattern="00000000" type="int"/>
</propertyfile>
-->
</target>
<target description="configure directories" name="setup">
<mkdir dir="tmp"/>
<mkdir dir="dist"/>
<antcall target="updatepic32prog"/>
</target>
<target depends="setup" description="Build Mac OS X version" name="macosx-build">
<property name="localplatform">macosx</property>
<mkdir dir="dist/${localplatform}/chipkit-core"/>
<copy todir="dist/${localplatform}/chipkit-core/pic32">
<fileset dir="pic32"/>
</copy>
<copy tofile="dist/${localplatform}/chipkit-core/pic32/tools/bin/pic32prog"
file="modules/pic32prog-autotools/bin/pic32prog-osx-fat"
/>
<chmod perm="+x">
<fileset dir="dist/${localplatform}/chipkit-core/pic32/tools/bin" includes="**/*"/>
</chmod>
<!--antcall target="checksum-pic32prog">
<param name="localplatform" value="${localplatform}"/>
</antcall-->
<mkdir dir="dist/${localplatform}/chipkit-core"/>
<!-- tar.gz 1.42 version from compiler-builds -->
<get dest="tmp" src="https://github.com/chipKIT32/chipKIT-compiler-builds/releases/download/1.42/pic32-tools-142-Darwin-image.tar.gz" usetimestamp="true" verbose="false"/>
<untar dest="dist/${localplatform}/chipkit-core/pic32/compiler" overwrite="false" src="tmp/pic32-tools-142-Darwin-image.tar.gz" compression="gzip"/>
<!-- tar.gz 1.40 version from chipkit-core/releases
<get dest="tmp" src="https://github.com/chipKIT32/chipKIT-core/releases/download/v1.0.1/pic32-tools-chipKIT-cxx-master-Darwin-image.tar.gz" usetimestamp="true" verbose="false"/>
<untar dest="dist/${localplatform}/chipkit-core/pic32/compiler" overwrite="false" src="tmp/pic32-tools-chipKIT-cxx-master-Darwin-image.tar.gz" compression="gzip"/>
-->
<chmod maxparallel="300" perm="+x">
<fileset dir="dist/${localplatform}/chipkit-core/pic32/compiler/" includes="**/*"/>
</chmod>
</target>
<target depends="setup" description="Build linux version" name="linux32-build">
<property name="localplatform">linux32</property>
<mkdir dir="dist/${localplatform}/chipkit-core"/>
<!-- tar.gz 1.42 version from compiler-builds -->
<get dest="tmp" src="https://github.com/chipKIT32/chipKIT-compiler-builds/releases/download/1.42/pic32-tools-142-Linux32-image.tar.gz" usetimestamp="true" verbose="false"/>
<untar dest="dist/${localplatform}/chipkit-core/pic32/compiler" overwrite="false" src="tmp/pic32-tools-142-Linux32-image.tar.gz" compression="gzip"/>
<!-- tar.gz 1.40 version from chipkit-core/releases
<get dest="tmp" src="https://github.com/chipKIT32/chipKIT-core/releases/download/v1.0.1/pic32-tools-chipKIT-cxx-master-Linux32-image.tar.gz" usetimestamp="true" verbose="false"/>
<untar dest="dist/${localplatform}/chipkit-core/pic32/compiler" overwrite="false" src="tmp/pic32-tools-chipKIT-cxx-master-Linux32-image.tar.gz" compression="gzip"/>
-->
<chmod maxparallel="300" perm="+x">
<fileset dir="dist/${localplatform}/chipkit-core/pic32/compiler/" includes="**/*"/>
</chmod>
<copy todir="dist/${localplatform}/chipkit-core/pic32">
<fileset dir="pic32"/>
</copy>
<copy tofile="dist/${localplatform}/chipkit-core/pic32/tools/bin/pic32prog"
file="modules/pic32prog-autotools/bin/pic32prog-debian-32"
/>
<chmod perm="+x">
<fileset dir="dist/${localplatform}/chipkit-core/pic32/tools/bin" includes="**/*"/>
</chmod>
<echo message="${localplatform}" />
<!--antcall target="checksum-pic32prog">
<param name="localplatform" value="${localplatform}"/>
</antcall-->
</target>
<target depends="setup" description="Build linux ARM version" name="arm-build">
<property name="localplatform">arm</property>
<mkdir dir="dist/${localplatform}/chipkit-core"/>
<!-- tar.gz 1.42 version from compiler-builds -->
<get dest="tmp" src="https://github.com/chipKIT32/chipKIT-compiler-builds/releases/download/1.42/pic32-tools-142-arm-linux-image.tar.gz" usetimestamp="true" verbose="false"/>
<untar dest="dist/${localplatform}/chipkit-core/pic32/compiler" overwrite="false" src="tmp/pic32-tools-142-arm-linux-image.tar.gz" compression="gzip"/>
<!-- tar.gz 1.40 version from chipkit-core/releases
<get dest="tmp" src="https://github.com/chipKIT32/chipKIT-core/releases/download/v1.0.1/pic32-tools-chipKIT-cxx-master-arm-linux-image.tar.gz" usetimestamp="true" verbose="false"/>
<untar dest="dist/${localplatform}/chipkit-core/pic32/compiler" overwrite="false" src="tmp/pic32-tools-chipKIT-cxx-master-arm-linux-image.tar.gz" compression="gzip"/>
-->
<chmod maxparallel="300" perm="+x">
<fileset dir="dist/${localplatform}/chipkit-core/pic32/compiler/" includes="**/*"/>
</chmod>
<copy todir="dist/${localplatform}/chipkit-core/pic32">
<fileset dir="pic32"/>
</copy>
<copy tofile="dist/${localplatform}/chipkit-core/pic32/tools/bin/pic32prog"
file="modules/pic32prog-autotools/bin/pic32prog-debian-armhf"
/>
<chmod perm="+x">
<fileset dir="dist/${localplatform}/chipkit-core/pic32/tools/bin" includes="**/*"/>
</chmod>
<!--antcall target="checksum-pic32prog">
<param name="localplatform" value="linuxarmhf"/>
</antcall-->
</target>
<target depends="setup" description="Build linux (32-bit) version" name="linux64-build">
<echo message="When 64bit version is released. A 64 bit compiler will be included."/>
<property name="localplatform">linux64</property>
<mkdir dir="dist/${localplatform}/chipkit-core"/>
<!-- tar.gz 1.42 version from compiler-builds -->
<get dest="tmp" src="https://github.com/chipKIT32/chipKIT-compiler-builds/releases/download/1.42/pic32-tools-142-Linux32-image.tar.gz" usetimestamp="true" verbose="false"/>
<untar dest="dist/${localplatform}/chipkit-core/pic32/compiler" overwrite="false" src="tmp/pic32-tools-142-Linux32-image.tar.gz" compression="gzip"/>
<!-- tar.gz 1.40 version from chipkit-core/releases
<get dest="tmp" src="https://github.com/chipKIT32/chipKIT-core/releases/download/v1.0.1/pic32-tools-chipKIT-cxx-master-Linux32-image.tar.gz" usetimestamp="true" verbose="false"/>
<untar dest="dist/${localplatform}/chipkit-core/pic32/compiler" overwrite="false" src="tmp/pic32-tools-chipKIT-cxx-master-Linux32-image.tar.gz" compression="gzip"/>
-->
<chmod maxparallel="300" perm="+x">
<fileset dir="dist/${localplatform}/chipkit-core/pic32/compiler/" includes="**/*"/>
</chmod>
<copy todir="dist/${localplatform}/chipkit-core/pic32">
<fileset dir="pic32"/>
</copy>
<copy tofile="dist/${localplatform}/chipkit-core/pic32/tools/bin/pic32prog"
file="modules/pic32prog-autotools/bin/pic32prog-debian-64"
/>
<chmod perm="+x">
<fileset dir="dist/${localplatform}/chipkit-core/pic32/tools/bin" includes="**/*"/>
</chmod>
<!--antcall target="checksum-pic32prog">
<param name="localplatform" value="${localplatform}"/>
</antcall-->
</target>
<target depends="setup" description="Build windows version" name="windows-build">
<property name="localplatform">windows</property>
<mkdir dir="dist/${localplatform}/chipkit-core"/>
<!-- tar.gz 1.42 version from compiler-builds -->
<get dest="tmp" src="https://github.com/chipKIT32/chipKIT-compiler-builds/releases/download/1.42/pic32-tools-142-win32-image.tar.gz" usetimestamp="true" verbose="false"/>
<untar dest="dist/${localplatform}/chipkit-core/pic32/compiler" overwrite="false" src="tmp/pic32-tools-142-win32-image.tar.gz" compression="gzip"/>
<!-- zip 1.40 version from chipkit-core/releases
<get dest="tmp" src="https://github.com/chipKIT32/chipKIT-core/releases/download/v1.0.1/pic32-tools-chipKIT-cxx-master-win32-image.zip" usetimestamp="true" verbose="false"/>
<unzip dest="dist/${localplatform}/chipkit-core/pic32/compiler" overwrite="false" src="tmp/pic32-tools-chipKIT-cxx-master-win32-image.zip"/>
-->
<chmod maxparallel="300" perm="+x">
<fileset dir="dist/${localplatform}/chipkit-core/pic32/compiler/" includes="**/*"/>
</chmod>
<copy todir="dist/${localplatform}/chipkit-core/pic32">
<fileset dir="pic32"/>
</copy>
<get dest="tmp" src="https://github.com/sergev/pic32prog/archive/master.zip" usetimestamp="true" verbose="false"/>
<unzip dest="tmp" overwrite="false" src="tmp/master.zip"/>
<copy tofile="dist/${localplatform}/chipkit-core/pic32/tools/bin/pic32prog.exe"
file="modules/pic32prog-autotools/bin/pic32prog-win32.exe"
/>
<!--
<copy file="tmp/pic32prog-autotools/bin/pic32prog-win32.exe" todir="dist/${localplatform}/chipkit-core/pic32/tools/bin"/>
-->
<chmod perm="+x">
<fileset dir="dist/${localplatform}/chipkit-core/pic32/tools/bin" includes="**/*"/>
</chmod>
<!--antcall target="checksum-pic32prog-win">
<param name="localplatform" value="${localplatform}"/>
</antcall-->
</target>
<target depends="arm-build" description="Make dist raspberrypi/arm version" name="arm-dist">
<property name="localplatform">arm</property>
<antcall target="compress">
<param name="localplatform" value="${localplatform}"/>
</antcall>
</target>
<target depends="windows-build" description="Make dist windows version" name="windows-dist">
<property name="localplatform">windows</property>
<antcall target="compress">
<param name="localplatform" value="${localplatform}"/>
</antcall>
</target>
<target depends="macosx-build" description="Make dist macosx version" name="macosx-dist">
<property name="localplatform">macosx</property>
<antcall target="compress">
<param name="localplatform" value="${localplatform}"/>
</antcall>
</target>
<target depends="linux32-build" description="Make dist linux32 version" name="linux32-dist">
<property name="localplatform">linux32</property>
<antcall target="compress">
<param name="localplatform" value="${localplatform}"/>
</antcall>
</target>
<target depends="linux64-build" description="Make dist linux64 version" name="linux64-dist">
<property name="localplatform">linux64</property>
<antcall target="compress">
<param name="localplatform" value="${localplatform}"/>
</antcall>
</target>
<target depends="build, increment" description="create the distribution zip file." name="dist">
<antcall target="compress">
<param name="localplatform" value="${platform}"/>
</antcall>
</target>
<target depends="increment" description="Create all the distribution zip files." name="dist-all">
<antcall target="arm-dist">
<param name="localplatform" value="arm"/>
</antcall>
<antcall target="macosx-dist">
<param name="localplatform" value="macosx"/>
</antcall>
<antcall target="linux32-dist">
<param name="localplatform" value="linux32"/>
</antcall>
<antcall target="linux64-dist">
<param name="localplatform" value="linux64"/>
</antcall>
<antcall target="windows-dist">
<param name="localplatform" value="windows"/>
</antcall>
<!-- We no longer can properly checksum these tools, but aparently we don't really need to, so we'll just leave it commented out -->
<!-- <antcall target="checksum-pic32tools"/> -->
</target>
<target description="update the submodules pic32prog" name="updatepic32prog">
<!-- unreliable solution but should work
<exec executable="git">
<arg value="submodule" />
<arg value="foreach" />
<arg value="git" />
<arg value="pull" />
</exec>
-->
<exec executable="git">
<arg value="submodule"/>
<arg value="init"/>
</exec>
<exec executable="git">
<arg value="submodule"/>
<arg value="update"/>
<arg value="--remote"/>
</exec>
</target>
<target name="checksum-pic32tools">
<checksum algorithm="SHA-256" fileext=".asc" forceOverwrite="yes">
<fileset dir="tmp">
<include name="pic32-tools*.zip"/>
</fileset>
</checksum>
</target>
<target name="checksum-pic32prog">
<zip basedir="modules/pic32prog-autotools/${localplatform}" destfile="tmp/pic32prog-${localplatform}.zip"/>
<checksum algorithm="SHA-256" file="tmp/pic32prog-${localplatform}.zip" fileext=".asc"/>
</target>
<target name="checksum-pic32prog-win" >
<zip destfile="tmp/pic32prog-${localplatform}.zip" >
<zipfileset dir="modules/pic32prog-autotools" includes="pic32prog.exe" />
</zip>
<checksum algorithm="SHA-256" file="tmp/pic32prog-${localplatform}.zip" fileext=".asc"/>
</target>
<target name="compress" depends="git.revision" description="Compress the distribution for deployment." >
<zip destfile="dist/${localplatform}/chipkit-core-${localplatform}.${CHIPKITCOREVER}.${repository.version}.zip">
<zipfileset dir="dist/${localplatform}" filemode="755"/>
</zip>
<checksum algorithm="SHA-256" file="dist/${localplatform}/chipkit-core-${localplatform}.${CHIPKITCOREVER}.${repository.version}.zip" fileext=".asc"/>
</target>
<target depends="" description="Clean build" name="clean">
<echo message="Cleaning Platform: except for the compiler"/>
<delete dir="dist/"/>
</target>
<target depends="" description="Clean ALL build" name="clean-all">
<echo message="Cleaning Platform: ALL"/>
<delete dir="./tmp/" failonerror="false"/>
<delete dir="dist/"/>
</target>
<target description="Store git branch in ${git.branch} (unless the variable GIT_BRANCH is set, then it uses that." if="git.present" name="git.branch">
<condition property="git.branch" value="${GIT_BRANCH}">
<isset property="GIT_BRANCH" />
</condition>
<exec errorproperty="" executable="git" failifexecutionfails="false" outputproperty="git.revparsebranch">
<arg line="rev-parse --abbrev-ref HEAD"/>
</exec>
<condition property="git.branch" value="${git.revparsebranch}">
<not>
<isset property="GIT_BRANCH" />
</not>
</condition>
</target>
<target description="Store git revision in ${repository.version}" if="git.present" name="git.revision" depends="git.branch">
<exec errorproperty="" executable="git" failifexecutionfails="false" outputproperty="git.revision">
<arg value="describe"/>
<arg value="--tags"/>
<arg value="--always"/>
<arg value="HEAD"/>
</exec>
<condition else="unknown" property="repository.version" value="${git.branch}-${git.revision}">
<and>
<isset property="git.revision"/>
<length length="0" string="${git.revision}" trim="yes" when="greater"/>
<isset property="git.branch"/>
<length length="0" string="${git.branch}" trim="yes" when="greater"/>
</and>
</condition>
</target>
<target name="updatePlatform">
<replaceregexp file="dist/${localplatform}/chipkit-core/pic32/platform.txt"
match="\{runtime.hardware.path\}\/pic32\/compiler\/pic32-tools\/bin\/"
replace="\{runtime.tools.pic32-tools.path\}\/bin\/"
byline="true"
/>
<replaceregexp file="dist/${localplatform}/chipkit-core/pic32/platform.txt"
match="\{runtime.hardware.path\}\/pic32\/tools\/bin"
replace="\{runtime.tools.pic32prog.path\}"
byline="true"
/>
</target>
<target name="github-release" depends="setup,git.revision">
<replaceregexp file="pic32/platform.txt"
match="\{runtime.hardware.path\}\/pic32\/compiler\/pic32-tools\/bin\/"
replace="\{runtime.tools.pic32-tools.path\}\/bin\/"
byline="true"
/>
<replaceregexp file="pic32/platform.txt"
match="\{runtime.hardware.path\}\/pic32\/tools\/bin"
replace="\{runtime.tools.pic32prog.path\}"
byline="true"
/>
<!-- get the chipKIT core release -->
<zip destfile="tmp/chipkit-core-${CHIPKITCOREVER}.${repository.version}.zip">
<zipfileset dir="pic32" includes="**/*" prefix="pic32" filemode="755"/>
</zip>
<!-- <zip destfile="tmp/chipkit-core-${CHIPKITCOREVER}.${repository.version}.zip"
basedir="pic32" />
-->
<checksum algorithm="SHA-256" file="tmp/chipkit-core-${CHIPKITCOREVER}.${repository.version}.zip" fileext=".asc"/>
<!-- revert the platform.txt to original version -->
<exec executable="git">
<arg value="checkout"/>
<arg value="pic32/platform.txt"/>
</exec>
</target>
<!-- "§$§$&, ant doesn't have a built-in help target :( -->
<target description="Show project help" name="help">
<java classname="org.apache.tools.ant.Main">
<arg value="-p"/>
</java>
</target>
</project>