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

Properties

Name Value
svn:mime-type text/plain

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