/[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 612 - (show annotations) (download)
Thu Jul 30 14:33:20 2009 UTC (12 years, 4 months ago) by wvengen
File MIME type: text/plain
File size: 13939 byte(s)
* make proguard work with xhtmlrenderer again
* build dist by default with proguard: 3.1MB->1.6MB :)
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="0.0.3"/>
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
35 <!-- extra tool definitions -->
36 <property name="browsertool.target.name" value="browsertool"/>
37 <property name="browsertool.target.main" value="nl.nikhef.jgridstart.install.BrowserTool"/>
38
39 <!-- reference to property file defining the properties
40 - keystore.file java keystore file
41 - keystore.passwd password for accessing the java keystore
42 - keystore.alias alias pointing to certificate to sign with
43 - if the property file cannot be found or does not define a keystore.file
44 - that points to a file, a self-signed certificate is generated so you can
45 - get started easily. For production, of course, you'll need your own
46 - secure certificate that users can trust.
47 - An example keystore.properties could be as follows:
48 - keystore.file = ${dir.keystore}/keystore.ks
49 - keystore.alias = default
50 - keystore.passwd = mysecret
51 -->
52 <property name="dir.keystore" location=".."/>
53 <property file="${dir.keystore}/keystore.properties"/>
54
55 <!--
56 - dependencies
57 -->
58
59 <property name="dep.bouncycastle" location="${dir.thirdparty}/bouncycastle/bcprov-jdk14-143.jar"/>
60 <property name="dep.bouncycastle.smime" location="${dir.thirdparty}/bouncycastle/bcmail-jdk14-143.jar"/>
61 <property name="dep.javamail" location="${dir.thirdparty}/bouncycastle/mail-1.4.1.jar"/>
62 <property name="dep.commons-cli" location="${dir.thirdparty}/commons/commons-cli-1.2.jar"/>
63 <property name="dep.commons-lang" location="${dir.thirdparty}/commons/commons-lang-2.4.jar"/>
64 <property name="dep.junit" location="${dir.thirdparty}/junit/junit-4.5.jar"/>
65 <property name="dep.abbot" location="${dir.thirdparty}/junit/abbot.jar"/>
66 <property name="dep.swingworker" location="${dir.thirdparty}/swingworker/swing-worker-1.2.jar"/>
67 <property name="dep.xhtmlrenderer" location="${dir.thirdparty}/flyingsaucer/core-renderer-minimal.jar"/>
68 <property name="dep.itext" location="${dir.thirdparty}/flyingsaucer/iText-2.0.8.jar"/>
69 <property name="dep.winregistry" location="${dir.thirdparty}/winregistry/WinRegistry-3.4.jar"/>
70 <property name="dep.apiviz" location="${dir.thirdparty}/javadoc/apiviz-1.3.0.GA.jar"/>
71 <!-- activation framework is present in Java 1.6 and we don't use
72 it apart for resolving; so we can omit it when compiling there
73 to avoid ProGuard Warnings (which are fatal); so we need it for
74 lower versions. This is a little trick with ProGuard's jarfilter -->
75 <property name="dep.activation" location="${dir.thirdparty}/bouncycastle/activation.jar"/>
76 <condition property="dep.activation.proguardfilter" value="(!**)">
77 <available classname="javax.activation.DataHandler"/>
78 </condition>
79 <path id="path.dependencies">
80 <!-- TODO use jdk13 library versions and test -->
81 <pathelement location="${dep.bouncycastle}"/>
82 <pathelement location="${dep.bouncycastle.smime}"/>
83 <pathelement location="${dep.javamail}"/>
84 <pathelement location="${dep.commons-lang}"/>
85 <pathelement location="${dep.commons-cli}"/>
86 <pathelement location="${dep.junit}"/>
87 <pathelement location="${dep.abbot}"/>
88 <pathelement location="${dep.swingworker}"/> <!-- for java1.5 and below -->
89 <pathelement location="${dep.xhtmlrenderer}"/>
90 <pathelement location="${dep.itext}"/>
91 <pathelement location="${dep.winregistry}"/>
92 </path>
93
94 <patternset id="distfiles">
95 <!-- exclude non-production files -->
96 <exclude name="**/test*"/>
97 <exclude name="**/*test/**"/>
98 <exclude name="**/*tests/**"/>
99 <exclude name="**/package.html"/>
100 <exclude name="**/*Test.class"/>
101 <exclude name="**/*Test$*.class"/>
102 <exclude name="**/AllTests.class"/>
103 <exclude name="**/AllTests$*.class"/>
104 <exclude name="**/CVS"/>
105 <exclude name="**/.svn"/>
106 </patternset>
107
108 <!--
109 - Initialisation and other setup
110 -->
111
112 <!-- keystore; create one if not supplied -->
113 <available file="${keystore.file}" type="file" property="keystore.available"/>
114 <target name="keystore" unless="keystore.available">
115 <tempfile property="keystore.file" prefix="keystore" suffix=".ks"/>
116 <property name="keystore.tempfile" value="${keystore.file}"/>
117 <property name="keystore.alias" value="default"/>
118 <property name="keystore.passwd" value="xyz12345"/>
119 <genkey alias="${keystore.alias}" storepass="${keystore.passwd}" keystore="${keystore.file}"
120 validity="1" dname="CN=Test, OU=Test, O=Test, C=Test"/>
121 </target>
122
123 <!-- proguard -->
124 <taskdef resource="proguard/ant/task.properties"
125 classpath="${dir.thirdparty}/proguard/proguard.jar"/>
126
127 <!-- timestamp -->
128 <target name="init">
129 <tstamp/>
130 </target>
131
132 <!--
133 - Compilation target
134 -->
135 <target name="compile" depends="init">
136 <mkdir dir="${dir.build}"/>
137 <!-- compile java sources -->
138 <javac srcdir="${dir.src}" destdir="${dir.build}" target="${target.jvmversion}">
139 <classpath refid="path.dependencies" />
140 </javac>
141 <!-- and copy resources; skip VCS dirs (and other hidden .*) -->
142 <copy todir="${dir.build}">
143 <fileset dir="${dir.src}">
144 <exclude name="**/*.java"/>
145 <exclude name="**/CVS"/>
146 <exclude name="**/.*"/>
147 </fileset>
148 </copy>
149 </target>
150
151 <!--
152 - Full JAR creation target
153 -->
154 <target name="jar.large" depends="compile">
155 <basename property="dep.bouncycastle.basename" file="${dep.bouncycastle}"/>
156 <jar jarfile="${dir.dist}/${target.name}.large.jar">
157 <manifest>
158 <attribute name="Built-By" value="${user.name}"/>
159 <attribute name="Main-Class" value="${target.main}"/>
160 <attribute name="Class-Path" value="${dep.bouncycastle.basename}"/>
161 </manifest>
162 <fileset dir="${dir.build}">
163 <patternset refid="distfiles"/>
164 </fileset>
165 <zipfileset src="${dep.commons-lang}" includes="**/*.class"/>
166 <zipfileset src="${dep.commons-cli}" includes="**/*.class"/>
167 <zipfileset src="${dep.swingworker}" includes="**/*.class"/>
168 <zipfileset src="${dep.xhtmlrenderer}">
169 <include name="**/*.class"/>
170 <exclude name="**/tool/**"/>
171 <exclude name="**/swt/**"/>
172 <exclude name="**/SWT**"/>
173 </zipfileset>
174 <zipfileset src="${dep.itext}" includes="**/*.class,**/fonts/*" excludes="**/tools/**"/>
175 <zipfileset src="${dep.winregistry}" includes="**/*.class"/>
176 <!-- iText needs some org.bouncycastle.cms classes but some other classes in this
177 package reference javax.mail which we don't want to include as well (so that
178 ProGuard can resolve them). Solution: only include part of the smime package.
179 In addition to this, certificate renewal also requires S/MIME mail stuff.
180 The activation framework doesn't appear to be needed during run -->
181 <zipfileset src="${dep.bouncycastle.smime}">
182 <include name="org/bouncycastle/cms/**"/>
183 <include name="org/bouncycastle/mail/smime/*.class/"/>
184 <include name="org/bouncycastle/mail/smime/util/*.class/"/>
185 </zipfileset>
186 <zipfileset src="${dep.javamail}" includes="**/*.class"/>
187 </jar>
188 </target>
189
190 <!--
191 - ProGuard-minimised JAR creation
192 -->
193 <target name="jar.small" depends="jar.large">
194 <!-- minimize jar file; skipnonpubliclibraryclasses needed for java1.6 -->
195 <proguard obfuscate="false" skipnonpubliclibraryclasses="false">
196 <injar file="${dir.dist}/${target.name}.large.jar"/>
197 <outjar file="${dir.dist}/${target.name}.small.jar"/>
198 <libraryjar file="${java.home}/lib/rt.jar"/>
199 <libraryjar file="${java.home}/lib/jce.jar"/>
200 <libraryjar file="${java.home}/lib/jsse.jar"/>
201 <libraryjar file="${dep.bouncycastle}"/>
202 <libraryjar file="${dep.junit}"/>
203 <libraryjar file="${dep.abbot}"/>
204 <libraryjar file="${dep.activation}" jarfilter="${dep.activation.proguardfilter}" />
205 <keepclasseswithmembers access="public">
206 <method access="public static" type="void"
207 name="main" parameters="java.lang.String[]"/>
208 </keepclasseswithmembers>
209 <!-- Somehow xhtmlrenderer classes are stripped too much, this is a workaround. Error e.g.
210 "Invalid index 2 in LocalVariableTable in class file org/xhtmlrenderer/render/Box" -->
211 <keepclasseswithmembers name="org.xhtmlrenderer.render.Box">
212 <method name="*"/>
213 </keepclasseswithmembers>
214 <keepclasseswithmembers name="org.xhtmlrenderer.swing.NaiveUserAgent">
215 <method name="*"/>
216 </keepclasseswithmembers>
217 <keepclasseswithmembers name="org.xhtmlrenderer.css.**">
218 <method name="*"/>
219 </keepclasseswithmembers>
220 <keepclasseswithmembers name="org.xhtmlrenderer.newtable.**">
221 <method name="*"/>
222 </keepclasseswithmembers>
223 <!-- logging is dynamically configured -->
224 <keepclasseswithmembers access="public" name="org.xhtmlrenderer.util.XRSimpleLogFormatter">
225 <method name="*"/>
226 </keepclasseswithmembers>
227 <keepclasseswithmembers access="public" name="org.xhtmlrenderer.util.Configuration">
228 <method name="*"/>
229 </keepclasseswithmembers>
230 </proguard>
231 </target>
232
233 <!--
234 - Distribution creation target
235 -->
236 <target name="dist" depends="keystore,jar.small">
237 <!-- copy large/small jar to distribution -->
238 <copy file="${dir.dist}/${target.name}.small.jar" tofile="${dir.dist}/${target.name}.jar"/>
239 <!-- sign it, required for java web start -->
240 <signjar keystore="${keystore.file}" jar="${dir.dist}/${target.name}.jar"
241 alias="${keystore.alias}" storepass="${keystore.passwd}"/>
242 <delete file="${keystore.tempfile}" quiet="true"/>
243 <!-- substitute variables in java web start files -->
244 <copy file="${dir.dist}/${target.name}.jnlp.in" tofile="${dir.dist}/${target.name}.jnlp" />
245 <copy file="${dir.dist}/bcprov.jnlp.in" tofile="${dir.dist}/bcprov.jnlp" />
246 <replace dir="${dir.dist}">
247 <include name="${target.name}.jnlp"/>
248 <include name="bcprov.jnlp"/>
249 <replacefilter token="@wwwbase@" value="${wwwbase}"/>
250 <replacefilter token="@main@" value="${target.main}"/>
251 </replace>
252 <!-- copy bouncycastle jar to deployment area -->
253 <copy file="${dep.bouncycastle}" todir="${dir.dist}"/>
254 </target>
255
256 <!--
257 - Cleaning target
258 -->
259 <target name="clean">
260 <delete dir="${dir.build}"/>
261 <delete file="${dir.dist}/${target.name}.jar"/>
262 <delete file="${dir.dist}/${target.name}.jnlp"/>
263 <delete file="${dir.dist}/bcprov.jnlp"/>
264 <basename property="dep.bouncycastle.basename" file="${dep.bouncycastle}"/>
265 <delete file="${dir.dist}/${dep.bouncycastle.basename}"/>
266 </target>
267
268 <!--
269 - extra targets
270 -->
271 <target name="browsertool" depends="compile">
272 <jar jarfile="${dir.dist}/${browsertool.target.name}.jar">
273 <manifest>
274 <attribute name="Built-By" value="${user.name}"/>
275 <attribute name="Main-Class" value="${browsertool.target.main}"/>
276 </manifest>
277 <fileset dir="${dir.build}">
278 <patternset refid="distfiles"/>
279 <include name="nl/nikhef/jgridstart/install/**"/>
280 <include name="nl/nikhef/jgridstart/util/**"/>
281 </fileset>
282 <zipfileset src="${dep.commons-cli}" includes="**/*.class"/>
283 <zipfileset src="${dep.winregistry}" includes="**/*.class"/>
284 </jar>
285 <!-- sign it, required for java web start -->
286 <signjar keystore="${keystore.file}" jar="${dir.dist}/${browsertool.name}.jar"
287 alias="${keystore.alias}" storepass="${keystore.passwd}"/>
288 </target>
289
290 <!-- javadoc with APIviz, needs graphviz >= 2.20 -->
291 <target name="javadoc" depends="compile">
292 <javadoc
293 destdir="${dir.javadoc}"
294 classpathref="path.dependencies"
295 access="protected" source="${target.jvmversion}"
296 doclet="org.jboss.apiviz.APIviz" docletpath="${dep.apiviz}" additionalparam="-sourceclasspath ${dir.build}">
297 <sourcefiles>
298 <fileset dir="${dir.src}">
299 <include name="**/*.java"/>
300 <exclude name="**/*Test.*"/>
301 <exclude name="**/AllTests.*"/>
302 </fileset>
303 </sourcefiles>
304 <link href="http://java.sun.com/j2se/1.5.0/docs/api/"/>
305 <link href="http://bouncycastle.org/docs/docs1.4/"/>
306 <link href="http://bouncycastle.org/docs/mdocs1.4/"/>
307 <link href="http://commons.apache.org/lang/api-release/"/>
308 <link href="http://commons.apache.org/cli/api-1.2/"/>
309 <link href="http://junit.org/junit/javadoc/4.5/"/>
310 <link href="http://abbot.sourceforge.net/doc/api/"/>
311 <link href="https://swingworker.dev.java.net/nonav/javadoc/"/>
312 <link href="http://pigeonholdings.com/projects/flyingsaucer/R8/javadoc/user/"/>
313 <link href="http://www.1t3xt.info/api/"/>
314 <link href="http://java.sun.com/products/javamail/javadocs/"/>
315 <!-- no online javadoc found for WinRegistry -->
316 </javadoc>
317 </target>
318
319 <!-- test report -->
320 <target name="testreport" depends="compile">
321 <junit fork="yes" haltonfailure="no">
322 <test fork="yes" todir="${dir.testreports}" name="nl.nikhef.jgridstart.AllTests"/>
323 <formatter type="xml"/>
324 <classpath refid="path.dependencies"/>
325 <classpath path="${dir.build}"/>
326 </junit>
327 </target>
328 </project>

Properties

Name Value
svn:mime-type text/plain

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