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/jgridstart03b/"/> |
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.cli" location="${dir.thirdparty}/commons-cli/commons-cli-1.2.jar"/> |
62 |
<property name="dep.junit" location="${dir.thirdparty}/junit/junit-4.5.jar"/> |
63 |
<property name="dep.abbot" location="${dir.thirdparty}/junit/abbot.jar"/> |
64 |
<property name="dep.swingworker" location="${dir.thirdparty}/swingworker/swing-worker-1.2.jar"/> |
65 |
<property name="dep.xhtmlrenderer" location="${dir.thirdparty}/flyingsaucer/core-renderer-minimal.jar"/> |
66 |
<property name="dep.itext" location="${dir.thirdparty}/flyingsaucer/iText-2.0.8.jar"/> |
67 |
<property name="dep.winregistry" location="${dir.thirdparty}/winregistry/WinRegistry-3.4.jar"/> |
68 |
<property name="dep.apiviz" location="${dir.thirdparty}/javadoc/apiviz-1.3.0.GA.jar"/> |
69 |
<path id="path.dependencies"> |
70 |
<!-- TODO use jdk13 library versions and test --> |
71 |
<pathelement location="${dep.bouncycastle}"/> |
72 |
<pathelement location="${dep.cli}"/> |
73 |
<pathelement location="${dep.junit}"/> |
74 |
<pathelement location="${dep.abbot}"/> |
75 |
<pathelement location="${dep.swingworker}"/> <!-- for java1.5 and below --> |
76 |
<pathelement location="${dep.xhtmlrenderer}"/> |
77 |
<pathelement location="${dep.itext}"/> |
78 |
<pathelement location="${dep.winregistry}"/> |
79 |
</path> |
80 |
|
81 |
<!-- |
82 |
- Initialisation and other setup |
83 |
--> |
84 |
|
85 |
<!-- keystore; create one if not supplied --> |
86 |
<available file="${keystore.file}" type="file" property="keystore.available"/> |
87 |
<target name="keystore" unless="keystore.available"> |
88 |
<tempfile property="keystore.file" prefix="keystore" suffix=".ks"/> |
89 |
<property name="keystore.tempfile" value="${keystore.file}"/> |
90 |
<property name="keystore.alias" value="default"/> |
91 |
<property name="keystore.passwd" value="xyz12345"/> |
92 |
<genkey alias="${keystore.alias}" storepass="${keystore.passwd}" keystore="${keystore.file}" |
93 |
validity="1" dname="CN=Test, OU=Test, O=Test, C=Test"/> |
94 |
</target> |
95 |
|
96 |
<!-- proguard --> |
97 |
<taskdef resource="proguard/ant/task.properties" |
98 |
classpath="${dir.thirdparty}/proguard/proguard.jar"/> |
99 |
|
100 |
<!-- timestamp --> |
101 |
<target name="init"> |
102 |
<tstamp/> |
103 |
</target> |
104 |
|
105 |
<!-- |
106 |
- Compilation target |
107 |
--> |
108 |
<target name="compile" depends="init"> |
109 |
<mkdir dir="${dir.build}"/> |
110 |
<!-- compile java sources --> |
111 |
<javac srcdir="${dir.src}" destdir="${dir.build}" target="${target.jvmversion}"> |
112 |
<classpath refid="path.dependencies" /> |
113 |
</javac> |
114 |
<!-- and copy resources; skip VCS dirs (and other hidden .*) --> |
115 |
<copy todir="${dir.build}"> |
116 |
<fileset dir="${dir.src}"> |
117 |
<exclude name="**/*.java"/> |
118 |
<exclude name="**/CVS"/> |
119 |
<exclude name="**/.*"/> |
120 |
</fileset> |
121 |
</copy> |
122 |
</target> |
123 |
|
124 |
<!-- |
125 |
- Distribution creation target |
126 |
--> |
127 |
<target name="dist" depends="compile,keystore"> |
128 |
<!-- pack into jar --> |
129 |
<basename property="dep.bouncycastle.basename" file="${dep.bouncycastle}"/> |
130 |
<jar jarfile="${dir.dist}/${target.name}.large.jar"> |
131 |
<manifest> |
132 |
<attribute name="Built-By" value="${user.name}"/> |
133 |
<attribute name="Main-Class" value="${target.main}"/> |
134 |
<attribute name="Class-Path" value="${dep.bouncycastle.basename}"/> |
135 |
</manifest> |
136 |
<fileset dir="${dir.build}"> |
137 |
<!-- remove non-production files --> |
138 |
<exclude name="**/test*"/> |
139 |
<exclude name="**/*test/**"/> |
140 |
<exclude name="**/*tests/**"/> |
141 |
<exclude name="**/package.html"/> |
142 |
</fileset> |
143 |
<zipfileset src="${dep.cli}" includes="**/*.class"/> |
144 |
<zipfileset src="${dep.swingworker}" includes="**/*.class"/> |
145 |
<zipfileset src="${dep.xhtmlrenderer}" includes="**/*.class" excludes="**/tool/**"/> |
146 |
<zipfileset src="${dep.itext}" includes="**/*.class,**/fonts/*" excludes="**/tools/**"/> |
147 |
<zipfileset src="${dep.winregistry}" includes="**/*.class"/> |
148 |
<!-- iText needs some org.bouncycastle.cms classes but some other classes in this |
149 |
package reference javax.mail which we don't want to include as well (so that |
150 |
ProGuard can resolve them). Solution: only include part of the smime package --> |
151 |
<zipfileset src="${dep.bouncycastle.smime}" includes="org/bouncycastle/cms/**"/> |
152 |
</jar> |
153 |
<!-- minimize jar file; skipnonpubliclibraryclasses needed for java1.6 --> |
154 |
<proguard obfuscate="false" skipnonpubliclibraryclasses="false"> |
155 |
<injar file="${dir.dist}/${target.name}.large.jar"/> |
156 |
<outjar file="${dir.dist}/${target.name}.jar"/> |
157 |
<libraryjar file="${java.home}/lib/rt.jar"/> |
158 |
<libraryjar file="${java.home}/lib/jce.jar"/> |
159 |
<libraryjar file="${java.home}/lib/jsse.jar"/> |
160 |
<libraryjar file="${dep.bouncycastle}"/> |
161 |
<libraryjar file="${dep.junit}"/> |
162 |
<libraryjar file="${dep.abbot}"/> |
163 |
<keepclasseswithmembers access="public"> |
164 |
<method access="public static" type="void" |
165 |
name="main" parameters="java.lang.String[]"/> |
166 |
</keepclasseswithmembers> |
167 |
<!-- logging is dynamically configured --> |
168 |
<keepclasseswithmembers access="public" name="org.xhtmlrenderer.util.XRSimpleLogFormatter"> |
169 |
<method name="*"/> |
170 |
</keepclasseswithmembers> |
171 |
<keepclasseswithmembers access="public" name="org.xhtmlrenderer.util.Configuration"> |
172 |
<method name="*"/> |
173 |
</keepclasseswithmembers> |
174 |
</proguard> |
175 |
<delete file="${dir.dist}/${target.name}.large.jar"/> |
176 |
<!-- sign it, required for java web start --> |
177 |
<signjar keystore="${keystore.file}" jar="${dir.dist}/${target.name}.jar" |
178 |
alias="${keystore.alias}" storepass="${keystore.passwd}"/> |
179 |
<delete file="${keystore.tempfile}" quiet="true"/> |
180 |
<!-- substitute variables in java web start files --> |
181 |
<copy file="${dir.dist}/${target.name}.jnlp.in" tofile="${dir.dist}/${target.name}.jnlp" /> |
182 |
<copy file="${dir.dist}/bcprov.jnlp.in" tofile="${dir.dist}/bcprov.jnlp" /> |
183 |
<replace dir="${dir.dist}"> |
184 |
<include name="${target.name}.jnlp"/> |
185 |
<include name="bcprov.jnlp"/> |
186 |
<replacefilter token="@wwwbase@" value="${wwwbase}"/> |
187 |
<replacefilter token="@main@" value="${target.main}"/> |
188 |
</replace> |
189 |
<!-- copy bouncycastle jar to deployment area --> |
190 |
<copy file="${dep.bouncycastle}" todir="${dir.dist}"/> |
191 |
</target> |
192 |
<target name="jar" depends="dist"/> |
193 |
|
194 |
<!-- |
195 |
- Cleaning target |
196 |
--> |
197 |
<target name="clean"> |
198 |
<delete dir="${dir.build}"/> |
199 |
<delete file="${dir.dist}/${target.name}.jar"/> |
200 |
<delete file="${dir.dist}/${target.name}.jnlp"/> |
201 |
<delete file="${dir.dist}/bcprov.jnlp"/> |
202 |
<basename property="dep.bouncycastle.basename" file="${dep.bouncycastle}"/> |
203 |
<delete file="${dir.dist}/${dep.bouncycastle.basename}"/> |
204 |
<delete file="http://java.sun.com/j2se/1.5.0/docs/api"/> |
205 |
</target> |
206 |
|
207 |
<!-- |
208 |
- extra targets |
209 |
--> |
210 |
<target name="browsertool" depends="compile"> |
211 |
<jar jarfile="${dir.dist}/${browsertool.target.name}.jar"> |
212 |
<manifest> |
213 |
<attribute name="Built-By" value="${user.name}"/> |
214 |
<attribute name="Main-Class" value="${browsertool.target.main}"/> |
215 |
</manifest> |
216 |
<fileset dir="${dir.build}"> |
217 |
<!-- remove non-production files --> |
218 |
<exclude name="**/test*"/> |
219 |
<exclude name="**/*test/**"/> |
220 |
<exclude name="**/*tests/**"/> |
221 |
<exclude name="**/package.html"/> |
222 |
<include name="nl/nikhef/jgridstart/install/**"/> |
223 |
<include name="nl/nikhef/jgridstart/util/**"/> |
224 |
</fileset> |
225 |
<zipfileset src="${dep.cli}" includes="**/*.class"/> |
226 |
<zipfileset src="${dep.winregistry}" includes="**/*.class"/> |
227 |
</jar> |
228 |
<!-- sign it, required for java web start --> |
229 |
<signjar keystore="${keystore.file}" jar="${dir.dist}/${browsertool.name}.jar" |
230 |
alias="${keystore.alias}" storepass="${keystore.passwd}"/> |
231 |
</target> |
232 |
|
233 |
<!-- javadoc with APIviz, needs graphviz >= 2.20 --> |
234 |
<target name="javadoc" depends="compile"> |
235 |
<javadoc |
236 |
destdir="${dir.javadoc}" |
237 |
classpathref="path.dependencies" |
238 |
access="protected" source="${target.jvmversion}" |
239 |
doclet="org.jboss.apiviz.APIviz" docletpath="${dep.apiviz}" additionalparam="-sourceclasspath ${dir.build}"> |
240 |
<sourcefiles> |
241 |
<fileset dir="${dir.src}"> |
242 |
<include name="**/*.java"/> |
243 |
<exclude name="**/*Test.*"/> |
244 |
<exclude name="**/AllTests.*"/> |
245 |
</fileset> |
246 |
</sourcefiles> |
247 |
<link href="http://java.sun.com/j2se/1.5.0/docs/api/"/> |
248 |
<link href="http://bouncycastle.org/docs/docs1.4/"/> |
249 |
<link href="http://bouncycastle.org/docs/mdocs1.4/"/> |
250 |
<link href="http://commons.apache.org/cli/api-1.2/"/> |
251 |
<link href="http://junit.org/junit/javadoc/4.5/"/> |
252 |
<link href="http://abbot.sourceforge.net/doc/api/"/> |
253 |
<link href="https://swingworker.dev.java.net/nonav/javadoc/"/> |
254 |
<link href="http://pigeonholdings.com/projects/flyingsaucer/R8/javadoc/user/"/> |
255 |
<link href="http://www.1t3xt.info/api/"/> |
256 |
<!-- no online javadoc found for WinRegistry --> |
257 |
</javadoc> |
258 |
</target> |
259 |
|
260 |
<!-- test report --> |
261 |
<target name="testreport" depends="compile"> |
262 |
<junit fork="yes" haltonfailure="no"> |
263 |
<test fork="yes" todir="${dir.testreports}" name="nl.nikhef.jgridstart.AllTests"/> |
264 |
<formatter type="xml"/> |
265 |
<classpath refid="path.dependencies"/> |
266 |
<classpath path="${dir.build}"/> |
267 |
</junit> |
268 |
</target> |
269 |
</project> |