This repository was archived by the owner on Nov 14, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.xml
More file actions
317 lines (282 loc) · 11.5 KB
/
build.xml
File metadata and controls
317 lines (282 loc) · 11.5 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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
<?xml version="1.0" encoding="UTF-8"?>
<project name="crossfit-reader" basedir="."
xmlns:fx="javafx:com.sun.javafx.tools.ant"
xmlns:l4j="launch4j:net.sf.launch4j.ant">
<tstamp>
<format property="currentdate" pattern="yyyy/MM/dd HH:mm:ss"/>
</tstamp>
<property environment="env"/>
<property file="build.properties"/>
<property name="src.path" value="${basedir}/${src.dir}"/>
<property name="src-rss.path" value="${basedir}/${src-rss.dir}"/>
<property name="src-build.path" value="${basedir}/${src-build.dir}"/>
<property name="bin.path" value="${basedir}/${bin.dir}"/>
<property name="archives.path" value="${basedir}/${archives.dir}"/>
<property name="classes.path" value="${basedir}/${classes.dir}"/>
<property name="gradle.path" value="${basedir}/${gradle.dir}"/>
<property name="lib.path" value="${basedir}/${lib.dir}"/>
<property name="exe.path" value="${basedir}/${exe.dir}"/>
<property name="exe-rss.path" value="${basedir}/${exe-rss.dir}"/>
<property name="setup.path" value="${basedir}/${setup.dir}"/>
<property name="setup-rss.path" value="${basedir}/${setup-rss.dir}"/>
<property name="jre.path" value="${java.home}"/>
<property name="innoextract" location="${lib.path}\innoextract\innoextract.exe"/>
<property name="innosetup.path" location="${lib.path}\innosetup"/>
<property name="iscc" location="${innosetup.path}\app\ISCC.exe"/>
<macrodef name="assertdir">
<attribute name="dir"/>
<sequential>
<fail message="Directory '@{dir}' does not exist">
<condition><not><available file="@{dir}" type="dir"/></not></condition>
</fail>
</sequential>
</macrodef>
<macrodef name="assertfile">
<attribute name="file"/>
<sequential>
<fail message="File '@{file}' does not exist">
<condition><not><available file="@{file}" type="file"/></not></condition>
</fail>
</sequential>
</macrodef>
<!-- Build number -->
<condition property="app.release" value="${env.APPVEYOR_BUILD_NUMBER}"><isset property="env.APPVEYOR_BUILD_NUMBER"/></condition>
<condition property="app.release" value="${app.default.release}"><not><isset property="env.APPVEYOR_BUILD_NUMBER"/></not></condition>
<filterset id="filterset.app">
<filter token="APP_GUID" value="${app.guid}"/>
<filter token="APP_ID" value="${app.id}"/>
<filter token="APP_NAME" value="${app.name}"/>
<filter token="APP_DESC" value="${app.desc}"/>
<filter token="APP_VERSION" value="${app.version}.${app.release}"/>
<filter token="APP_MANUFACTURER" value="${app.author}"/>
<filter token="APP_SETUPNAME" value="${app.setupname}"/>
<filter token="APP_PATH" value="${app.path}"/>
<filter token="APP_LOG_PATH" value="${app.logpath}"/>
<filter token="JAR_FILENAME" value="${jar.filename}"/>
<filter token="JAR_MAINCLASS" value="${jar.mainclass}"/>
<filter token="BIN_PATH" value="${bin.path}"/>
<filter token="EXE_PATH" value="${exe.path}"/>
<filter token="EXE_RSS_PATH" value="${exe-rss.path}"/>
</filterset>
<target name="release" depends="infos, do.setup">
<echo message="Writing version.dat..."/>
<echo file="${bin.path}\version.dat" append="false">${app.version}.${app.release}</echo>
</target>
<target name="infos">
<echo message="Start building..." />
<echo message="* Name : ${app.name} " />
<echo message="* Version : ${app.version} " />
<echo message="* Release : ${app.release} " />
<echo message="* Java : ${java.version} " />
</target>
<target name="preload">
<condition property="is.lib.loaded" value="true">
<istrue value="${is.lib.loaded}"/>
</condition>
<condition property="is.exe.loaded" value="true">
<istrue value="${is.exe.loaded}"/>
</condition>
<mkdir dir="${lib.path}"/>
</target>
<target name="clean">
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${bin.path}">
<include name="**/*"/>
<exclude name="**/lib/**"/>
</fileset>
</delete>
</target>
<target name="load.libs" unless="is.lib.loaded" depends="
preload,
load.lib.antcontrib,
load.lib.javafx,
load.lib.launch4j,
load.lib.innosetup">
<var name="is.lib.loaded" value="true"/>
</target>
<target name="load.lib.antcontrib" unless="is.lib.loaded">
<echo message="Load ANT Contrib"/>
<mkdir dir="${lib.path}/ant-contrib"/>
<get dest="${lib.path}/ant-contrib/ant-contrib.jar" src="${antcontrib.url}" skipexisting="true"/>
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<fileset dir="${lib.path}/ant-contrib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</taskdef>
</target>
<target name="load.lib.javafx">
<echo message="Load JavaFX"/>
<path id="fx.classpath">
<pathelement location="${java.home}/../lib/ant-javafx.jar"/>
<pathelement location="${java.home}/lib/jfxrt.jar"/>
</path>
<echo message="fx.classpath: ${toString:fx.classpath}" />
<taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
uri="javafx:com.sun.javafx.tools.ant"
classpathref="fx.classpath"
/>
</target>
<target name="load.lib.launch4j">
<echo message="Load Launch4j"/>
<get dest="${lib.path}/launch4j.zip" src="${launch4j.url}" skipexisting="true"/>
<if>
<not><available file="${lib.path}/launch4j" type="dir" /></not>
<then>
<unzip src="${lib.path}/launch4j.zip" dest="${lib.path}"/>
</then>
</if>
<assertfile file="${lib.path}/launch4j/bin/windres.exe"/>
<taskdef name="l4j" classname="net.sf.launch4j.ant.Launch4jTask">
<classpath>
<pathelement location="${lib.path}/launch4j/launch4j.jar" />
<pathelement location="${lib.path}/launch4j/lib/xstream.jar" />
</classpath>
</taskdef>
</target>
<target name="load.lib.innoextract" unless="is.lib.loaded">
<echo message="Load innoextract"/>
<get dest="${lib.path}\innoextract.zip" src="${innoextract.url}" skipexisting="true"/>
<if>
<not><available file="${lib.path}\innoextract" type="dir"/></not>
<then>
<unzip src="${lib.path}\innoextract.zip" dest="${lib.path}\innoextract"/>
</then>
</if>
</target>
<target name="load.lib.innosetup" depends="load.lib.innoextract" unless="is.lib.loaded">
<echo message="Load InnoSetup"/>
<get dest="${lib.path}\innosetup.exe" src="${innosetup.url}" skipexisting="true"/>
<if>
<not><available file="${innosetup.path}\app" type="dir"/></not>
<then>
<exec executable="${innoextract}">
<arg value="-d"/>
<arg value="${innosetup.path}"/>
<arg value="${lib.path}\innosetup.exe"/>
</exec>
</then>
</if>
<assertfile file="${iscc}"/>
</target>
<target name="do.compile" depends="load.libs">
<mkdir dir="${classes.path}" />
<javac
destdir="${classes.path}"
encoding="${encoding}" debug="${debug}"
includeAntRuntime="false" fork="true"
memoryInitialSize="${java.memory.min}"
memoryMaximumSize="${java.memory.max}"
source="${javac.target}"
target="${javac.target}"
>
<src path="${src.path}"/>
<src path="${src-rss.path}"/>
<classpath>
<fileset dir="${gradle.path}">
<include name="*"/>
</fileset>
<filelist>
<file name="${java.home}/lib/jfxrt.jar"/>
</filelist>
</classpath>
</javac>
<!-- Copy resources -->
<copy todir="${classes.path}">
<fileset dir="${src.path}">
<exclude name="**/*.java"/>
</fileset>
<fileset dir="${src-rss.path}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="do.jar" depends="do.compile">
<mkdir dir="${archives.path}" />
<fx:application id="fx.application"
name="${app.id}"
version="${app.version}.${app.release}"
mainClass="${jar.mainclass}"
/>
<echo message="Creating JAR ${jar.filename}"/>
<fx:jar destfile="${archives.path}/${jar.filename}">
<fx:application refid="fx.application"/>
<fx:resources>
<fx:fileset dir="${gradle.path}" includes="*.jar"/>
</fx:resources>
<fx:fileset dir="${classes.path}" includes="**"/>
<fx:manifest>
<attribute name="Project-Id" value="${app.id}"/>
<attribute name="Project-Name" value="${app.name}"/>
<attribute name="Project-Desc" value="${app.desc}"/>
<attribute name="Project-Version" value="${app.version}"/>
<attribute name="Project-Release" value="${app.release}"/>
<attribute name="Project-Guid" value="${app.guid}"/>
<attribute name="Project-Author" value="${app.author}"/>
<attribute name="Project-Url" value="${app.url}"/>
<attribute name="Built-Date" value="${currentdate}"/>
</fx:manifest>
</fx:jar>
<!--echo message="Grouping in one JAR ${bin.path}/${app.id}.jar"/>
<jar destfile="${bin.path}/${app.id}.jar">
<zipgroupfileset dir="${archives.path}" includes="*.jar"/>
<zipgroupfileset dir="${gradle.path}" includes="*.jar"/>
<zipgroupfileset dir="${java.home}/lib" includes="jfxrt.jar"/>
</jar-->
</target>
<target name="do.exe" depends="do.jar" unless="is.exe.loaded">
<mkdir dir="${exe.path}"/>
<echo message="Copying files"/>
<copy file="${src-rss.path}/com/github/crazymax/crossfitreader/ext/img/icon.ico"
tofile="${exe-rss.path}/${app.icon}"/>
<copy file="${src-build.path}/launch4j.xml"
tofile="${exe-rss.path}/launch4j.xml">
<filterset refid="filterset.app" />
</copy>
<copy file="${src-build.path}/app.manifest"
tofile="${exe-rss.path}/${app.id}.manifest">
<filterset refid="filterset.app" />
</copy>
<copy todir="${exe.path}/app">
<fileset dir="${archives.path}" includes="*.jar"/>
<fileset dir="${gradle.path}" includes="*.jar"/>
<fileset dir="${java.home}/lib" includes="jfxrt.jar"/>
</copy>
<copy todir="${exe.path}">
<fileset dir="${java.home}/bin" includes="msvcr100.dll"/>
</copy>
<echo message="Creating executable"/>
<l4j bindir="${lib.path}/launch4j/bin" configFile="${exe-rss.path}/launch4j.xml"/>
<property name="is.exe.loaded" value="true"/>
</target>
<target name="do.setup" depends="do.exe">
<delete dir="${setup-rss.path}/${app.id}"/>
<echo message="Copying files"/>
<copy file="${src-rss.path}/com/github/crazymax/crossfitreader/ext/img/icon.ico"
tofile="${setup-rss.path}/${app.icon}"/>
<copy file="${src-rss.path}/com/github/crazymax/crossfitreader/ext/img/icon.ico"
tofile="${setup-rss.path}/${app.id}/${app.icon}"/>
<copy file="${src-build.path}/setup-mini.bmp" tofile="${setup-rss.path}/setup-mini.bmp"/>
<copy file="${src-build.path}/setup.bmp" tofile="${setup-rss.path}/setup.bmp"/>
<copy file="${basedir}/LICENSE" tofile="${setup-rss.path}/license.txt"/>
<copy file="${src-build.path}/setup.iss" tofile="${setup-rss.path}/${app.id}.iss">
<filterset refid="filterset.app" />
</copy>
<echo message="Copying executable"/>
<copy todir="${setup-rss.path}/${app.id}">
<fileset dir="${exe.path}"/>
</copy>
<echo message="Copying Windows JRE"/>
<copy todir="${setup-rss.path}/${app.id}/jre">
<fileset dir="${jre.path}"/>
</copy>
<echo message="Compile setup"/>
<exec executable="${iscc}" dir="${setup-rss.path}">
<arg value="/O${setup.path}"/>
<arg value="/F${app.setupname}"/>
<arg value="${setup-rss.path}/${app.id}.iss"/>
</exec>
<assertfile file="${setup.path}/${app.setupname}.exe"/>
</target>
</project>