-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.xml
301 lines (260 loc) · 11.2 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
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
<?xml version="1.0"?>
<project name="portecle" basedir="." default="jar" xmlns:p="urn:net.sf.portecle">
<property name="version" value="1.10" />
<property name="helpbaseurl.default" value="/doc" />
<property file="build.properties" />
<!--
To build portecle.jar with no Class-Path MANIFEST.MF attribute,
set jar.classpath to an empty value in build.properties or command line.
-->
<property name="jar.classpath" value="bcprov.jar bcpkix.jar" />
<property name="helpbaseurl" value="${helpbaseurl.default}" />
<property name="root" value="." />
<property name="src" value="${root}/src" />
<property name="build" value="${root}/build" />
<property name="dist" value="${root}/dist" />
<property name="lib" value="${root}/lib" />
<property name="jar" value="portecle.jar" />
<property name="doc" value="${root}/doc" />
<property name="bcprov.jar" value="${lib}/bcprov-jdk15on-154.jar" />
<property name="bcpkix.jar" value="${lib}/bcpkix-jdk15on-154.jar" />
<property name="pack200.jar" value="${lib}/deployment-ant-pack200-1.0.jar"/>
<property name="build.debug" value="true" />
<property name="build.debuglevel" value="lines,source" />
<property name="build.srcver" value="1.7" />
<property name="build.targetver" value="1.7" />
<property name="build.encoding" value="UTF-8" />
<property name="apiurl.java" value="http://download.oracle.com/javase/7/docs/api/"/>
<property name="apiurl.bcprov" value="http://www.bouncycastle.org/docs/docs1.5on/"/>
<property name="apiurl.bcpkix" value="http://www.bouncycastle.org/docs/pkixdocs1.5on/"/>
<property name="manifest.codebase" value="portecle.sourceforge.net"/>
<property name="jnlp.codebase" value="http://portecle.sourceforge.net/webstart/"/>
<property name="signjar.tsaurl" value="http://timestamp.comodoca.com/rfc3161"/>
<path id="build.classpath">
<pathelement location="${bcprov.jar}" />
<pathelement location="${bcpkix.jar}" />
</path>
<typedef resource="org/jdesktop/deployment/ant/pack200/antlib.xml"
classpath="${pack200.jar}"/>
<presetdef name="signjar" uri="urn:net.sf.portecle">
<signjar
strict="true"
keystore="${signjar.keystore}"
storepass="${signjar.storepass}"
alias="${signjar.alias}"
keypass="${signjar.keypass}"
tsaurl="${signjar.tsaurl}"
sigfile="PORTECLE"/>
</presetdef>
<presetdef name="pack200" uri="urn:net.sf.portecle">
<pack200 effort="9"/>
</presetdef>
<presetdef name="zip" uri="urn:net.sf.portecle">
<zip level="9"/>
</presetdef>
<target name="build">
<mkdir dir="${build}/classes" />
<javac
srcdir="${src}/main"
destdir="${build}/classes"
source="${build.srcver}"
target="${build.targetver}"
debug="${build.debug}"
debuglevel="${build.debuglevel}"
encoding="${build.encoding}"
includeAntRuntime="false">
<classpath refid="build.classpath" />
<compilerarg compiler="javac1.7" value="-Xlint:all,-serial" />
</javac>
<copy todir="${build}/classes">
<fileset dir="${src}/main" includes="**/*.properties" />
<filterset>
<filter token="VERSION" value="${version}" />
<filter token="HELPBASEURL" value="${helpbaseurl}" />
</filterset>
</copy>
<!-- Clean up possibly previously copied docs -->
<delete dir="${build}/classes/doc" />
<copy todir="${build}/classes">
<fileset dir="${src}/main" includes="**/*.gif,**/*.png" />
</copy>
<condition property="jar.bundle.docs">
<equals arg1="${helpbaseurl}" arg2="${helpbaseurl.default}" />
</condition>
<antcall target="copy-docs-to-classes" />
</target>
<!-- Internal: copy docs for inclusion in jar. -->
<target name="copy-docs-to-classes" if="jar.bundle.docs">
<copy todir="${build}/classes">
<fileset dir="${root}" includes="doc/**"
excludes="doc/index.html doc/**/keytool.png doc/.htaccess doc/favicon.ico" />
</copy>
</target>
<target name="jar" depends="build" description="Builds the Portecle jar">
<jar jarfile="${build}/${jar}">
<manifest>
<attribute name="Main-Class" value="net.sf.portecle.FPortecle" />
<attribute name="SplashScreen-Image" value="net/sf/portecle/images/splash.png" />
<attribute name="Implementation-Title" value="Portecle" />
<attribute name="Implementation-Version" value="${version}" />
<attribute name="Implementation-Vendor" value="The Portecle Project" />
<attribute name="Implementation-Vendor-Id" value="net.sf.portecle" />
<attribute name="Implementation-URL" value="http://portecle.sourceforge.net/" />
<attribute name="Permissions" value="all-permissions" />
<attribute name="Application-Name" value="Portecle" />
<attribute name="Codebase" value="${manifest.codebase}" />
</manifest>
<fileset dir="${build}/classes" includes="*/**" />
</jar>
<condition property="jar.classpath.set">
<and>
<isset property="jar.classpath" />
<not><equals arg1="${jar.classpath}" arg2="" trim="true" /></not>
</and>
</condition>
<antcall target="jar-classpath" />
</target>
<!-- Internal: updates jar's Class-Path. -->
<target name="jar-classpath" if="jar.classpath.set">
<jar jarfile="${build}/${jar}" update="true">
<manifest>
<attribute name="Class-Path" value="${jar.classpath}" />
</manifest>
</jar>
</target>
<target name="webstart" depends="jar" description="Builds Java Web Start dir">
<mkdir dir="${build}/webstart"/>
<copy todir="${build}/webstart" flatten="true" preservelastmodified="true">
<fileset dir="${src}">
<include name="main/net/sf/portecle/images/splash.png"/>
<include name="icons/portecle.png"/>
</fileset>
</copy>
<length property="iconsize" file="${build}/webstart/portecle.png"/>
<length property="splashsize" file="${build}/webstart/splash.png"/>
<copy file="${bcprov.jar}" tofile="${build}/webstart/bcprov.jar"/>
<copy file="${bcpkix.jar}" tofile="${build}/webstart/bcpkix.jar"/>
<!--
Note: digestalg needs to stay the same as it already is in these
jars to avoid verification errors:
https://bugs.openjdk.java.net/browse/JDK-6848277
-->
<p:signjar digestalg="SHA-256">
<fileset dir="${build}/webstart" includes="bc*.jar"/>
</p:signjar>
<length property="bcjarsize" file="${build}/webstart/bcprov.jar" />
<length property="bcxjarsize" file="${build}/webstart/bcpkix.jar" />
<copy file="${src}/etc/portecle.jnlp" tofile="${build}/webstart/APPLICATION_TEMPLATE.JNLP" overwrite="true">
<filterset>
<filter token="VERSION" value="${version}" />
<filter token="CODEBASE" value="${jnlp.codebase}" />
<filter token="JARSIZE" value="*" />
<filter token="BCJARSIZE" value="${bcjarsize}" />
<filter token="BCXJARSIZE" value="${bcxjarsize}" />
<filter token="ICONSIZE" value="${iconsize}" />
<filter token="SPLASHSIZE" value="${splashsize}" />
</filterset>
</copy>
<xmlvalidate file="${build}/webstart/APPLICATION_TEMPLATE.JNLP"/>
<copy file="${build}/${jar}" todir="${build}/webstart"/>
<jar jarfile="${build}/webstart/${jar}" update="true">
<zipfileset file="${build}/webstart/APPLICATION_TEMPLATE.JNLP" prefix="JNLP-INF"/>
</jar>
<p:pack200 file="${build}/webstart/${jar}" todir="${build}/webstart" repack="true" overwrite="true"/>
<p:signjar jar="${build}/webstart/${jar}"/>
<length property="jarsize" file="${build}/webstart/${jar}" />
<p:pack200 todir="${build}/webstart">
<fileset dir="${build}/webstart" includes="*.jar"/>
<mapper type="glob" from="*.jar" to="*.jar.pack.gz"/>
</p:pack200>
<copy file="${src}/etc/portecle.jnlp" todir="${build}/webstart" overwrite="true">
<filterset>
<filter token="VERSION" value="${version}" />
<filter token="CODEBASE" value="${jnlp.codebase}" />
<filter token="JARSIZE" value="${jarsize}" />
<filter token="BCJARSIZE" value="${bcjarsize}" />
<filter token="BCXJARSIZE" value="${bcxjarsize}" />
<filter token="ICONSIZE" value="${iconsize}" />
<filter token="SPLASHSIZE" value="${splashsize}" />
</filterset>
</copy>
<xmlvalidate file="${build}/webstart/portecle.jnlp"/>
</target>
<target name="javadoc">
<mkdir dir="${build}/api" />
<javadoc
destdir="${build}/api"
source="${build.srcver}"
classpathref="build.classpath"
private="yes"
encoding="${build.encoding}"
charset="${build.encoding}">
<packageset dir="${src}/main" defaultexcludes="yes">
<include name="net/sf/portecle/**" />
</packageset>
<link href="${apiurl.java}"/>
<link href="${apiurl.bcprov}"/>
<link href="${apiurl.bcpkix}"/>
</javadoc>
</target>
<target name="run" depends="jar" description="Runs Portecle">
<copy file="${bcprov.jar}" tofile="${build}/bcprov.jar" />
<copy file="${bcpkix.jar}" tofile="${build}/bcpkix.jar" />
<!-- TODO: command line args -->
<java fork="true" jar="build/${jar}">
<sysproperty key="portecle.experimental" value="true" />
</java>
</target>
<target name="bindist" depends="jar"
description="Builds the Portecle binary distribution">
<mkdir dir="${dist}" />
<p:zip destfile="${dist}/portecle-${version}.zip">
<zipfileset prefix="portecle-${version}"
dir="${root}" includes="README.txt,LICENSE.txt,NEWS.txt" />
<zipfileset prefix="portecle-${version}"
dir="${lib}" includes="LICENSE.bouncycastle.txt" />
<zipfileset prefix="portecle-${version}" file="${build}/${jar}" />
<zipfileset prefix="portecle-${version}"
dir="${src}/icons" includes="portecle.*" />
<zipfileset prefix="portecle-${version}"
dir="${src}/etc" includes="portecle.desktop,portecle.appdata.xml" />
<zipfileset file="${bcprov.jar}"
fullpath="portecle-${version}/bcprov.jar" />
<zipfileset file="${bcpkix.jar}"
fullpath="portecle-${version}/bcpkix.jar" />
</p:zip>
</target>
<target name="srcdist"
description="Builds the Portecle source distribution">
<mkdir dir="${dist}" />
<p:zip destfile="${dist}/portecle-${version}-src.zip">
<zipfileset dir="${root}" prefix="portecle-${version}-src">
<include name="*.txt" />
<include name="*.xml" />
<include name=".classpath" />
<include name=".project" />
<include name=".settings/**" />
<include name="doc/**" />
<include name="lib/*" />
<include name="src/**" />
</zipfileset>
</p:zip>
</target>
<target name="dist" depends="srcdist,bindist"
description="Builds Portecle distributions" />
<target name="all" depends="dist,javadoc"
description="Builds everything" />
<target name="release" depends="distclean,dist"
description="Builds Portecle release from scratch" />
<target name="clean">
<delete dir="${build}/api" />
<delete dir="${build}/classes" />
<delete dir="${build}/webstart" />
<delete file="${build}/${jar}" />
<delete file="${build}/bcprov.jar" />
<delete file="${build}/bcpkix.jar" />
</target>
<target name="distclean" depends="clean">
<delete dir="${dist}" />
</target>
</project>