/[pdpsoft]/branches/nl.nikhef.jgridstart-flyingsaucer/nl.nikhef.jgridstart/build.xml
ViewVC logotype

Contents of /branches/nl.nikhef.jgridstart-flyingsaucer/nl.nikhef.jgridstart/build.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 926 - (show annotations) (download)
Wed Oct 14 13:42:37 2009 UTC (12 years, 1 month ago) by wvengen
File MIME type: text/plain
File size: 16396 byte(s)
include smime classes in large jar; small jar still breaks
1 <?xml version="1.0" encoding="utf-8"?>
2 <project name="jgridstart" default="compile">
3 <description>jGridstart build file</description>
4
5 <!--
6 - Property definitions
7 -->
8 <!-- display name -->
9 <property name="target.title" value="jGridstart"/>
10 <!-- internal name -->
11 <property name="target.name" value="${ant.project.name}"/>
12 <!-- the program's version -->
13 <property name="target.version" value="1.0beta4"/>
14 <!-- main class to execute -->
15 <property name="target.main" value="nl.nikhef.jgridstart.gui.Main"/>
16 <!-- java virtual machine version to compile for -->
17 <property name="target.jvmversion" value="1.5"/>
18
19 <!-- Java Web Start base url (for use in JNLP files) -->
20 <property name="wwwbase" value="http://www.nikhef.nl/~wvengen/jgridstart-devel/"/>
21
22 <!-- location of source files -->
23 <property name="dir.src" location="src"/>
24 <!-- location of compiled classes -->
25 <property name="dir.build" location="bin"/>
26 <!-- location of output files for deployment -->
27 <property name="dir.dist" location="deployment"/>
28 <!-- location of thirdparty libraries -->
29 <property name="dir.thirdparty" location="thirdparty"/>
30 <!-- location of javadoc output -->
31 <property name="dir.javadoc" location="doc"/>
32 <!-- location of junit test output -->
33 <property name="dir.testreports" location="testreports"/>
34 <!-- location of screenshot output -->
35 <property name="dir.screenshots" location="screenshots"/>
36 <property name="screenshots.main" value="nl.nikhef.jgridstart.gui.util.GUIScreenshotsTest"/>
37
38 <!-- extra tool definitions -->
39 <property name="browsertool.target.name" value="browsertool"/>
40 <property name="browsertool.target.main" value="nl.nikhef.jgridstart.install.BrowserTool"/>
41
42 <property name="tests.target.name" value="tests"/>
43 <property name="tests.target.main" value="nl.nikhef.jgridstart.AllTests"/>
44
45 <!-- reference to property file defining the properties
46 - keystore.file java keystore file
47 - keystore.passwd password for accessing the java keystore
48 - keystore.alias alias pointing to certificate to sign with
49 - if the property file cannot be found or does not define a keystore.file
50 - that points to a file, a self-signed certificate is generated so you can
51 - get started easily. For production, of course, you'll need your own
52 - secure certificate that users can trust.
53 - An example keystore.properties could be as follows:
54 - keystore.file = ${dir.keystore}/keystore.ks
55 - keystore.alias = default
56 - keystore.passwd = mysecret
57 -->
58 <property name="dir.keystore" location=".."/>
59 <property file="${dir.keystore}/keystore.properties"/>
60
61 <!--
62 - dependencies
63 -->
64
65 <property name="dep.bouncycastle" location="${dir.thirdparty}/bouncycastle/bcprov-jdk14-143.jar"/>
66 <basename property="dep.bouncycastle.basename" file="${dep.bouncycastle}"/>
67 <property name="dep.bouncycastle.smime" location="${dir.thirdparty}/bouncycastle/bcmail-jdk14-143.jar"/>
68 <property name="dep.bouncycastle.tsp" location="${dir.thirdparty}/bouncycastle/bctsp-jdk14-143.jar"/>
69 <property name="dep.javamail" location="${dir.thirdparty}/bouncycastle/mail-1.4.1.jar"/>
70 <property name="dep.commons-cli" location="${dir.thirdparty}/commons/commons-cli-1.2.jar"/>
71 <property name="dep.commons-lang" location="${dir.thirdparty}/commons/commons-lang-2.4.jar"/>
72 <property name="dep.junit" location="${dir.thirdparty}/junit/junit-4.5.jar"/>
73 <property name="dep.abbot" location="${dir.thirdparty}/junit/abbot.jar"/>
74 <property name="dep.swingworker" location="${dir.thirdparty}/swingworker/swing-worker-1.2.jar"/>
75 <property name="dep.xhtmlrenderer" location="${dir.thirdparty}/flyingsaucer/core-renderer-minimal.jar"/>
76 <property name="dep.itext" location="${dir.thirdparty}/flyingsaucer/iText-2.0.8.jar"/>
77 <property name="dep.winregistry" location="${dir.thirdparty}/winregistry/WinRegistry-3.4.jar"/>
78 <property name="dep.apiviz" location="${dir.thirdparty}/javadoc/apiviz-1.3.0.GA.jar"/>
79 <!-- activation framework is present in Java 1.6 and we don't use
80 it apart for resolving; so we can omit it when compiling there
81 to avoid ProGuard Warnings (which are fatal); so we need it for
82 lower versions. This is a little trick with ProGuard's jarfilter -->
83 <property name="dep.activation" location="${dir.thirdparty}/bouncycastle/activation.jar"/>
84 <path id="path.dependencies">
85 <!-- TODO use jdk13 library versions and test -->
86 <pathelement location="${dep.bouncycastle}"/>
87 <pathelement location="${dep.bouncycastle.smime}"/>
88 <pathelement location="${dep.javamail}"/>
89 <pathelement location="${dep.commons-lang}"/>
90 <pathelement location="${dep.commons-cli}"/>
91 <pathelement location="${dep.junit}"/>
92 <pathelement location="${dep.abbot}"/>
93 <pathelement location="${dep.swingworker}"/> <!-- for java1.5 and below -->
94 <pathelement location="${dep.xhtmlrenderer}"/>
95 <pathelement location="${dep.itext}"/>
96 <pathelement location="${dep.winregistry}"/>
97 </path>
98
99 <patternset id="distfiles">
100 <!-- exclude non-production files -->
101 <exclude name="**/test*"/>
102 <exclude name="**/*test/**"/>
103 <exclude name="**/*tests/**"/>
104 <exclude name="**/package.html"/>
105 <exclude name="**/*Test.class"/>
106 <exclude name="**/*Test$*.class"/>
107 <exclude name="**/AllTests.class"/>
108 <exclude name="**/AllTests$*.class"/>
109 <exclude name="**/CVS"/>
110 <exclude name="**/.svn"/>
111 </patternset>
112
113 <!-- files to include as dependencies in jars -->
114 <resources id="depfiles">
115 <zipfileset src="${dep.commons-lang}" includes="**/*.class"/>
116 <zipfileset src="${dep.commons-cli}" includes="**/*.class"/>
117 <zipfileset src="${dep.swingworker}" includes="**/*.class"/>
118 <zipfileset src="${dep.xhtmlrenderer}">
119 <include name="**/*.class"/>
120 <exclude name="**/tool/**"/>
121 <exclude name="**/swt/**"/>
122 <exclude name="**/SWT**"/>
123 </zipfileset>
124 <zipfileset src="${dep.itext}">
125 <include name="**/*.class"/>
126 <include name="**/fonts/*"/>
127 <exclude name="**/tools/**"/>
128 </zipfileset>
129 <zipfileset src="${dep.winregistry}" includes="**/*.class"/>
130 <!-- iText needs some org.bouncycastle.cms classes but some other classes in this
131 package reference javax.mail which we don't want to include as well (so that
132 ProGuard can resolve them). Solution: only include part of the smime package.
133 In addition to this, certificate renewal also requires S/MIME mail stuff. -->
134 <zipfileset src="${dep.bouncycastle.smime}">
135 <include name="org/bouncycastle/cms/**"/>
136 <include name="org/bouncycastle/mail/smime/*.class/"/>
137 <include name="org/bouncycastle/mail/smime/util/*.class/"/>
138 <include name="org/bouncycastle/mail/smime/handlers/*.class/"/>
139 </zipfileset>
140 <zipfileset src="${dep.bouncycastle.tsp}" includes="**/*.class"/>
141 <zipfileset src="${dep.javamail}" includes="**/*.class"/>
142 <zipfileset src="${dep.activation}" includes="**/*.class"/>
143 </resources>
144
145
146 <!--
147 - Initialisation and other setup
148 -->
149
150 <!-- keystore; create one if not supplied -->
151 <available file="${keystore.file}" type="file" property="keystore.available"/>
152 <target name="keystore" unless="keystore.available">
153 <tempfile property="keystore.file" prefix="keystore" suffix=".ks"/>
154 <property name="keystore.tempfile" value="${keystore.file}"/>
155 <property name="keystore.alias" value="default"/>
156 <property name="keystore.passwd" value="xyz12345"/>
157 <genkey alias="${keystore.alias}" storepass="${keystore.passwd}" keystore="${keystore.file}"
158 validity="1" dname="CN=Test, OU=Test, O=Test, C=Test"/>
159 </target>
160
161 <!-- proguard -->
162 <taskdef resource="proguard/ant/task.properties"
163 classpath="${dir.thirdparty}/proguard/proguard.jar"/>
164 <!-- subversion -->
165 <typedef resource="org/tigris/subversion/svnant/svnantlib.xml">
166 <classpath><fileset dir="${dir.thirdparty}/svnant">
167 <include name="*.jar"/>
168 </fileset></classpath>
169 </typedef>
170 <svn failonerror="false"><wcVersion path="." prefix="svn."/></svn>
171 <property name="target.revision" value="${svn.revision.range}"/>
172 <!-- timestamp -->
173 <target name="init">
174 <tstamp/>
175 </target>
176
177 <!--
178 - Compilation target
179 -->
180 <target name="compile" depends="init">
181 <mkdir dir="${dir.build}"/>
182 <!-- compile java sources -->
183 <javac srcdir="${dir.src}" destdir="${dir.build}" target="${target.jvmversion}">
184 <classpath refid="path.dependencies" />
185 </javac>
186 <!-- copy resources; skip VCS dirs (and other hidden .*) -->
187 <copy todir="${dir.build}">
188 <fileset dir="${dir.src}">
189 <exclude name="**/*.java"/>
190 <exclude name="**/CVS"/>
191 <exclude name="**/.*"/>
192 <exclude name="resources/conf/global.properties"/>
193 </fileset>
194 </copy>
195 <!-- set global variables from build -->
196 <copy file="${dir.src}/resources/conf/global.properties"
197 tofile="${dir.build}/resources/conf/global.properties">
198 <filterchain>
199 <replacetokens>
200 <token key="jgridstart.version" value="${target.version}"/>
201 <token key="jgridstart.revision" value="${target.revision}"/>
202 </replacetokens>
203 </filterchain>
204 </copy>
205 </target>
206
207 <!--
208 - Full JAR creation target
209 -->
210 <target name="jar.large" depends="compile">
211 <jar jarfile="${dir.dist}/${target.name}.large.jar">
212 <manifest>
213 <attribute name="Built-By" value="${user.name}"/>
214 <attribute name="Main-Class" value="${target.main}"/>
215 <attribute name="Class-Path" value="${dep.bouncycastle.basename}"/>
216 </manifest>
217 <fileset dir="${dir.build}">
218 <patternset refid="distfiles"/>
219 </fileset>
220 <resources refid="depfiles"/>
221 </jar>
222 </target>
223
224 <!--
225 - ProGuard-minimised JAR creation
226 -->
227 <target name="jar.small" depends="jar.large">
228 <!-- minimize jar file; skipnonpubliclibraryclasses needed for java1.6 -->
229 <proguard obfuscate="false" skipnonpubliclibraryclasses="false">
230 <injar file="${dir.dist}/${target.name}.large.jar"/>
231 <outjar file="${dir.dist}/${target.name}.small.jar"/>
232 <libraryjar file="${java.home}/lib/rt.jar"/>
233 <libraryjar file="${java.home}/lib/jce.jar"/>
234 <libraryjar file="${java.home}/lib/jsse.jar"/>
235 <libraryjar file="${dep.bouncycastle}"/>
236 <libraryjar file="${dep.junit}"/>
237 <libraryjar file="${dep.abbot}"/>
238 <keepclasseswithmembers access="public">
239 <method access="public static" type="void"
240 name="main" parameters="java.lang.String[]"/>
241 </keepclasseswithmembers>
242 <!-- Somehow xhtmlrenderer classes are stripped too much, this is a workaround. Error e.g.
243 "Invalid index 2 in LocalVariableTable in class file org/xhtmlrenderer/render/Box" -->
244 <keepclasseswithmembers name="org.xhtmlrenderer.render.Box">
245 <method name="*"/>
246 </keepclasseswithmembers>
247 <keepclasseswithmembers name="org.xhtmlrenderer.swing.NaiveUserAgent">
248 <method name="*"/>
249 </keepclasseswithmembers>
250 <keepclasseswithmembers name="org.xhtmlrenderer.css.**">
251 <method name="*"/>
252 </keepclasseswithmembers>
253 <keepclasseswithmembers name="org.xhtmlrenderer.newtable.**">
254 <method name="*"/>
255 </keepclasseswithmembers>
256 <keepclasseswithmembers name="org.xhtmlrenderer.resource.XMLResource**">
257 <method name="*"/>
258 </keepclasseswithmembers>
259 <!-- logging is dynamically configured -->
260 <keepclasseswithmembers access="public" name="org.xhtmlrenderer.util.XRSimpleLogFormatter">
261 <method name="*"/>
262 </keepclasseswithmembers>
263 <keepclasseswithmembers access="public" name="org.xhtmlrenderer.util.Configuration">
264 <method name="*"/>
265 </keepclasseswithmembers>
266 <!-- CA class used is set in configfile -->
267 <keepclasseswithmembers name="nl.nikhef.jgridstart.ca.**">
268 <method name="*"/>
269 </keepclasseswithmembers>
270 </proguard>
271 </target>
272
273 <!--
274 - Distribution creation target
275 -->
276 <target name="dist" depends="keystore,jar.small">
277 <!-- copy large/small jar to distribution -->
278 <copy file="${dir.dist}/${target.name}.small.jar" tofile="${dir.dist}/${target.name}.jar"/>
279 <!-- sign it, required for java web start -->
280 <signjar keystore="${keystore.file}" jar="${dir.dist}/${target.name}.jar"
281 alias="${keystore.alias}" storepass="${keystore.passwd}"/>
282 <delete file="${keystore.tempfile}" quiet="true"/>
283 <!-- substitute variables in java web start files -->
284 <copy file="${dir.dist}/${target.name}.jnlp.in" tofile="${dir.dist}/${target.name}.jnlp" />
285 <copy file="${dir.dist}/bcprov.jnlp.in" tofile="${dir.dist}/bcprov.jnlp" />
286 <replace dir="${dir.dist}">
287 <include name="${target.name}.jnlp"/>
288 <include name="bcprov.jnlp"/>
289 <replacefilter token="@wwwbase@" value="${wwwbase}"/>
290 <replacefilter token="@main@" value="${target.main}"/>
291 </replace>
292 <!-- copy bouncycastle jar to deployment area -->
293 <copy file="${dep.bouncycastle}" todir="${dir.dist}"/>
294 </target>
295
296 <!--
297 - Cleaning target
298 -->
299 <target name="clean">
300 <delete dir="${dir.build}"/>
301 <delete file="${dir.dist}/${target.name}.jar"/>
302 <delete file="${dir.dist}/${target.name}.jnlp"/>
303 <delete file="${dir.dist}/bcprov.jnlp"/>
304 <delete file="${dir.dist}/${dep.bouncycastle.basename}"/>
305 <delete file="${dir.dist}/${browsertool.target.name}.jar"/>
306 <delete file="${dir.dist}/${tests.target.name}.jar"/>
307 </target>
308
309 <!--
310 - extra targets
311 -->
312 <!-- browsertool -->
313 <target name="browsertool" depends="compile">
314 <jar jarfile="${dir.dist}/${browsertool.target.name}.jar">
315 <manifest>
316 <attribute name="Built-By" value="${user.name}"/>
317 <attribute name="Main-Class" value="${browsertool.target.main}"/>
318 </manifest>
319 <fileset dir="${dir.build}">
320 <patternset refid="distfiles"/>
321 <include name="nl/nikhef/jgridstart/install/**"/>
322 <include name="nl/nikhef/jgridstart/util/**"/>
323 </fileset>
324 <zipfileset src="${dep.commons-cli}" includes="**/*.class"/>
325 <zipfileset src="${dep.winregistry}" includes="**/*.class"/>
326 </jar>
327 <!-- sign it, required for java web start -->
328 <signjar keystore="${keystore.file}" jar="${dir.dist}/${browsertool.name}.jar"
329 alias="${keystore.alias}" storepass="${keystore.passwd}"/>
330 </target>
331
332 <!-- archive with unit tests -->
333 <target name="jar.tests" depends="compile">
334 <jar jarfile="${dir.dist}/${tests.target.name}.jar">
335 <manifest>
336 <attribute name="Built-By" value="${user.name}"/>
337 <attribute name="Main-Class" value="${tests.target.main}"/>
338 <attribute name="Class-Path" value="${dep.bouncycastle.basename}"/>
339 </manifest>
340 <fileset dir="${dir.build}"/>
341 <resources refid="depfiles"/>
342 <zipfileset src="${dep.junit}" includes="**/*.class"/>
343 <zipfileset src="${dep.abbot}" includes="**/*.class"/>
344 </jar>
345 </target>
346
347 <!-- javadoc with APIviz, needs graphviz >= 2.20 -->
348 <target name="javadoc" depends="compile">
349 <javadoc
350 destdir="${dir.javadoc}"
351 classpathref="path.dependencies"
352 access="protected" source="${target.jvmversion}"
353 doclet="org.jboss.apiviz.APIviz" docletpath="${dep.apiviz}" additionalparam="-sourceclasspath ${dir.build}">
354 <sourcefiles>
355 <fileset dir="${dir.src}">
356 <include name="**/*.java"/>
357 <exclude name="**/*Test.*"/>
358 <exclude name="**/AllTests.*"/>
359 </fileset>
360 </sourcefiles>
361 <link href="http://java.sun.com/j2se/1.5.0/docs/api/"/>
362 <link href="http://bouncycastle.org/docs/docs1.4/"/>
363 <link href="http://bouncycastle.org/docs/mdocs1.4/"/>
364 <link href="http://commons.apache.org/lang/api-release/"/>
365 <link href="http://commons.apache.org/cli/api-1.2/"/>
366 <link href="http://junit.org/junit/javadoc/4.5/"/>
367 <link href="http://abbot.sourceforge.net/doc/api/"/>
368 <link href="https://swingworker.dev.java.net/nonav/javadoc/"/>
369 <link href="http://pigeonholdings.com/projects/flyingsaucer/R8/javadoc/user/"/>
370 <link href="http://www.1t3xt.info/api/"/>
371 <link href="http://java.sun.com/products/javamail/javadocs/"/>
372 <!-- no online javadoc found for WinRegistry -->
373 </javadoc>
374 </target>
375
376 <!-- test report -->
377 <target name="testreport" depends="compile">
378 <junit fork="yes" haltonfailure="no">
379 <test fork="yes" todir="${dir.testreports}" name="nl.nikhef.jgridstart.AllTests"/>
380 <formatter type="xml"/>
381 <classpath refid="path.dependencies"/>
382 <classpath path="${dir.build}"/>
383 </junit>
384 </target>
385
386 <!-- generate screenshots for documentation -->
387 <target name="screenshots" depends="compile">
388 <java classname="${screenshots.main}" fork="yes">
389 <arg value="${dir.screenshots}"/>
390 <classpath refid="path.dependencies"/>
391 <classpath path="${dir.build}"/>
392 </java>
393 </target>
394
395 </project>

Properties

Name Value
svn:mime-type text/plain

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28