/
build.xml
269 lines (236 loc) · 9.55 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
<!-- build configuration -->
<project name="jikan" default="compile" basedir=".">
<!-- read in our deployment properties -->
<property file="deployment.properties"/>
<!-- identify the application -->
<property name="app.ident" value="jikan"/>
<property name="app.name" value="Jikan"/>
<property name="app.version" value="1.0"/>
<!-- various basic settings -->
<property name="src.dir" value="src/java"/>
<property name="deploy.dir" value="dist"/>
<property name="dist.jar" value="${app.ident}.jar"/>
<!-- used when generating javadocs -->
<property name="javadoc.dir" value="${deploy.dir}/docs"/>
<property name="doc.packages" value="com.samskivert.jikan.*"/>
<property name="doc.overview" value="com/samskivert/jikan/overview.html"/>
<property name="copy.pre" value="Copyright © 2005"/>
<property name="copyright.holder" value="Michael Bayne"/>
<property name="copy.post" value="All Rights Reserved."/>
<!-- we need these libraries to build -->
<filelist dir="lib" id="build.libs">
<file name="commons-codec.jar"/>
<file name="gdata-calendar-2.0.jar"/>
<file name="gdata-calendar-meta-2.0.jar"/>
<file name="gdata-client-1.0.jar"/>
<file name="gdata-client-meta-1.0.jar"/>
<file name="gdata-core-1.0.jar"/>
<file name="getdown.jar"/>
<file name="google-collect.jar"/>
<file name="jarbundler-2.1.0.jar"/>
<file name="samskivert.jar"/>
<file name="swt.jar"/>
</filelist>
<!-- and these libraries to build and at runtime -->
<filelist dir="lib" id="runtime.libs">
<file name="jsr305.jar"/>
</filelist>
<!-- declare our classpath -->
<path id="clazzpath">
<fileset dir="${deploy.dir}/lib" includes="**/*.jar"/>
<pathelement location="${deploy.dir}/classes"/>
</path>
<!-- prepares the application directories -->
<target name="prepare">
<mkdir dir="${deploy.dir}"/>
<mkdir dir="${deploy.dir}/classes"/>
<mkdir dir="${javadoc.dir}"/>
<!-- copy media and properties into the target directory -->
<copy todir="${deploy.dir}/classes">
<fileset dir="${src.dir}" includes="**/*.png"/>
<fileset dir="${src.dir}" includes="**/*.properties"/>
</copy>
<!-- copy our build dependencies into place -->
<mkdir dir="${deploy.dir}/lib"/>
<copy todir="${deploy.dir}/lib" flatten="true">
<filelist refid="build.libs"/>
<filelist refid="runtime.libs"/>
</copy>
<!-- note whether we're running on Darwin -->
<condition property="platform.darwin">
<and><os family="mac"/><os family="unix"/></and>
</condition>
</target>
<!-- cleans out the built application -->
<target name="clean">
<delete dir="${deploy.dir}"/>
</target>
<!-- build the java class files -->
<target name="compile" depends="prepare">
<javac srcdir="${src.dir}" destdir="${deploy.dir}/classes" debug="on"
optimize="off" deprecation="on" includeAntRuntime="no">
<classpath refid="clazzpath"/>
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
</javac>
</target>
<!-- build the javadoc documentation -->
<target name="javadoc" depends="prepare">
<javadoc sourcepath="${src.dir}"
packagenames="${doc.packages}"
windowtitle="${app.name} API"
doctitle="${app.name} API"
overview="${src.dir}/${doc.overview}"
bottom="${copy.pre} ${copyright.holder} ${copy.post}"
destdir="${javadoc.dir}">
<classpath refid="clazzpath"/>
<link href="http://www.samskivert.com/code/samskivert/docs/api"/>
<link href="http://java.sun.com/products/jdk/1.4/docs/api"/>
</javadoc>
</target>
<!-- a target for rebuilding everything -->
<target name="all" depends="clean,prepare,compile,javadoc,dist"/>
<!-- builds our distribution files -->
<target name="dist" depends="prepare,compile">
<jar destfile="${deploy.dir}/${dist.jar}" manifest="etc/manifest.mf"
basedir="${deploy.dir}/classes"/>
</target>
<!-- optimizes, combines and removes dead code -->
<target name="proguard" depends="dist">
<!-- figure out where the Java rt.jar file lives -->
<condition property="runtime.jar" value="${java.home}/../Classes/classes.jar">
<istrue value="${platform.darwin}"/>
</condition>
<condition property="runtime.jar" value="${java.home}/lib/rt.jar">
<isfalse value="${platform.darwin}"/>
</condition>
<!-- run Proguard -->
<taskdef resource="proguard/ant/task.properties" classpath="lib/proguard.jar"/>
<proguard configuration="etc/jikan.pro">
<libraryjar name="${runtime.jar}"/>
</proguard>
</target>
<!-- prepares our Getdown distribution -->
<target name="getdown" depends="proguard">
<mkdir dir="${deploy.dir}/getdown"/>
<mkdir dir="${deploy.dir}/getdown/code"/>
<copy todir="${deploy.dir}/getdown">
<fileset dir="etc" includes="getdown.txt"/>
<fileset dir="lib" includes="getdown-pro.jar"/>
<fileset dir="lib" includes="background.png"/>
</copy>
<!-- copy our jar file and runtime dependencies into place -->
<copy todir="${deploy.dir}/getdown/code" flatten="true">
<fileset dir="${deploy.dir}" includes="jikan-pro.jar"/>
<filelist refid="runtime.libs"/>
<fileset dir="lib/native" includes="swt-*.jar"/>
</copy>
<!-- generate the getdown digest file -->
<taskdef name="digest" classname="com.threerings.getdown.tools.DigesterTask">
<classpath>
<pathelement path="${deploy.dir}/lib/commons-codec.jar"/>
<pathelement path="${deploy.dir}/lib/getdown.jar"/>
<pathelement path="${deploy.dir}/lib/samskivert.jar"/>
</classpath>
</taskdef>
<property file="${cert_dir}/certificate.properties"/>
<digest appdir="${deploy.dir}/getdown"/>
</target>
<!-- creates the linux jikan (getdown) installer -->
<target name="linux_installer">
<property name="linst.dir" value="${deploy.dir}/linux_installer"/>
<mkdir dir="${linst.dir}"/>
<copy todir="${linst.dir}">
<fileset dir="lib/installers">
<include name="icon.png"/>
<include name="background.png"/>
<include name="finish_install"/>
</fileset>
<fileset dir="lib" includes="getdown-pro.jar"/>
<fileset dir="etc" includes="getdown.txt"/>
</copy>
<copy todir="${linst.dir}" file="lib/installers/finish_install" encoding="UTF-8" overwrite="true">
<filterset>
<filter token="app_ident" value="${app.ident}"/>
<filter token="app_name" value="${app.name}"/>
</filterset>
</copy>
<exec executable="chmod" failonerror="true">
<arg line="a+rx"/>
<arg line="${linst.dir}/finish_install"/>
</exec>
<exec executable="makeself" failonerror="true" outputproperty="make.output">
<arg line="${linst.dir}"/>
<arg line="${deploy.dir}/${app.ident}-install.bin"/>
<arg line="${app.ident}"/>
<arg line="./finish_install"/>
<arg line="$0"/>
</exec>
<echo level="info">${make.output}</echo>
</target>
<!-- creates the mac jikan (getdown) installer -->
<target name="mac_installer">
<property name="macinst.dir" value="${deploy.dir}/mac_installer"/>
<property name="jdir" value="Contents/Resources/Java"/>
<delete dir="${macinst.dir}"/>
<mkdir dir="${macinst.dir}"/>
<!-- be sure the app base directory is empty -->
<taskdef name="jarbundler" classpathref="clazzpath"
classname="net.sourceforge.jarbundler.JarBundler"/>
<jarbundler dir="${macinst.dir}" name="${app.name}"
mainclass="com.threerings.getdown.launcher.Getdown"
jar="lib/getdown-pro.jar"
workingdirectory="$APP_PACKAGE/Contents/Resources/Java"
vmoptions="-Dappdir=."
version="1.0"
jvmversion="1.6+"
infostring="${app.ident} 1.0"
icon="lib/installers/jikan.icns"
stubfile="lib/installers/JavaApplicationStub"/>
<copy todir="${macinst.dir}/${app.name}.app/${jdir}/">
<fileset dir="lib/installers" includes="background.png"/>
<fileset dir="etc" includes="getdown.txt"/>
</copy>
<!-- prepare for imaging -->
<copy file="lib/installers/DS_Store" tofile="${macinst.dir}/.DS_Store"/>
<mkdir dir="${macinst.dir}/.background"/>
<copy todir="${macinst.dir}/.background/" file="lib/installers/banner.png"/>
<!-- fix permissions, no matter how silly the umask made them -->
<exec executable="/bin/chmod">
<arg line="-R"/>
<arg line="u+w,go-w,a+r"/>
<arg line="'${macinst.dir}'"/>
</exec>
<exec executable="/bin/chmod">
<arg line="a+x"/>
<arg line="'${macinst.dir}/${app.name}.app/Contents/MacOS/JavaApplicationStub'"/>
</exec>
<!-- build our iso disk image -->
<exec executable="mkisofs" failonerror="true">
<arg line="-quiet"/>
<arg line="-hide-rr-moved"/>
<arg line="-hide-joliet"/>
<arg line=".rr_moved"/>
<arg line="-uid"/>
<arg line="0"/>
<arg line="-gid"/>
<arg line="0"/>
<arg line="-J"/>
<arg line="-V"/>
<arg line="'${app.name}'"/>
<arg line="-o"/>
<arg line="'${deploy.dir}/${app.ident}-install.dmg'"/>
<arg file="${macinst.dir}"/>
</exec>
</target>
<target name="installers" depends="getdown,linux_installer,mac_installer">
</target>
<!-- installs the getdown client and latest installers in the web document tree -->
<target name="install" depends="getdown,installers">
<delete dir="${web_dir}/getdown"/>
<copy todir="${web_dir}">
<fileset dir="${deploy.dir}" includes="getdown/**"/>
<fileset dir="${deploy.dir}" includes="${app.ident}-install.*"/>
</copy>
</target>
</project>