forked from richardwilkes/gcs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
253 lines (235 loc) · 10.9 KB
/
Copy pathbuild.xml
File metadata and controls
253 lines (235 loc) · 10.9 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
252
253
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project name="com.trollworks.gcs" default="build" xmlns:if="ant:if" xmlns:unless="ant:unless">
<property name="module.name" value="com.trollworks.gcs"/>
<property name="module.version" value="4.12.0"/>
<property name="app.name" value="GURPS Character Sheet"/>
<property name="exe.name" value="gcs"/>
<property name="target.version" value="12"/>
<property name="build.dir" value="antbuild"/>
<property name="dist.dir" value="dist"/>
<property name="modules.dir" value="../java_modules"/>
<tstamp>
<format property="module.version.long" pattern="${module.version}.yyyyMMddHHmmss"/>
</tstamp>
<tstamp>
<format property="module.version.year" pattern="yyyy"/>
</tstamp>
<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="macos"/>
<property if:true="${platform.windows}" name="platform" value="windows"/>
<property if:true="${platform.linux}" name="platform" value="linux"/>
<property if:true="${platform.mac}" name="disk.image.name" value="${app.name} ${module.version}"/>
<property if:true="${platform.mac}" name="dist.root" value="${build.dir}/${disk.image.name}"/>
<property if:true="${platform.linux}" name="dist.root" value="${build.dir}/gcs-${module.version}"/>
<property if:true="${platform.windows}" name="dist.root" value="${build.dir}/gcs-${module.version}"/>
<property if:true="${platform.mac}" name="app.root" value="${dist.root}/${app.name}"/>
<property if:true="${platform.linux}" name="app.root" value="${dist.root}"/>
<property if:true="${platform.windows}" name="app.root" value="${dist.root}"/>
<target name="build">
<delete>
<fileset dir="." includes="**/.DS_Store" defaultexcludes="false"/>
</delete>
<symlink if:true="${platform.mac}" action="delete" link="${dist.root}/Applications"/>
<delete dir="${build.dir}"/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${modules.dir}"/>
<delete>
<fileset dir="${modules.dir}" includes="${module.name}*"/>
</delete>
<javac destdir="${build.dir}" includeantruntime="false" source="${target.version}" target="${target.version}" modulepath="${modules.dir}" encoding="UTF8">
<src path="src"/>
</javac>
<manifest file="manifest">
<attribute name="bundle-name" value="GCS"/>
<attribute name="bundle-version" value="${module.version.long}"/>
<attribute name="bundle-license" value="Mozilla Public License 2.0"/>
<attribute name="bundle-copyright-owner" value="Richard A. Wilkes"/>
<attribute name="bundle-copyright-years" value="1998-${module.version.year}"/>
<attribute name="bundle-executable" value="${exe.name}"/>
<attribute name="bundle-id" value="${module.name}"/>
<attribute name="bundle-signature" value="RWGS"/>
<attribute name="bundle-category" value="public.app-category.role-playing-games"/>
</manifest>
<exec executable="jar">
<arg value="--create"/>
<arg value="--file"/>
<arg file="${modules.dir}/${module.name}-${module.version}.jar"/>
<arg value="--module-version"/>
<arg value="${module.version}"/>
<arg value="--manifest"/>
<arg value="manifest"/>
<arg value="--main-class"/>
<arg value="${module.name}.app.GCS"/>
<arg value="-C"/>
<arg value="${build.dir}"/>
<arg value="."/>
<arg value="-C"/>
<arg value="resources"/>
<arg value="."/>
</exec>
<symlink if:true="${platform.mac}" action="delete" link="${dist.root}/Applications"/>
<delete dir="${build.dir}"/>
<delete file="manifest"/>
<zip destfile="${modules.dir}/${module.name}-${module.version}-src.zip" level="9" basedir="." excludes="bin/**,*.dmg,*.tgz,*.zip"/>
</target>
<target name="deps">
<ant dir="../org.apache.commons.logging" target="build" inheritall="false"/>
<ant dir="../org.apache.fontbox" target="build" inheritall="false"/>
<ant dir="../org.apache.pdfbox" target="build" inheritall="false"/>
<ant dir="../gnu.trove" target="build" inheritall="false"/>
<ant dir="../com.lowagie.text" target="build" inheritall="false"/>
<ant dir="../toolkit" target="build" inheritall="false"/>
</target>
<target name="bundle" depends="deps,build">
<symlink if:true="${platform.mac}" action="delete" link="${dist.root}/Applications"/>
<delete dir="${build.dir}"/>
<delete dir="${dist.root}"/>
<property if:true="${platform.mac}" name="dist.content.root" value="${app.root}/${app.name}.app/Contents"/>
<property unless:true="${platform.mac}" name="dist.content.root" value="${app.root}"/>
<property if:true="${platform.mac}" name="dist.jdk.root" value="${dist.content.root}/MacOS/support"/>
<property unless:true="${platform.mac}" name="dist.jdk.root" value="${dist.content.root}/support"/>
<exec executable="jlink">
<arg value="--module-path"/>
<arg path="${modules.dir}"/>
<arg value="--output"/>
<arg path="${dist.jdk.root}"/>
<arg value="--compress=2"/>
<arg value="--no-header-files"/>
<arg value="--no-man-pages"/>
<arg value="--launcher"/>
<arg value="${exe.name}=${module.name}/${module.name}.app.GCS"/>
<arg value="--add-modules"/>
<arg value="${module.name}"/>
</exec>
<delete if:true="${platform.windows}" file="${dist.jdk.root}/bin/${exe.name}"/>
<delete if:true="${platform.windows}" file="${dist.jdk.root}/bin/${exe.name}.bat"/>
<move unless:true="${platform.windows}" file="${dist.jdk.root}/bin/java" tofile="${dist.jdk.root}/bin/${exe.name}"/>
<move if:true="${platform.windows}" file="${dist.jdk.root}/bin/javaw.exe" tofile="${dist.jdk.root}/bin/${exe.name}.exe"/>
<mkdir if:true="${platform.mac}" dir="${dist.content.root}/Resources"/>
<java if:true="${platform.mac}" modulepath="${modules.dir}" module="com.trollworks.gcs/com.trollworks.gcs.app.GCSInfoPlistCreator" fork="true">
<arg value="${dist.content.root}"/>
</java>
<copy if:true="${platform.mac}" todir="${dist.content.root}/Resources">
<fileset dir="artifacts/icns"/>
</copy>
<copy if:true="${platform.mac}" file="resources/com/trollworks/gcs/app/images/app_1024.png" tofile="${dist.content.root}/Resources/app.png"/>
<copy if:true="${platform.mac}" file="artifacts/${exe.name}" todir="${dist.content.root}/MacOS"/>
<copy if:true="${platform.windows}" file="artifacts/${exe.name}.bat" todir="${dist.content.root}"/>
<copy if:true="${platform.linux}" file="artifacts/${exe.name}" todir="${dist.content.root}"/>
<chmod if:true="${platform.mac}" perm="0755" file="${dist.content.root}/MacOS/${exe.name}"/>
<chmod if:true="${platform.linux}" perm="0755" file="${dist.content.root}/${exe.name}"/>
<exec if:true="${platform.mac}" executable="touch">
<arg path="${app.root}/${app.name}.app"/>
</exec>
<copy todir="${app.root}/Library">
<fileset dir="../gcs_library/Library"/>
</copy>
<symlink if:true="${platform.mac}" resource="/Applications" link="${dist.root}/Applications"/>
<delete if:true="${platform.mac}" file="${disk.image.name}.dmg"/>
<delete if:true="${platform.linux}" file="gcs-${module.version}.tgz"/>
<delete if:true="${platform.windows}" file="gcs-${module.version}.zip"/>
<exec if:true="${platform.mac}" executable="du" output="${build.dir}/du.output">
<arg value="-sm"/>
<arg value="${dist.root}"/>
</exec>
<replaceregexp if:true="${platform.mac}" file="${build.dir}/du.output" match="\t.*" replace=""/>
<loadfile if:true="${platform.mac}" property="du.size" srcFile="${build.dir}/du.output"/>
<exec if:true="${platform.mac}" executable="dc" outputproperty="disk.image.size">
<arg value="-e"/>
<arg value="${du.size} 20 + p"/>
</exec>
<exec if:true="${platform.mac}" executable="hdiutil">
<arg value="create"/>
<arg value="-srcfolder"/>
<arg value="${dist.root}"/>
<arg value="-fs"/>
<arg value="HFS+"/>
<arg value="-fsargs"/>
<arg value="-c c=64,a=16,e=16"/>
<arg value="-megabytes"/>
<arg value="${disk.image.size}"/>
<arg value="-imagekey"/>
<arg value="zlib-level=9"/>
<arg value="${disk.image.name}.dmg"/>
</exec>
<exec if:true="${platform.linux}" executable="tar">
<arg value="czf"/>
<arg value="gcs-${module.version}.tgz"/>
<arg value="-C"/>
<arg value="${build.dir}"/>
<arg value="gcs-${module.version}"/>
</exec>
<zip if:true="${platform.windows}" destfile="gcs-${module.version}.zip" basedir="${dist.root}"/>
<symlink if:true="${platform.mac}" action="delete" link="${dist.root}/Applications"/>
<delete dir="${build.dir}"/>
</target>
<target name="clone-deps">
<exec executable="git" dir="..">
<arg value="clone"/>
<arg value="https://github.com/richardwilkes/org.apache.commons.logging"/>
</exec>
<exec executable="git" dir="..">
<arg value="clone"/>
<arg value="https://github.com/richardwilkes/org.apache.fontbox"/>
</exec>
<exec executable="git" dir="..">
<arg value="clone"/>
<arg value="https://github.com/richardwilkes/org.apache.pdfbox"/>
</exec>
<exec executable="git" dir="..">
<arg value="clone"/>
<arg value="https://github.com/richardwilkes/gnu.trove"/>
</exec>
<exec executable="git" dir="..">
<arg value="clone"/>
<arg value="https://github.com/richardwilkes/com.lowagie.text"/>
</exec>
<exec executable="git" dir="..">
<arg value="clone"/>
<arg value="https://github.com/richardwilkes/toolkit"/>
</exec>
<exec executable="git" dir="..">
<arg value="clone"/>
<arg value="https://github.com/richardwilkes/gcs_library"/>
</exec>
</target>
<target name="pull">
<exec executable="git" dir="../org.apache.commons.logging">
<arg value="pull"/>
</exec>
<exec executable="git" dir="../org.apache.fontbox">
<arg value="pull"/>
</exec>
<exec executable="git" dir="../org.apache.pdfbox">
<arg value="pull"/>
</exec>
<exec executable="git" dir="../gnu.trove">
<arg value="pull"/>
</exec>
<exec executable="git" dir="../com.lowagie.text">
<arg value="pull"/>
</exec>
<exec executable="git" dir="../toolkit">
<arg value="pull"/>
</exec>
<exec executable="git" dir="../gcs_library">
<arg value="pull"/>
</exec>
<exec executable="git">
<arg value="pull"/>
</exec>
</target>
</project>