-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild.xml
More file actions
executable file
·251 lines (212 loc) · 8.91 KB
/
build.xml
File metadata and controls
executable file
·251 lines (212 loc) · 8.91 KB
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
<project name="kkMulticopterFlashTool" default="default" basedir=".">
<property name="version" value="0.80beta6" />
<!-- Set this property value to your application name -->
<property name="app.name" value="kkMulticopter Flash Tool"/>
<property name="dist.dir" value="${basedir}/dist" />
<property name="bin.dir" value="${basedir}/bin" />
<property name="src.dir" value="${basedir}/src" />
<property name="resources.dir" value="${basedir}/resources" />
<property name="libs" value="${basedir}/lib" />
<property name="MainClass" value="de.lazyzero.kkMulticopterFlashTool.KKMulticopterFlashTool" />
<property name="MANIFEST" value="${basedir}/dist/MANIFEST.MF" />
<property name="splashImage" value="KKsplash.png" />
<property name="jar.file" value="${dist.dir}/kkMulticopterFlashTool.jar" />
<property name="dist.dmg.file" value="kkmulticopterflashtool_${version}.dmg" />
<taskdef name="jarbundler" classpath="./macOSX/jarbundler-2.2.0.jar" classname="net.sourceforge.jarbundler.JarBundler" />
<taskdef name="exe4j" classname="com.exe4j.Exe4JTask" classpath="${resources.dir}/exe4j/bin/ant.jar"/>
<path id="libs">
<fileset dir="lib">
<include name="**/*.jar" />
<include name="${splashImage}" />
</fileset>
</path>
<target name="default" depends="dmg, zip" />
<!-- clean up -->
<target name="clean">
<delete file="${libs}/kkMulticopterFlashTool.jar" quiet="yes" failonerror="false"/>
<mkdir dir="${dist.dir}"/>
<delete>
<fileset dir="${dist.dir}" includes="**/*"/>
</delete>
</target>
<!-- generate the manifest-file -->
<target name="gen-manifest">
<tstamp/>
<fileset dir="${libs}" id="jar.files">
<include name="**/*.jar" />
</fileset>
<pathconvert pathsep=" " property="jars" refid="jar.files">
<filtermapper>
<replacestring from="${basedir}/lib/" to= ""/>
<replacestring from="${basedir}\lib\" to= ""/>
<replacestring from="\" to= "/"/>
</filtermapper>
</pathconvert>
<manifest file="${MANIFEST}">
<attribute name="Main-Class" value="${MainClass}" />
<attribute name="Class-Path" value="${jars}" />
<attribute name="SplashScreen-Image" value="${splashImage}" />
</manifest>
</target>
<!-- Build jar file -->
<target name="jar" description="Build jar file" depends="clean, gen-manifest">
<mkdir dir="${dist.dir}"/>
<copy tofile="${bin.dir}/${splashImage}" file="${resources.dir}/${splashImage}"/>
<!-- generate the manifest-file -->
<jar jarfile="${jar.file}" basedir="${bin.dir}" manifest="${MANIFEST}">
</jar>
<copy file="${jar.file}" todir="${libs}" />
</target>
<target name="launcher_win32">
<copy tofile="kkflashtool_win32.exe4j" file="kkflashtool_win32_template.exe4j">
<filterset>
<filter token="VERSION" value="${version}" />
</filterset>
</copy>
<exe4j projectfile="kkflashtool_win32.exe4j"/>
</target>
<target name="launcher_win64">
<copy tofile="kkflashtool_win64.exe4j" file="kkflashtool_win64_template.exe4j">
<filterset>
<filter token="VERSION" value="${version}" />
</filterset>
</copy>
<exe4j projectfile="kkflashtool_win64.exe4j"/>
</target>
<target name="zip" depends="jar,launcher_win32,launcher_win64">
<zip destfile="kkmulticopterflashtool_${version}.zip">
<zipfileset dir="${libs}" prefix="lib" filemode="755">
<exclude name="**/avrdude/mac/**"/>
<exclude name="**/avra/mac/**"/>
</zipfileset>
<zipfileset dir="${src.dir}" prefix="src"/>
<zipfileset dir="." includes="license.txt"/>
<zipfileset dir="." includes="kkflashtool_win32.exe"/>
<zipfileset dir="." includes="kkflashtool_win64.exe"/>
<zipfileset dir="." includes="kkMulticopterFlashTool_32.sh" filemode="755"/>
<zipfileset dir="." includes="kkMulticopterFlashTool_64.sh" filemode="755"/>
</zip>
</target>
<target name="OSX_bundle" depends="jar">
<delete dir="macOSXrelease" />
<mkdir dir="macOSXrelease"/>
<copy tofile="${basedir}/${splashImage}" file="${resources.dir}/${splashImage}"/>
<!-- create a jar bundle for the mac -->
<jarbundler dir="macOSXrelease"
name="kkMulticopter Flash Tool"
shortname="kkFlashTool"
signature="Christian Moll"
mainclass="${MainClass}"
icon="macOSX/kk.icns"
splashfile="$JAVAROOT/KK.png"
jvmversion="1.6+"
version="${version}"
infostring="kkFlashTool, v${version}, February 2011"
build="0001"
bundleid="de.lazyzero.kkMulticopterFlashTool.Main" >
<jarfileset dir=".">
<include name="kkMulticopterFlashTool.jar" />
<include name="librxtxSerial.jnilib" />
<include name="librxtxSerial.dynlib" />
<include name="license.txt" />
<include name="lib/**/*"/>
<include name="src/**/*" />
<exclude name="**/CVS" />
<include name="KK.png" />
<exclude name="lib/avrdude/linux/**/*" />
<exclude name="lib/avrdude/linux64/**/*" />
<exclude name="lib/avrdude/windows/**/*" />
<exclude name="lib/avra/linux/**/*" />
<exclude name="lib/avra/win/**/*" />
<exclude name="lib/linux32/**/*" />
<exclude name="lib/linux64/**/*" />
<exclude name="lib/win32/**/*" />
<exclude name="lib/win64/**/*" />
</jarfileset>
<javaproperty name="apple.laf.useScreenMenuBar" value="true"/>
<javaproperty name="apple.awt.brushMetal" value="true"/>
<javaproperty name="apple.awt.showGrowBox" value="false"/>
<resourcefilelist dir="." files="license.txt"/>
</jarbundler>
</target>
<target name="signMac" description="sign my app" depends="OSX_bundle">
<exec dir="./macOSXrelease" executable="/usr/bin/codesign">
<arg line="-s - --force -f '${app.name}.app'" />
</exec>
</target>
<!-- Create a DMG - This only works on MacOSX (requires hdiutil) -->
<target name="dmg" description="Create a DMG package for MacOSX (only works on MacOSX)" depends="signMac">
<delete file="${dist.dmg.file}"
quiet="yes" failonerror="false"/>
<!-- Set this property value to a directory where you can
mount temporarily your images, for example /tmp -->
<property name="mountdir"
value="/tmp"/>
<!-- Delete previously created DMG -->
<delete file="${app.name}.dmg}" quiet="yes" failonerror="false"/>
<!-- Create a temporary Disk Image -->
<exec executable="/usr/bin/hdiutil" os="Mac OS X" failonerror="true">
<arg value="create"/>
<arg value="-srcfolder"/>
<arg value="macOSXrelease/${app.name}.app"/>
<arg value="-volname"/>
<arg value="${app.name}"/>
<arg value="-ov"/>
<arg value="${app.name}-tmp.dmg"/>
<arg value="-format"/>
<arg value="UDRW"/>
</exec>
<!-- Attach the temporary image -->
<exec executable="/usr/bin/hdiutil" os="Mac OS X" failonerror="true">
<arg value="attach"/>
<arg value="${app.name}-tmp.dmg"/>
<arg value="-mountroot"/>
<arg value="${mountdir}/"/>
</exec>
<!-- Add a symbolic link to the Applications directory -->
<symlink link="${mountdir}/${app.name}" resource="/Applications"/>
<copy file="license.txt"
tofile="${mountdir}/${app.name}/license.txt"
overwrite="true"/>
<!--<symlink link="${mountdir}/${app.name}" resource="/usr/local/lib"/>
<copy file="libusb-1.0.0.dylib"
tofile="${mountdir}/${app.name}/libusb-1.0.0.dylib"
overwrite="true"/>
-->
<copy file="./resources/DS_Store"
tofile="${mountdir}/${app.name}/.DS_Store"
overwrite="true"/>
<exec executable="/bin/chmod" os="Mac OS X" failonerror="true">
<arg value="a+x"/>
<arg value="${mountdir}/${app.name}/${app.name}.app/Contents/Resources/Java/lib/avrdude/mac/avrdude"/>
</exec>
<exec executable="/bin/chmod" os="Mac OS X" failonerror="true">
<arg value="a+x"/>
<arg value="${mountdir}/${app.name}/${app.name}.app/Contents/Resources/Java/lib/avrdude/mac/usbtiny/avrdude"/>
</exec>
<exec executable="/bin/chmod" os="Mac OS X" failonerror="true">
<arg value="a+x"/>
<arg value="${mountdir}/${app.name}/${app.name}.app/Contents/Resources/Java/lib/avra/mac/avra"/>
</exec>
<!-- Detach the temporary image -->
<exec executable="/usr/bin/hdiutil" os="Mac OS X" failonerror="true">
<arg value="detach"/>
<arg value="${mountdir}/${app.name}"/>
</exec>
<!-- Compress it to a new image -->
<exec executable="/usr/bin/hdiutil" os="Mac OS X" failonerror="true">
<arg value="convert"/>
<arg value="${app.name}-tmp.dmg"/>
<arg value="-format"/>
<arg value="UDZO"/>
<arg value="-o"/>
<arg value="${dist.dmg.file}"/>
</exec>
<!-- Delete the temporary image -->
<delete file="${app.name}-tmp.dmg"
quiet="yes" failonerror="false"/>
<exec executable="hdiutil">
<arg line="internet-enable -yes ${dist.dmg.file}"/>
</exec>
</target>
</project>