forked from Ayutac/gcs-old
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
238 lines (219 loc) · 9.88 KB
/
build.xml
File metadata and controls
238 lines (219 loc) · 9.88 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
<?xml version="1.0"?>
<project name="gcs" default="build_jar" xmlns:if="ant:if" xmlns:unless="ant:unless">
<condition property="platform.mac" else="false">
<os family="mac"/>
</condition>
<condition property="platform.windows" else="false">
<os family="windows"/>
</condition>
<condition property="platform.linux" else="false">
<and>
<os family="unix"/>
<not>
<os family="mac"/>
</not>
</and>
</condition>
<property if:true="${platform.mac}" name="platform" value="mac"/>
<property if:true="${platform.windows}" name="platform" value="windows"/>
<property if:true="${platform.linux}" name="platform" value="linux"/>
<condition property="platformWithBits" value="${platform}-32" else="${platform}">
<and>
<os arch="i386"/>
<or>
<os family="unix"/>
<os family="windows"/>
</or>
</and>
</condition>
<property name="app" value="gcs"/>
<property if:true="${platform.windows}" name="app.exe" value="${app}.exe"/>
<property unless:true="${platform.windows}" name="app.exe" value="${app}"/>
<property if:true="${platform.mac}" name="app.signature" value="RWGS"/>
<property name="src" value="src"/>
<property name="lib" value="libraries"/>
<property name="toolkit" value="toolkit-4.0.1.jar"/>
<property name="toolkit_lib" value="../toolkit/libraries"/>
<property name="toolkit_path" value="${toolkit_lib}/${toolkit}"/>
<property name="apple_stubs" value="apple_stubs.jar"/>
<property name="apple_stubs_path" value="../apple_stubs/${apple_stubs}"/>
<property name="trove" value="trove-3.0.3.jar"/>
<property name="trove_path" value="${toolkit_lib}/trove-3.0.3.jar"/>
<property name="iText" value="iText-2.1.7.jar"/>
<property name="iText_path" value="${lib}/${iText}"/>
<property name="build_root" value="ant_build"/>
<property name="gcs_build" value="${build_root}/${app}"/>
<property name="dist.build" value="${build_root}/dist"/>
<property name="min_jdk" value="1.8"/>
<property name="app_name" value="GURPS Character Sheet"/>
<property name="copyright_owner" value="Richard A. Wilkes"/>
<property name="primary_version" value="4.0.1"/>
<property name="dist_name" value="GCS-${primary_version}"/>
<property name="dist_root" value="${dist.build}/${dist_name}"/>
<property name="build_app_bundle" value="${dist_root}/${app_name}.app/Contents"/>
<property name="bundle_res" value="${build_app_bundle}/Resources"/>
<property name="java_bundle_dir" value="${build_app_bundle}/Java"/>
<tstamp>
<format property="version" pattern="${primary_version}.yyyyMMddHHmmss"/>
</tstamp>
<tstamp>
<format property="year" pattern="yyyy"/>
</tstamp>
<target name="clean" description="Clean up after a GCS jar build">
<delete dir="${build_root}"/>
<delete>
<fileset dir="${lib}" includes="${app}-*.jar"/>
</delete>
</target>
<target name="build_jar" description="Build the GCS jar" depends="clean">
<mkdir dir="${gcs_build}"/>
<!-- Compile the code. -->
<javac srcdir="${src}" destdir="${gcs_build}" debug="no" optimize="yes"
target="${min_jdk}" source="${min_jdk}" deprecation="true"
includeantruntime="no" fork="yes">
<classpath>
<pathelement location="${toolkit_path}"/>
<pathelement location="${trove_path}"/>
<pathelement location="${iText_path}"/>
<pathelement location="${apple_stubs_path}"/>
</classpath>
<compilerarg value="-Xlint:all"/>
<compilerarg value="-Xlint:-serial"/>
</javac>
<!-- Copy the resources over. -->
<copy todir="${gcs_build}">
<fileset dir="${src}" includes="**/*.txt,**/*.png"/>
</copy>
<!-- Create the jar file. -->
<jar destfile="${lib}/${app}-${primary_version}.jar" basedir="${gcs_build}" duplicate="fail">
<manifest>
<attribute name="Class-Path" value="${toolkit} ${trove} ${iText} ${apple_stubs}"/>
<attribute name="Main-Class" value="com.trollworks.gcs.app.GCS"/>
<attribute name="bundle-name" value="${app_name}"/>
<attribute name="bundle-version" value="${version}"/>
<attribute name="bundle-license" value="Mozilla Public License 2.0"/>
<attribute name="bundle-copyright-owner" value="${copyright_owner}"/>
<attribute name="bundle-copyright-years" value="1998-${year}"/>
<attribute name="bundle-executable" value="${app.exe}"/>
<attribute name="bundle-id" value="com.trollworks.gcs"/>
<attribute name="bundle-signature" value="${app.signature}"/>
<attribute name="bundle-category" value="public.app-category.role-playing-games"/>
</manifest>
</jar>
</target>
<target name="clean_bundle" description="Cleans up after a bundle build">
<delete dir="${build_root}"/>
<delete>
<fileset dir="." includes="${app}-*-${platformWithBits}.zip"/>
</delete>
</target>
<target name="bundle" description="Create a distribution bundle" depends="clean_bundle">
<property name="dist.name" value="${app}-${primary_version}-${platformWithBits}"/>
<property name="dist.root" value="${dist.build}/${dist.name}"/>
<property if:true="${platform.mac}" name="mac.bundle" value="${dist.root}/${app_name}.app/Contents"/>
<property if:true="${platform.mac}" name="app.dir" value="${mac.bundle}/MacOS"/>
<property unless:true="${platform.mac}" name="app.dir" value="${dist.root}"/>
<property name="support" value="${app.dir}/support"/>
<property if:true="${platform.mac}" name="app.icons" value="${mac.bundle}/Resources"/>
<property unless:true="${platform.mac}" name="app.icons" value="${support}"/>
<property name="app.jre" value="${support}/jre"/>
<property name="app.jars" value="${support}/jars"/>
<property name="data" value="${dist.root}/Library"/>
<!-- Copy the launcher. -->
<mkdir dir="${app.dir}"/>
<copy file="launcher/${platformWithBits}/${app.exe}" todir="${app.dir}"/>
<chmod file="${app.dir}/${app.exe}" perm="+x"/>
<!-- Copy the jars. -->
<mkdir dir="${app.jars}"/>
<copy file="${lib}/${app}-${primary_version}.jar" todir="${app.jars}"/>
<copy file="${toolkit_path}" todir="${app.jars}"/>
<copy file="${trove_path}" todir="${app.jars}"/>
<copy file="${iText_path}" todir="${app.jars}"/>
<copy file="${apple_stubs_path}" todir="${app.jars}"/>
<!-- Create the icons. -->
<mkdir dir="${app.icons}"/>
<java classpath="${app.jars}/${app}-${primary_version}.jar" classname="com.trollworks.gcs.app.GCSImages">
<arg if:true="${platform.mac}" value="-icns"/>
<arg if:true="${platform.windows}" value="-ico"/>
<arg if:true="${platform.linux}" value="-app"/>
<arg value="-dir"/>
<arg value="${app.icons}"/>
</java>
<!-- Create the Info.plist and PkgInfo files. -->
<mkdir if:true="${platform.mac}" dir="${mac.bundle}"/>
<java if:true="${platform.mac}" classpath="${app.jars}/${app}-${primary_version}.jar" classname="com.trollworks.gcs.app.GCSInfoPlistCreator">
<arg value="${mac.bundle}/Info.plist"/>
</java>
<echo if:true="${platform.mac}" message="APPL${app.signature}" file="${mac.bundle}/PkgInfo"/>
<!-- Extract the JRE. -->
<ant dir="../toolkit" target="jre" inheritall="no">
<property name="platform.mac" value="${platform.mac}"/>
<property name="platform.windows" value="${platform.windows}"/>
<property name="platform.linux" value="${platform.linux}"/>
<property name="support" location="${support}"/>
</ant>
<!-- Copy the license. -->
<copy file="license.html" todir="${dist.root}"/>
<!-- Copy the database. -->
<mkdir dir="${data}"/>
<copy todir="${data}">
<fileset dir="Library"/>
</copy>
<!-- Create the zip file. Using native implementation to preserve execution bits on unix-like OS's. -->
<exec unless:true="${platform.windows}" executable="/usr/bin/zip" dir="${dist.build}">
<arg value="-r"/>
<arg value="-y"/>
<arg value="-9"/>
<arg file="${dist.name}.zip"/>
<arg value="${dist.name}"/>
</exec>
<zip if:true="${platform.windows}" destfile="${dist.name}.zip" basedir="${dist.build}" level="9"
includes="${dist.name}/**"/>
</target>
<target name="build_launcher_exe" description="Build the native launcher">
<mkdir dir="launcher/${platformWithBits}"/>
<ant dir="../toolkit" target="launcher" inheritall="false">
<property name="platform.mac" value="${platform.mac}"/>
<property name="platform.windows" value="${platform.windows}"/>
<property name="platform.linux" value="${platform.linux}"/>
<property name="app.dir" location="launcher/${platformWithBits}"/>
<property name="app.name" value="${app_name}"/>
<property name="app.exe" value="${app.exe}"/>
<property if:true="${platform.windows}" name="app.icon.dir" location="${app.icons}"/>
<property if:true="${platform.linux}" name="app.categories" value="Game;Roleplaying;Utility"/>
<property if:true="${platform.linux}" name="app.keywords" value="Roleplaying"/>
</ant>
</target>
<target name="bundle_all" description="Create distribution bundles for all platforms">
<antcall target="bundle" inheritall="no">
<param name="platform.mac" value="true"/>
<param name="platform.windows" value="false"/>
<param name="platform.linux" value="false"/>
<param name="platformWithBits" value="mac"/>
</antcall>
<antcall target="bundle" inheritall="no">
<param name="platform.mac" value="false"/>
<param name="platform.windows" value="true"/>
<param name="platform.linux" value="false"/>
<param name="platformWithBits" value="windows"/>
</antcall>
<antcall target="bundle" inheritall="no">
<param name="platform.mac" value="false"/>
<param name="platform.windows" value="true"/>
<param name="platform.linux" value="false"/>
<param name="platformWithBits" value="windows-32"/>
</antcall>
<antcall target="bundle" inheritall="no">
<param name="platform.mac" value="false"/>
<param name="platform.windows" value="false"/>
<param name="platform.linux" value="true"/>
<param name="platformWithBits" value="linux"/>
</antcall>
<antcall target="bundle" inheritall="no">
<param name="platform.mac" value="false"/>
<param name="platform.windows" value="false"/>
<param name="platform.linux" value="true"/>
<param name="platformWithBits" value="linux-32"/>
</antcall>
</target>
</project>