forked from makerbot/ReplicatorG
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
398 lines (362 loc) · 15.8 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
<project name="ReplicatorG" basedir="." default="help">
<!-- Project name -->
<property name="project" value="replicatorg" />
<!-- Set the platform property based on the current environment -->
<condition property="platform" value="macosx">
<os family="mac" />
</condition>
<condition property="platform" value="windows">
<os family="windows" />
</condition>
<condition property="platform" value="linux">
<os family="unix" />
</condition>
<!-- Load the per-platform properties -->
<property file="ant.includes/${os.name}-${os.arch}.properties" />
<echo>${os.name}-${os.arch}</echo>
<property name="src.dir" value="src" />
<property name="build.dir" value="build" />
<property name="classes.dir" value="${build.dir}/classes" />
<property name="jar.dir" value="${build.dir}/jar" />
<property name="resources.dir" value="resources" />
<property name="shared.dir" value="${build.dir}/shared" />
<property name="lib.dir" value="${shared.dir}/lib" />
<property name="ant.build.javac.target" value="1.5" />
<property name="test.src.dir" value="test/src" />
<property name="release.name" value="${project}-${replicatorg.version}" />
<property name="protocols.dir" value="${src.dir}/fabman/messages" />
<path id="classpath">
<!-- include jarbundler -->
<fileset dir="build/macosx" includes="*.jar" />
<fileset dir="${lib.dir}" includes="*.jar" />
<pathelement path="/System/Library/Java" />
</path>
<path id="test.cp">
<path refid="classpath" />
<pathelement path="test/lib/testng.jar" />
<pathelement path="${classes.dir}" />
</path>
<target name="protoc">
<exec executable="protoc" failonerror="true">
<arg value="--java_out=${src.dir}" />
<arg value="--proto_path=${protocols.dir}" />
<arg value="${protocols.dir}/connection.proto" />
<arg value="${protocols.dir}/coordinator.proto" />
</exec>
</target>
<target name="clean">
<delete dir="${classes.dir}" />
<delete dir="${jar.dir}" />
<delete dir="dist" />
</target>
<target name="compile">
<mkdir dir="${classes.dir}" />
<javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath" debug="true" debuglevel="lines,vars,source" source="1.5" includeAntRuntime="false">
<!-- Uncomment to aid in Java debugging
<compilerarg value="-Xlint:deprecation" />
<compilerarg value="-Xlint:unchecked" />
-->
</javac>
</target>
<target name="compile-tests">
<mkdir dir="${classes.dir}" />
<javac srcdir="${test.src.dir}" destdir="${classes.dir}" classpathref="test.cp" debug="true" debuglevel="lines,vars,source" source="1.5">
<!-- Uncomment to aid in Java debugging
<compilerarg value="-Xlint:deprecation" />
<compilerarg value="-Xlint:unchecked" />
-->
</javac>
</target>
<target name="jar" depends="compile">
<mkdir dir="${jar.dir}" />
<copy todir="${classes.dir}">
<fileset dir="${resources.dir}" />
</copy>
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
</jar>
</target>
<target name="run" depends="jar">
<java fork="true" classname="replicatorg.app.Base">
<!-- jvm="/usr/lib/jvm/java-1.5.0-sun/bin/java" -->
<jvmarg value="-ea" />
<jvmarg value="-Xmx512m" />
<jvmarg value="-XX:+HeapDumpOnOutOfMemoryError" />
<jvmarg value="${native.java.flags}" />
<classpath>
<path refid="classpath" />
<pathelement location="${jar.dir}/${ant.project.name}.jar" />
</classpath>
<sysproperty key="java.library.path" path="${native.lib.dir}" />
<sysproperty key="replicatorg.app-resources" path="${lib.dir}" />
<sysproperty key="replicatorg.toolpath" path="${native.tools.dir}" />
<arg line="${run.arguments}" />
</java>
</target>
<target name="run-clean" depends="jar">
<delete dir="${user.home}/.replicatorg/temp" />
<java fork="true" classname="replicatorg.app.Base">
<!-- jvm="/usr/lib/jvm/java-1.5.0-sun/bin/java" -->
<jvmarg value="-ea" />
<jvmarg value="-Xmx512m" />
<jvmarg value="-XX:+HeapDumpOnOutOfMemoryError" />
<jvmarg value="${native.java.flags}" />
<arg value="--alternate-prefs" />
<arg value="temp" />
<arg value="--clean-prefs" />
<classpath>
<path refid="classpath" />
<pathelement location="${jar.dir}/${ant.project.name}.jar" />
</classpath>
<sysproperty key="java.library.path" path="${native.lib.dir}" />
<sysproperty key="replicatorg.app-resources" path="${lib.dir}" />
<sysproperty key="replicatorg.toolpath" path="${native.tools.dir}" />
</java>
</target>
<target name="run-non-clean" depends="jar">
<java fork="true" classname="replicatorg.app.Base">
<!-- jvm="/usr/lib/jvm/java-1.5.0-sun/bin/java" -->
<jvmarg value="-ea" />
<jvmarg value="-Xmx512m" />
<jvmarg value="-XX:+HeapDumpOnOutOfMemoryError" />
<jvmarg value="${native.java.flags}" />
<arg value="--alternate-prefs" />
<arg value="temp" />
<classpath>
<path refid="classpath" />
<pathelement location="${jar.dir}/${ant.project.name}.jar" />
</classpath>
<sysproperty key="java.library.path" path="${native.lib.dir}" />
<sysproperty key="replicatorg.app-resources" path="${lib.dir}" />
<sysproperty key="replicatorg.toolpath" path="${native.tools.dir}" />
</java>
</target>
<!--
<taskdef name="testng" classpath="test/lib/testng.jar" classname="org.testng.TestNGAntTask" />
<target name="test" depends="jar,compile-tests">
<testng classpathref="test.cp" suiteName="" testName="">
<sysproperty key="java.library.path" path="${native.lib.dir}"/>
<sysproperty key="replicatorg.app-resources" path="${lib.dir}"/>
<sysproperty key="replicatorg.toolpath" path="${native.tools.dir}"/>
<env key="TEST_DESCRIPTORS" value="test/resources/descriptors"/>
<classfileset dir="${classes.dir}" includes="testing/**/*.class" />
</testng>
</target>
-->
<target name="debug" depends="compile">
<java fork="true" classname="replicatorg.app.Base">
<jvmarg value="-ea" />
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000" />
<classpath>
<path refid="classpath" />
<pathelement location="${classes.dir}" />
</classpath>
<sysproperty key="java.library.path" path="${native.lib.dir}" />
<sysproperty key="replicatorg.app-resources" path="${lib.dir}" />
</java>
</target>
<target name="dist-macosx" depends="jar" description="Builds OS X ReplicatorG distribution">
<property name="target.dir" value="dist/macosx/${release.name}" />
<property name="dist.dir" value="build/macosx/dist" />
<property name="reso.dir" value="dist/macosx/${release.name}/ReplicatorG.app/Contents/Resources" />
<taskdef name="jarbundler" classname="net.sourceforge.jarbundler.JarBundler" />
<antcall target="dist-common-plain" />
<jarbundler dir="${target.dir}" name="ReplicatorG" bundleid="org.replicatorg.app" mainclass="replicatorg.app.Base" icon="${dist.dir}/replicatorg.icns" extraclasspath="/System/Library/Java" vmoptions="-d32 -ea -Xmx1G" infostring="ReplicatorG ${replicatorg.version}, © 2009-${current.year} MakerBot Industries" version="${replicatorg.version}" jvmversion="1.5+" stubfile="${dist.dir}/ReplicatorG">
<jarfileset dir="${jar.dir}" includes="ReplicatorG.jar" />
<jarfileset dir="${lib.dir}" includes="*.jar" />
<jarfileset dir="${dist.dir}" includes="*.jnilib" />
<documenttype name="CNC GCode document" extensions="gcode" iconFile="${dist.dir}/replicatorg.icns" role="Editor" />
<documenttype name="CNC GCode document" extensions="g" iconFile="${dist.dir}/replicatorg.icns" role="Editor" />
<documenttype name="STL 3D model" extensions="stl" iconFile="${dist.dir}/replicatorg.icns" role="Editor" />
<resourcefileset dir="${lib.dir}" includes="*.gif" />
<javaproperty name="replicatorg.app-resources" value="$APP_PACKAGE/Contents/Resources" />
<javaproperty name="apple.laf.useScreenMenuBar" value="true" />
</jarbundler>
<copy todir="${reso.dir}">
<fileset dir="${dist.dir}" includes="drivers/*.dmg" />
</copy>
<copy todir="${reso.dir}/tools">
<filelist dir="${dist.dir}/tools" files="avrdude,avrdude.conf" />
</copy>
<copy todir="${reso.dir}">
<filelist dir="." files="license.txt,readme.txt,todo.txt,contributors.txt" />
</copy>
<copy todir="${reso.dir}/skein_engines">
<fileset dir="skein_engines" excludes="*.pyc" />
</copy>
<copy todir="${reso.dir}/machines">
<fileset dir="machines" />
</copy>
<copy todir="${reso.dir}/examples">
<fileset dir="examples" />
</copy>
<copy todir="${reso.dir}/scripts">
<fileset dir="scripts" />
</copy>
<copy todir="${reso.dir}/docs">
<fileset dir="docs/" excludes="HOWTO-add-new-skeinforge.txt,overview.odg" />
</copy>
<!-- permissions -->
<chmod file="${reso.dir}/skein_engines/mg_engines/mac/miracle_grue" perm="ugo+rx" />
<chmod file="${reso.dir}/skein_engines/slic3r_engines/mac/slic3r" perm="ugo+rx" />
<!-- delete the copies in the base dir, to make installer build easier -->
<delete dir="${target.dir}/docs" />
<delete dir="${target.dir}/examples" />
<delete dir="${target.dir}/machines" />
<delete dir="${target.dir}/slic3r" />
<delete dir="${target.dir}/scripts" />
<delete dir="${target.dir}/skein_engines" />
<delete file="${target.dir}/todo.txt" />
<delete file="${target.dir}/contributors.txt" />
<delete file="${target.dir}/readme.txt" />
<delete file="${target.dir}/license.txt" />
<chmod file="${reso.dir}/tools/avrdude" perm="ugo+rx" />
<!-- This process is now done manually and the resulting file is checked in to allow for the package to be build on other OS'es.
<exec dir="." os="Mac OS X" executable="/usr/bin/lipo">
<arg value="-remove"/>
<arg value="x86_64"/>
<arg value="${target.dir}/ReplicatorG.app/Contents/MacOS/ReplicatorG"/>
<arg value="-output"/>
<arg value="${target.dir}/ReplicatorG.app/Contents/MacOS/ReplicatorG"/>
</exec> -->
<condition property="macosx">
<os family="mac" />
</condition>
<antcall target="dist-macosx-zip" />
<antcall target="dist-macosx-dmg" />
</target>
<target name="dist-macosx-zip" unless="macosx">
<zip destfile="dist/${release.name}-mac.zip" update="false">
<zipfileset dir="dist/macosx/${release.name}" prefix="${release.name}">
<exclude name="tools/avrdude" />
<exclude name="ReplicatorG.app/Contents/MacOS/ReplicatorG" />
</zipfileset>
<zipfileset dir="dist/macosx/${release.name}" prefix="${release.name}" filemode="755">
<include name="tools/avrdude" />
<include name="ReplicatorG.app/Contents/MacOS/ReplicatorG" />
<include name="ReplicatorG.app/Contents/Resources/skein_engines/mg_engines/mac/miracle_grue" />
<include name="ReplicatorG.app/Contents/Resources/skein_engines/slic3r_engines/mac/slic3r"/>
</zipfileset>
</zip>
</target>
<target name="dist-macosx-dmg" if="macosx">
<exec dir="." os="Mac OS X" executable="/bin/sh">
<arg value="-c" />
<arg value="${dist.dir}/mkdmg.sh ./dist ../${target.dir} image ${release.name}-mac" />
</exec>
</target>
<target name="dist-common-plain" depends="jar" description="Copies plaintext files common to all ReplicatorG distributions.">
<echo message="Preparing replicatorG. Version: ${replicatorg.version}" />
<mkdir dir="${target.dir}" />
<copy todir="${target.dir}">
<filelist dir="." files="license.txt,readme.txt,todo.txt,contributors.txt" />
</copy>
<copy todir="${target.dir}/skein_engines">
<fileset dir="skein_engines" excludes="*.pyc" />
</copy>
<copy todir="${target.dir}/machines">
<fileset dir="machines" />
</copy>
<copy todir="${target.dir}/examples">
<fileset dir="examples" />
</copy>
<copy todir="${target.dir}/scripts">
<fileset dir="scripts" />
</copy>
<copy todir="${target.dir}/docs">
<fileset dir="docs/" excludes="HOWTO-add-new-skeinforge.txt,overview.odg" />
</copy>
</target>
<target name="cache-local-docs" description="Downloads the ReplicatorG documentation on replicat.org (and other websites?)">
<exec executable="wget">
<arg value="-r" />
<arg value="-k" />
<arg value="--directory-prefix=./docs" />
<arg value="--timestamping" />
<arg value="replicat.org" />
</exec>
</target>
<target name="dist-common" description="Builds files common to all ReplicatorG distributions, excepting jarbundler-based distros.">
<antcall target="dist-common-plain" />
<copy todir="${target.dir}">
<fileset dir="${build.dir}/shared" includes="lib/*.jar" />
</copy>
<copy todir="${target.dir}/lib">
<fileset dir="${lib.dir}" includes="*.gif" />
<filelist dir="${lib.dir}" files="keywords.txt" />
<fileset dir="${jar.dir}" includes="*.jar" />
</copy>
</target>
<target name="dist-linux" depends="jar" description="Builds Linux ReplicatorG distribution">
<property name="target.dir" value="dist/linux/${release.name}" />
<property name="dist.dir" value="build/linux/dist" />
<!-- standard files -->
<antcall target="dist-common" />
<!-- platform-specific files -->
<copy todir="${target.dir}">
<filelist dir="${dist.dir}" files="replicatorg" />
</copy>
<!-- <copy todir="${target.dir}/slic3r">
<fileset dir="slic3r_engines/linux"/>
</copy> -->
<copy todir="${target.dir}/tools">
<filelist dir="${dist.dir}/tools" files="avrdude,avrdude.conf" />
</copy>
<copy todir="${target.dir}/lib-i686">
<fileset dir="${dist.dir}/lib-i686" includes="*.so" />
</copy>
<copy todir="${target.dir}/lib-x86_64">
<fileset dir="${dist.dir}/lib-x86_64" includes="*.so" />
</copy>
<!-- permissions -->
<chmod file="${target.dir}/replicatorg" perm="ugo+rx" />
<chmod file="${target.dir}/tools/avrdude" perm="ugo+rx" />
<chmod file="${target.dir}/skein_engines/slic3r_engines/linux/bin/slic3r" perm="ugo+rx" />
<chmod file="${target.dir}/skein_engines/slic3r_engines/linux/bin/do_install" perm="ugo+rx" />
<chmod file="${target.dir}/skein_engines/mg_engines/linux/x86_64/miracle_grue" perm="ugo+rx" />
<chmod file="${target.dir}/skein_engines/mg_engines/linux/x86_64/miracle_grue_glibc_2_14" perm="ugo+rx" />
<chmod file="${target.dir}/skein_engines/mg_engines/linux/x86_64/miracle_grue_glibc_2_13" perm="ugo+rx" />
<tar destfile="dist/${release.name}-linux.tgz" compression="gzip" longfile="gnu">
<tarfileset dir="dist/linux/${release.name}" prefix="${release.name}" />
<tarfileset dir="dist/linux/${release.name}" prefix="${release.name}" filemode="755">
<include name="replicatorg" />
<include name="tools/avrdude" />
<include name="skein_engines/slic3r_engines/linux/bin/slic3r" />
<include name="skein_engines/slic3r_engines/linux/bin/do_install" />
<include name="skein_engines/mg_engines/linux/x86_64/miracle_grue" />
<include name="skein_engines/mg_engines/linux/x86_64/miracle_grue_glibc_2_14" />
<include name="skein_engines/mg_engines/linux/x86_64/miracle_grue_glibc_2_13" />
</tarfileset>
</tar>
</target>
<target name="dist-windows" depends="jar" description="Builds Windows ReplicatorG distribution">
<property name="target.dir" value="dist/windows/${release.name}" />
<property name="dist.dir" value="build/windows/dist" />
<!-- standard files -->
<antcall target="dist-common" />
<!-- platform-specific files -->
<!-- <copy todir="${target.dir}/slic3r">
<fileset dir="slic3r_engines/windows" />
</copy> -->
<copy todir="${target.dir}">
<fileset dir="${dist.dir}" includes="*.dll" />
<filelist dir="${dist.dir}" files="ReplicatorG.exe" />
<fileset dir="${dist.dir}" includes="drivers/**/*" />
<fileset dir="${dist.dir}" includes="java/**/*" />
</copy>
<copy todir="${target.dir}/tools">
<fileset dir="${dist.dir}/tools" />
</copy>
<zip destfile="dist/${project}-${replicatorg.version}-windows.zip" basedir="${target.dir}/..">
</zip>
</target>
<target name="dist" depends="dist-linux,dist-macosx,dist-windows" description="Builds all ReplicatorG distributions">
</target>
<!-- Help -->
<target name="help" description="Targets for this project">
<echo message="Targets for this project" />
<exec executable="ant">
<arg value="-p" />
</exec>
<antcall target="test" />
</target>
</project>