forked from qzind/tray
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
273 lines (240 loc) · 11.7 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
270
271
272
273
<?xml version="1.0" encoding="UTF-8"?>
<project name="qz" default="distribute" basedir=".">
<property file="ant/project.properties"/>
<import file="ant/platform-detect.xml"/>
<import file="ant/javafx.xml"/>
<import file="ant/signing.xml"/>
<import file="ant/apple/installer.xml"/>
<import file="ant/linux/installer.xml"/>
<import file="ant/windows/installer.xml"/>
<!-- Fixes some odd empty directory issues -->
<defaultexcludes remove="**/.DS_Store"/>
<target name="distribute" depends="init,quick-clean,build-jar,override-authcert,build-demo,whitelist-certs">
<echo level="info">Process complete</echo>
</target>
<target name="init">
<condition property="codesign.windows" value="true">
<and>
<isset property="target.os.windows"/>
<isset property="signing.tsaurl"/>
</and>
</condition>
<condition property="codesign.linux" value="true">
<and>
<isset property="target.os.linux"/>
<isset property="signing.tsaurl"/>
</and>
</condition>
<echo message="Building ${project.filename} using JDK ${ant.java.version}"/>
</target>
<target name="clean" depends="init">
<delete dir="${out.dir}" includeemptydirs="true" defaultexcludes="false"/>
</target>
<target name="quick-clean">
<!-- Cleanup lingering files (for other OS installers) -->
<delete includeemptydirs="true" defaultexcludes="false" failonerror="false">
<fileset dir="${out.dir}">
<include name="**/**"/>
<exclude name="**/jlink/**"/>
<exclude name="**/javafx-*/**"/>
</fileset>
</delete>
</target>
<target name="compile-socket" depends="init">
<mkdir dir="${build.dir}/${project.filename}"/>
<!-- find the pdfbox jar -->
<path id="pdfbox.found">
<first>
<fileset dir="lib/printing/">
<include name="pdfbox*.jar"/>
</fileset>
</first>
</path>
<pathconvert property="pdfbox.path" refid="pdfbox.found"/>
<javac destdir="${build.dir}/${project.filename}" source="${javac.source}" target="${javac.target}" includeantruntime="false" encoding="UTF-8" debug="true">
<src path="${src.dir}"/>
<classpath>
<!-- prefer bouncycastle from pdfbox over others -->
<path id="plugin.override">
<pathelement path="${pdfbox.path}"/>
</path>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${java.home}">
<include name="**/*.jar"/>
</fileset>
</classpath>
<compilerarg value="-Xlint:-options"/>
</javac>
<!-- Include non-class files from src in build directory -->
<copy todir="${build.dir}/${project.filename}">
<fileset dir="${src.dir}" excludes="**/*.java"/>
</copy>
<copy todir="${dist.dir}">
<fileset file="LICENSE.txt"/>
</copy>
</target>
<target name="build-jar" depends="download-javafx,compile-socket,copy-libs,externalize-libs">
<echo level="info">Building jar</echo>
<!-- Strip jlink-incompat files -->
<echo level="info">Stripping jlink-incompatible files</echo>
<jar compress="${jar.compress}" index="${jar.index}" destfile="${dist.dir}/${project.filename}.jar" duplicate="preserve">
<fileset dir="${build.dir}/${project.filename}"/>
<!-- Some root level files will cause jlink to fail, they need to be cleaned up -->
<fileset dir="${out.dir}/libs-temp" excludes="*.class,LICENSE,jetty-dir.css,about.html,Log4j-*"/>
<manifest>
<attribute name="Application-Name" value="${project.name}"/>
<attribute name="Main-Class" value="qz.App"/>
<attribute name="Permissions" value="all-permissions"/>
<attribute name="Multi-Release" value="true"/>
</manifest>
</jar>
<delete dir="${out.dir}/libs-temp" includeemptydirs="true" defaultexcludes="false"/>
</target>
<target name="externalize-libs" if="separate.static.libs" depends="copy-dylibs,copy-dlls,copy-solibs">
<!-- Strip embedded, native resources -->
<delete>
<fileset dir="${out.dir}/libs-temp">
<include name="**/*.jnilib"/>
<include name="**/*.dylib"/>
<include name="**/*.dll"/>
<include name="**/*.so"/>
<include name="**/*.a"/>
</fileset>
</delete>
<!-- Delete empty files-->
<delete includeemptydirs="true" defaultexcludes="false">
<fileset dir="${out.dir}/libs-temp">
<and>
<size value="0"/>
<type type="dir"/>
</and>
</fileset>
</delete>
</target>
<target name="copy-libs" depends="download-javafx">
<!-- Copy jfx libs-->
<mkdir dir="${dist.dir}/libs"/>
<copy todir="${dist.dir}/libs" flatten="true">
<fileset dir="${target.fx.dir}">
<include name="**/*.${target.libext}"/>
</fileset>
</copy>
<!-- Copy platform independent third-party libs -->
<mkdir dir="${out.dir}/libs-temp"/>
<unzip dest="${out.dir}/libs-temp" overwrite="false">
<fileset dir="${basedir}/lib">
<include name="**/*.jar"/>
<exclude name="**/javafx*"/>
</fileset>
</unzip>
<!-- Copy platform specific target javafx version -->
<echo level="info">Copying ${target.fx.dir}</echo>
<unzip dest="${out.dir}/libs-temp" overwrite="false">
<fileset dir="${target.fx.dir}">
<include name="**/*.jar"/>
</fileset>
</unzip>
<!-- Remove files that can/did collide during unpacking -->
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${out.dir}/libs-temp">
<include name="LICENSE*"/>
<include name="README*"/>
<include name="**/META-INF/**"/>
<!-- Used by SecurityInfo.getMavenVersions() -->
<exclude name="**/META-INF/maven/**"/>
<!-- Required by log4j -->
<exclude name="**/META-INF/**/apache/logging/**"/>
<exclude name="**/META-INF/services/**"/>
</fileset>
</delete>
<!-- Merge META-INF/services from PDFBOX, jpeg2000 and TwelveMonkeys -->
<!-- find the TwelveMonkeys jar -->
<path id="imageio-jpeg.found">
<first>
<fileset dir="lib/imaging/">
<include name="imageio-jpeg*.jar"/>
</fileset>
</first>
</path>
<pathconvert property="imageio-jpeg.path" refid="imageio-jpeg.found"/>
<!-- find the jpeg2000 jar -->
<path id="imageio-jpeg2000.found">
<first>
<fileset dir="lib/imaging/">
<include name="jai-imageio-jpeg2000*.jar"/>
</fileset>
</first>
</path>
<pathconvert property="imageio-jpeg2000.path" refid="imageio-jpeg2000.found"/>
<!-- merge service entries for ImageReaderSpi -->
<concat destfile="${out.dir}/libs-temp/META-INF/services/javax.imageio.spi.ImageReaderSpi" fixlastline="true">
<zipentry zipfile="${pdfbox.path}" name="META-INF/services/javax.imageio.spi.ImageReaderSpi"/>
<zipentry zipfile="${imageio-jpeg.path}" name="META-INF/services/javax.imageio.spi.ImageReaderSpi"/>
<zipentry zipfile="${imageio-jpeg2000.path}" name="META-INF/services/javax.imageio.spi.ImageReaderSpi"/>
</concat>
</target>
<!-- install override.crt for "community" branded builds -->
<target name="override-authcert" if="authcert.use">
<echo level="info">Bundling with manual cert for signing auth: ${authcert.use}</echo>
<!-- See also: Constants.OVERRIDE_CERT -->
<property description="suppress-property-warning" name="authcert.use" value="override.crt"/>
<copy file="${authcert.use}" tofile="${dist.dir}/override.crt" overwrite="true"/>
</target>
<!-- install certs to "whitelist" directory for whitelabel builds -->
<target name="whitelist-certs" depends="build-demo" if="whitelist.use">
<echo level="info">Copying certificate(s) to dist/whitelist: ${whitelist.use}</echo>
<!-- See also: Constants.WHITELIST_CERT_DIR -->
<mkdir dir="${dist.dir}/whitelist"/>
<property description="suppress property warning" name="whitelist.use" value=""/>
<copy file="${whitelist.use}" todir="${dist.dir}/whitelist" overwrite="true"/>
</target>
<target name="build-demo" depends="init" unless="dist.minimal">
<property description="suppress-property-warning" name="demo.dir" value="${dist.dir}/demo"/>
<echo level="info">Copying demo resource files to ${demo.dir}</echo>
<!-- Create the demo folder -->
<delete dir="${demo.dir}" failonerror="false"/>
<copy todir="${demo.dir}">
<fileset file="sample.html"/>
<fileset dir="${basedir}" includes="css/**"/>
<fileset dir="${basedir}" includes="fonts/**"/>
<fileset dir="${basedir}" includes="js/**/*.js"/>
<fileset dir="${basedir}" includes="assets/**">
<exclude name="**/branding/"/>
</fileset>
</copy>
<!-- Handle sample.html renaming -->
<property description="suppress-property-warning" name="sample.name" value="sample.html"/>
<move file="${demo.dir}/sample.html" tofile="${demo.dir}/${sample.name}"/>
</target>
<target description="This task is deprecated" name="include-assets" depends="build-demo">
<echo level="warn">The "include-assets" task is deprecated, please use "build-demo" instead.</echo>
</target>
<target name="download-jre" unless="jre.skip">
<condition property="target.os" value="windows">
<isset property="target.os.windows"/>
</condition>
<condition property="target.os" value="mac">
<isset property="target.os.mac"/>
</condition>
<property description="target.os default" name="target.os" value="linux"/>
<property name="jlink.java.target" value="" description="fallback value"/>
<echo level="info">Downloading and bundling the jre for ${target.os}</echo>
<java jar="${dist.dir}/${project.filename}.jar" fork="true" failonerror="true">
<arg value="jlink"/>
<arg line="--platform ${target.os}"/>
<arg line="--arch ${target.arch}"/>
<arg line="--vendor ${jlink.java.vendor}"/>
<arg line="--version ${jlink.java.version}"/>
<arg line="--gc ${jlink.java.gc}"/>
<arg line="--gcversion ${jlink.java.gc.version}"/><!-- openj9 only -->
<!-- If specified, takes precedence over the above values-->
<arg line="--targetjdk ${jlink.java.target}"/>
</java>
</target>
<target name="nsis" depends="get-target-arch,target-os-windows,distribute,download-jre,build-exe"/>
<target name="pkgbuild" depends="get-target-arch,target-os-mac,distribute,download-jre,build-pkg"/>
<target name="dmg" depends="get-target-arch,target-os-mac,distribute,download-jre,build-dmg"/>
<target name="makeself" depends="get-target-arch,target-os-linux,distribute,download-jre,build-run"/>
</project>