forked from makerbot/ReplicatorG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
302 lines (273 loc) · 11.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
<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="-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}"/>
</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"/>
<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="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="${target.dir}">
<fileset dir="${dist.dir}" includes="drivers/*.dmg"/>
</copy>
<copy todir="${target.dir}/tools">
<filelist dir="${dist.dir}/tools" files="avrdude,avrdude.conf"/>
</copy>
<chmod file="${target.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"/>
</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>
</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}/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"/>
<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" />
</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}">
<fileset dir="${dist.dir}" includes="*.dll"/>
<filelist dir="${dist.dir}" files="ReplicatorG.exe"/>
<fileset dir="${dist.dir}" includes="drivers/**/*"/>
</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>