forked from cogtool/cogtool
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
228 lines (187 loc) · 8.96 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="CogTool" default="package">
<defaultexcludes echo="true"/>
<property name="exeversion" value="1.4.0.0" />
<property name="version" value="1.4" />
<property name="versionclean" value="1_4" />
<property name="jlevel" value="1.8" />
<property name="build.compiler" value="javac${jlevel}" />
<property name="srcroot" value="${basedir}/java" />
<property name="macsrcroot" value="${basedir}/mac-support" />
<property name="libdir" value="${basedir}/lib" />
<property name="swtdir" value="${libdir}/windows" />
<property name="macswtdir" value="${libdir}/macintosh" />
<property name="resdir" value="${basedir}/res" />
<property name="distdir" value="${basedir}/dist" />
<property name="builddir" value="${basedir}/build" />
<property name="java_runtime_res" value="edu/cmu/cs/hcii/cogtool/resources" />
<property name="clisp" value="${basedir}/lisp" />
<property name="launch4j.dir" location="${libdir}/build-only/launch4j" />
<property name="java.library.path" value="${java.library.path};${swtdir}" />
<!-- Classpath: setup once, used everywhere. -->
<path id="classpath">
<fileset dir="${libdir}">
<include name="*.jar" />
</fileset>
<fileset dir="${libdir}/build-only">
<include name="*.jar" />
</fileset>
<fileset dir="${swtdir}">
<include name="*.jar" />
</fileset>
<pathelement path="${builddir}" />
</path>
<path id="mac-classpath">
<fileset dir="${libdir}">
<include name="*.jar" />
</fileset>
<fileset dir="${libdir}/build-only">
<include name="*.jar" />
</fileset>
<fileset dir="${macswtdir}">
<include name="*.jar" />
</fileset>
<pathelement path="${builddir}" />
</path>
<!-- Deletes all generated output for a clean rebuild. -->
<target name="clean" description="Deletes all generated output for a clean rebuild.">
<delete includeemptydirs="true">
<fileset dir="${distdir}" includes="**/*" />
</delete>
<delete includeemptydirs="true">
<fileset dir="${builddir}" includes="**/*" />
</delete>
</target>
<!-- Compiles java source with javac. -->
<target name="compile" description="Compiles java source with javac.">
<javac srcdir="${srcroot}" destdir="${builddir}" debug="on" fork="true" source="${jlevel}" target="${jlevel}">
<classpath refid="classpath" />
<include name="**/*.java" />
</javac>
<javac srcdir="${macsrcroot}" destdir="${builddir}" debug="on" fork="true" source="${jlevel}" target="${jlevel}">
<classpath refid="mac-classpath" />
<include name="**/*.java" />
</javac>
<!-- Copy the resources dir into the build dir -->
<copy todir="${builddir}/${java_runtime_res}" overwrite="true">
<fileset dir="java/${java_runtime_res}"/>
</copy>
</target>
<taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask" classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar" />
<!-- Packages build output and resources into runable packages., -->
<target name="package" depends="clean,compile" description="Packages build output and resources into runable packages.">
<tstamp>
<format property="buildtime" pattern="MM/dd/yyyy-hh:mm" />
</tstamp>
<!-- Setup property for manifest classpath entries. -->
<pathconvert property="manifest.classpath" pathsep=" ">
<path refid="classpath" />
<mapper>
<chainedmapper>
<flattenmapper />
<globmapper from="*" to="./lib/*" />
</chainedmapper>
</mapper>
</pathconvert>
<!-- Create a double-clickable app jar with classpath entries. -->
<jar destfile="${distdir}/CogTool.jar" compress="true" index="false">
<manifest>
<attribute name="Class-Path" value="${manifest.classpath}" />
<attribute name="Main-Class" value="edu.cmu.cs.hcii.cogtool.CogTool" />
</manifest>
<fileset dir="${builddir}" />
</jar>
<!-- Create a Mac "app" bundle by copying the tmp bundle. -->
<copy todir="${distdir}/CogTool.app" overwrite="true">
<fileset dir="${resdir}/CogTool.tmp"/>
</copy>
<!-- Copy the local cogtoolstart and swt jars to the Mac bundle. -->
<copy file="${libdir}/macintosh/cogtoolstart" tofile="${distdir}/CogTool.app/Contents/MacOS/cogtoolstart" />
<chmod perm="a+x" file="${distdir}/CogTool.app/Contents/MacOS/cogtoolstart" />
<copy file="${libdir}/macintosh/export-csv-kludge" tofile="${distdir}/CogTool.app/Contents/MacOS/export-csv-kludge" />
<chmod perm="a+x" file="${distdir}/CogTool.app/Contents/MacOS/export-csv-kludge" />
<copy todir="${distdir}/CogTool.app/Contents/Resources/Java/dll/">
<fileset dir="${macswtdir}">
<include name="*.jnilib" />
</fileset>
</copy>
<copy todir="${distdir}/CogTool.app/Contents/Resources/Java/">
<fileset dir="${macswtdir}">
<include name="*.jar" />
</fileset>
</copy>
<!-- Copy the rest of the libdir to the Mac bundle. -->
<copy todir="${distdir}/CogTool.app/Contents/Resources/Java/">
<fileset dir="${libdir}">
<include name="*.jar" />
</fileset>
</copy>
<!-- Setup the Classpath plist value. -->
<fileset dir="${distdir}/CogTool.app/Contents/Resources/Java" id="distjars">
<include name="*.jar" />
</fileset>
<pathconvert pathsep=":$JAVAROOT/" property="distjarstr" refid="distjars">
<mapper type="flatten" />
</pathconvert>
<echo message="${revision}" />
<replace file="${distdir}/CogTool.app/Contents/Info.plist" token="DISTJARSTR" value="${distjarstr}" />
<replace file="${distdir}/CogTool.app/Contents/Info.plist" token="VERSION" value="${version}" />
<replace file="${distdir}/CogTool.app/Contents/Info.plist" token="REVISION" value="${revision}" />
<replace file="${distdir}/CogTool.app/Contents/Info.plist" token="BUILDTIME" value="${buildtime}" />
<replace file="${distdir}/CogTool.app/Contents/Info.plist" token="VERSTRING" value="${version}" />
<!-- Copy the app jar to the Mac bundle. -->
<copy file="${distdir}/CogTool.jar" todir="${distdir}/CogTool.app/Contents/Resources/Java/" />
<!-- Copy the clisp dist to the Mac bundle. -->
<copy todir="${distdir}/CogTool.app/Contents/Resources/clisp-mac-intel/">
<fileset dir="${basedir}/clisp-mac-intel">
<include name="*" />
</fileset>
</copy>
<!-- Chmod the clisp executable. -->
<chmod file="${distdir}/CogTool.app/Contents/Resources/clisp-mac-intel/lisp.run" perm="a+x" />
<!-- Copy the Mac XUL implementation into the bundle. -->
<copy todir="${distdir}/CogTool.app/Contents/Resources/XUL-mac/">
<fileset dir="${basedir}/XUL-mac"/>
</copy>
<!-- Chmod the XUL stuff. -->
<chmod dir="${distdir}/CogTool.app/Contents/Resources/XUL-mac" includes="XUL,xulrunner*,*.*lib,*.sh" perm="a+x"/>
<!-- Prepare .tgz for Mac OS X download. -->
<tar destfile="${distdir}/CogToolMac-${versionclean}-r${revision}.tgz" compression="gzip" longfile="warn">
<tarfileset dir="${distdir}/" mode="755">
<include name="CogTool.app/**" />
</tarfileset>
</tar>
<!-- Build a Windows launcher .exe via launch4j. -->
<condition property="os.windows">
<os family="windows" />
</condition>
<antcall target="package-windows" />
</target>
<target name="package-windows" if="os.windows">
<!-- Insert Build Date, etc. -->
<replace file="${basedir}/res/launch4j.cfg.xml" token="VERSION" value="${version}" />
<replace file="${basedir}/res/launch4j.cfg.xml" token="REVISION" value="${revision}" />
<replace file="${basedir}/res/launch4j.cfg.xml" token="BUILDTIME" value="${buildtime}" />
<replace file="${basedir}/res/launch4j.cfg.xml" token="VERSTRING" value="${version}" />
<replace file="${basedir}/res/launch4j.cfg.xml" token="EXEVERS" value="${exeversion}" />
<replace file="${basedir}/res/cogtool.nsi" token="VERSTRING" value="${version}" />
<replace file="${basedir}/res/cogtool.nsi" token="EXEVERS" value="${exeversion}" />
<replace file="${basedir}/res/cogtool.nsi" token="SETUPFILE" value="..\dist\CogTool-${versionclean}-setup.exe" />
<!-- Build a Windows launcher .exe via launch4j. -->
<launch4j configFile="${basedir}/res/launch4j.cfg.xml" />
<!-- Build a Windows installer .exe w/ jar & clisp. -->
<exec executable="C:\Program Files (x86)\NSIS\makensis.exe" vmlauncher="false" resolveexecutable="true">
<arg value="/XSetCompressor /FINAL /SOLID lzma" />
<arg file="${basedir}/res/cogtool.nsi" />
</exec>
<!-- Remove Build Date, etc. -->
<replace file="${basedir}/res/launch4j.cfg.xml" token="${version}" value="VERSION" />
<replace file="${basedir}/res/launch4j.cfg.xml" token="${revision}" value="REVISION" />
<replace file="${basedir}/res/launch4j.cfg.xml" token="${buildtime}" value="BUILDTIME" />
<replace file="${basedir}/res/launch4j.cfg.xml" token="${version}" value="VERSTRING" />
<replace file="${basedir}/res/launch4j.cfg.xml" token="${exeversion}" value="EXEVERS" />
<replace file="${basedir}/res/cogtool.nsi" token="${version}" value="VERSTRING" />
<replace file="${basedir}/res/cogtool.nsi" token="${exeversion}" value="EXEVERS" />
<replace file="${basedir}/res/cogtool.nsi" token="..\dist\CogTool-${versionclean}-r${revision}-setup.exe" value="SETUPFILE" />
</target>
</project>