1 | <!-- |
---|
2 | Project file for ant to build the crudge viewer. Requires Jung and |
---|
3 | bouncycastle. |
---|
4 | |
---|
5 | Targets: |
---|
6 | all: clean then compile and make docs |
---|
7 | compile: build the library and test programs |
---|
8 | run: run crudge |
---|
9 | jar: build jar file |
---|
10 | signjar: sign jar files for export |
---|
11 | install: copy filed to web host |
---|
12 | doc: greate API javadocs in ./doc |
---|
13 | dev-doc: create developer API javadocs in ./dev-doc (includes |
---|
14 | package/private/protected functions) |
---|
15 | clean: remove created files (includes .der and .pem in this directory) |
---|
16 | --> |
---|
17 | |
---|
18 | <project name="Fedd Axis" default="all"> |
---|
19 | <property name="src.dir" value="${basedir}"/> |
---|
20 | <property name="lib.dir" value="${basedir}${file.separator}jar"/> |
---|
21 | <property name="doc.dir" value="${basedir}${file.separator}doc"/> |
---|
22 | <property name="devdoc.dir" value="${basedir}${file.separator}dev-doc"/> |
---|
23 | <property name="build.dir" value="${basedir}${file.separator}build"/> |
---|
24 | <property name="classes.dir" value="${build.dir}/classes"/> |
---|
25 | <property name="jar.dir" value="${build.dir}${file.separator}jar"/> |
---|
26 | <property name="keystore.file" value="${basedir}${file.separator}keystore"/> |
---|
27 | <property name="wsdl.dir" value="../wsdl"/> |
---|
28 | <property name="cert.pem" value="./cert.pem"/> |
---|
29 | <property name="fedid.pem" value="./fedid.pem"/> |
---|
30 | <property name="topology.file" value="./deter-only.xml"/> |
---|
31 | <property name="version" value="1.0"/> |
---|
32 | <property name="fedd.jar" value="fedd-${version}.jar"/> |
---|
33 | <property name="experiment.name" value="${user.name}-test"/> |
---|
34 | |
---|
35 | <path id="compile.classpath"> |
---|
36 | <fileset dir="${lib.dir}" includes="**/*.jar"/> |
---|
37 | </path> |
---|
38 | |
---|
39 | <path id="run.classpath"> |
---|
40 | <fileset dir="${lib.dir}" includes="**/*.jar"/> |
---|
41 | <fileset dir="${jar.dir}" includes="**/*.jar"/> |
---|
42 | </path> |
---|
43 | |
---|
44 | |
---|
45 | <taskdef resource="axis-tasks.properties" classpathref="compile.classpath" /> |
---|
46 | |
---|
47 | <target name="all" depends="clean,jar" description="Clean then build" /> |
---|
48 | <target name="run" depends="multistatus" description="Run multistatus" /> |
---|
49 | |
---|
50 | <!-- remove all derived and compiled files --> |
---|
51 | <target name="clean" depends="clean-keys"> |
---|
52 | <delete dir="${basedir}${file.separator}edu"/> |
---|
53 | <delete dir="${build.dir}"/> |
---|
54 | <delete dir="${doc.dir}"/> |
---|
55 | <delete dir="${devdoc.dir}"/> |
---|
56 | <delete file="${keystore.file}"/> |
---|
57 | </target> |
---|
58 | |
---|
59 | <!-- just remove command files --> |
---|
60 | <target name="clean-commands" > |
---|
61 | <delete> |
---|
62 | <fileset dir="${classes.dir}" |
---|
63 | includes="**/FeddCommand.class **/Create.class **/MultiStatus.class **/Terminate.class **/MakeFedid.class **/ParseTopdl.class"/> |
---|
64 | </delete> |
---|
65 | </target> |
---|
66 | |
---|
67 | <!-- just remove keystore and ${fedid.pem}--> |
---|
68 | <target name="clean-keys"> |
---|
69 | <delete file="${keystore.file}"/> |
---|
70 | <delete file="${fedid.pem}"/> |
---|
71 | </target> |
---|
72 | |
---|
73 | |
---|
74 | <!-- Check to see if the keystore file exists, if so the keystore.present |
---|
75 | property is created. --> |
---|
76 | <target name="keystore.check"> |
---|
77 | <available property="keystore.present" |
---|
78 | file="${basedir}${file.separator}keystore"/> |
---|
79 | </target> |
---|
80 | |
---|
81 | <!-- Check to see if the ${fedid.pem} file exists, if so the fedid.present |
---|
82 | property is created. --> |
---|
83 | <target name="fedid.check"> |
---|
84 | <available property="fedid.present" |
---|
85 | file="${basedir}${file.separator}${fedid.pem}"/> |
---|
86 | </target> |
---|
87 | |
---|
88 | |
---|
89 | <!-- Convert ${cert.pem} to a fedid in ${fedid.pem} that is, make it a self |
---|
90 | signed-certificate with the same keys. This is only run if ${fedid.pem} |
---|
91 | does not exist --> |
---|
92 | <target name="makefedid" depends="compile,jar,fedid.check" |
---|
93 | unless="fedid.present"> |
---|
94 | <echo message="converting ${cert.pem} to a fedid in ${fedid.pem}"/> |
---|
95 | <java classname="MakeFedid" fork="true" > |
---|
96 | <classpath> |
---|
97 | <path refid="run.classpath"/> |
---|
98 | <pathelement path="${classes.dir}"/> |
---|
99 | </classpath> |
---|
100 | <arg file="${cert.pem}"/> |
---|
101 | <arg file="${fedid.pem}"/> |
---|
102 | <arg value="${user.name}"/> |
---|
103 | </java> |
---|
104 | </target> |
---|
105 | |
---|
106 | <!-- Convert ${fedid.pem} to a java keystore. Makes use of the ImportKey |
---|
107 | program available from http://www.agentbob.info/agentbob/79-AB.html . |
---|
108 | That web page describes this process in detail. --> |
---|
109 | <target name="keys" depends="keystore.check,makefedid" |
---|
110 | unless="keystore.present" > |
---|
111 | <echo message="Importing key ${fedid.pem}"/> |
---|
112 | <!-- splitkey.pl splits a combo certificate file (both key and cert) into a |
---|
113 | key.pem and cert.pem file for ImportKey --> |
---|
114 | <exec executable="/usr/bin/perl"> |
---|
115 | <arg value="./splitkey.pl"/> |
---|
116 | <arg file="${fedid.pem}"/> |
---|
117 | </exec> |
---|
118 | <exec executable="openssl"> |
---|
119 | <arg value="pkcs8"/> |
---|
120 | <arg value="-topk8"/> |
---|
121 | <arg value="-nocrypt"/> |
---|
122 | <arg value="-in"/> |
---|
123 | <arg file="./splitkey.pem"/> |
---|
124 | <arg value="-inform"/> |
---|
125 | <arg value="PEM"/> |
---|
126 | <arg value="-out"/> |
---|
127 | <arg file="./key.der"/> |
---|
128 | <arg value="-outform"/> |
---|
129 | <arg value="DER"/> |
---|
130 | </exec> |
---|
131 | <exec executable="openssl"> |
---|
132 | <arg value="x509"/> |
---|
133 | <arg value="-in"/> |
---|
134 | <arg file="./splitcert.pem"/> |
---|
135 | <arg value="-inform"/> |
---|
136 | <arg value="PEM"/> |
---|
137 | <arg value="-out"/> |
---|
138 | <arg file="./cert.der"/> |
---|
139 | <arg value="-outform"/> |
---|
140 | <arg value="DER"/> |
---|
141 | </exec> |
---|
142 | <java classname="ImportKey" fork="true"> |
---|
143 | <arg file="./key.der"/> |
---|
144 | <arg file="./cert.der"/> |
---|
145 | <arg value="fedd"/> |
---|
146 | </java> |
---|
147 | <move file="${user.home}${file.separator}keystore.ImportKey" |
---|
148 | tofile="${keystore.file}"/> |
---|
149 | <delete> |
---|
150 | <fileset dir="${basedir}" includes="**/splitcert.pem **/splitkey.pem cert.der key.der"/> |
---|
151 | </delete> |
---|
152 | </target> |
---|
153 | |
---|
154 | <!-- Documentation targets --> |
---|
155 | <!-- Generate basic javadoc --> |
---|
156 | <target name="doc" depends="wsdl-parse" |
---|
157 | description="Generate API documentation"> |
---|
158 | <mkdir dir="${doc.dir}"/> |
---|
159 | <javadoc sourcepath="${src.dir}" destdir="${doc.dir}" |
---|
160 | classpathref="compile.classpath" access="public" |
---|
161 | noqualifier="java.lang:java.io:java.util:java.security:java.security.cert"/> |
---|
162 | </target> |
---|
163 | |
---|
164 | <!-- Generate pedentically complete javadoc --> |
---|
165 | <target name="dev-doc" depends="wsdl-parse" |
---|
166 | description="Generate detailed/developer API documentation"> |
---|
167 | <mkdir dir="${devdoc.dir}"/> |
---|
168 | <javadoc sourcepath="${src.dir}" destdir="${devdoc.dir}" |
---|
169 | classpathref="compile.classpath" access="private" |
---|
170 | noqualifier="java.lang:java.io:java.util:java.security:java.security.cert"/> |
---|
171 | </target> |
---|
172 | |
---|
173 | <!-- Check to see if the wsdl-generated directories exist: if so |
---|
174 | the wsdl.available property is set --> |
---|
175 | <target name="wsdl.check"> |
---|
176 | <available file="${basedir}${file.separator}edu" type="dir" |
---|
177 | property="wsdl.available"/> |
---|
178 | </target> |
---|
179 | |
---|
180 | <!-- Generate wsdl-generated source files if they do not exist. The |
---|
181 | axis-wsdl2java tasks are from axis. --> |
---|
182 | <target name="wsdl-parse" depends="wsdl.check" unless="wsdl.available" > |
---|
183 | <axis-wsdl2java url="${wsdl.dir}${file.separator}fedd.wsdl" |
---|
184 | output="${basedir}" /> |
---|
185 | <axis-wsdl2java url="${wsdl.dir}${file.separator}fedd_internal.wsdl" |
---|
186 | output="${basedir}" /> |
---|
187 | </target> |
---|
188 | |
---|
189 | <!-- check to see if the test classes and are present. If so |
---|
190 | set the compile.done property --> |
---|
191 | <target name="compile.check"> |
---|
192 | <condition property="compile.done"> |
---|
193 | <and> |
---|
194 | <available file="${classes.dir}${file.separator}Create.class"/> |
---|
195 | <available file="${classes.dir}${file.separator}MultiStatus.class"/> |
---|
196 | <available file="${classes.dir}${file.separator}Terminate.class"/> |
---|
197 | <available file="${classes.dir}${file.separator}FeddCommand.class"/> |
---|
198 | <available file="${classes.dir}${file.separator}MakeFedid.class"/> |
---|
199 | <available file="${classes.dir}${file.separator}ParseTopdl.class"/> |
---|
200 | </and> |
---|
201 | </condition> |
---|
202 | </target> |
---|
203 | |
---|
204 | |
---|
205 | <!-- compile the sources into the build directory. Depends on the |
---|
206 | wsdl-generated files being created, and only happens if one if |
---|
207 | one or more of the files checked for by the compile.check target |
---|
208 | is missing. --> |
---|
209 | <target name="compile" depends="wsdl-parse,compile.check" |
---|
210 | unless="compile.done" description="Compile the source"> |
---|
211 | <mkdir dir="${classes.dir}" /> |
---|
212 | <javac srcdir="${src.dir}" destdir="${classes.dir}" |
---|
213 | classpathref="compile.classpath" includeAntRuntime="no"/> |
---|
214 | </target> |
---|
215 | |
---|
216 | <!-- Create the fedd jar file in ${jar.dir} (build/jar) --> |
---|
217 | <target name="jar" depends="compile" description="make fedd jar"> |
---|
218 | <jar destfile="${jar.dir}${file.separator}${fedd.jar}" |
---|
219 | basedir="${classes.dir}" |
---|
220 | excludes="**/Create.class **/MultiStatus.class **/Terminate.class **/FeddCommand.class **/MakeFedid.class **/ParseTopdl.class"/> |
---|
221 | </target> |
---|
222 | |
---|
223 | <!-- Test programs --> |
---|
224 | <target name="multistatus" depends="compile,jar,keys"> |
---|
225 | <java classname="MultiStatus" fork="true" > |
---|
226 | <classpath> |
---|
227 | <path refid="run.classpath"/> |
---|
228 | <pathelement path="${classes.dir}"/> |
---|
229 | </classpath> |
---|
230 | </java> |
---|
231 | </target> |
---|
232 | |
---|
233 | <target name="create" depends="compile,jar,keys"> |
---|
234 | <java classname="Create" fork="true" > |
---|
235 | <classpath> |
---|
236 | <path refid="run.classpath"/> |
---|
237 | <pathelement path="${classes.dir}"/> |
---|
238 | </classpath> |
---|
239 | <arg value="${experiment.name}"/> |
---|
240 | <arg file="${topology.file}"/> |
---|
241 | <arg file="${fedid.pem}"/> |
---|
242 | </java> |
---|
243 | </target> |
---|
244 | |
---|
245 | |
---|
246 | <target name="terminate" depends="compile,jar,keys"> |
---|
247 | <java classname="Terminate" fork="true" > |
---|
248 | <classpath> |
---|
249 | <path refid="run.classpath"/> |
---|
250 | <pathelement path="${classes.dir}"/> |
---|
251 | </classpath> |
---|
252 | <arg value="${experiment.name}"/> |
---|
253 | </java> |
---|
254 | </target> |
---|
255 | |
---|
256 | <target name="terminate-force" depends="compile,jar,keys"> |
---|
257 | <java classname="Terminate" fork="true" > |
---|
258 | <classpath> |
---|
259 | <path refid="run.classpath"/> |
---|
260 | <pathelement path="${classes.dir}"/> |
---|
261 | </classpath> |
---|
262 | <arg value="${experiment.name}"/> |
---|
263 | <arg value="force"/> |
---|
264 | </java> |
---|
265 | </target> |
---|
266 | |
---|
267 | <target name="parse" depends="compile,jar,keys"> |
---|
268 | <java classname="ParseTopdl" fork="true" > |
---|
269 | <classpath> |
---|
270 | <path refid="run.classpath"/> |
---|
271 | <pathelement path="${classes.dir}"/> |
---|
272 | </classpath> |
---|
273 | <arg value="${topology.file}"/> |
---|
274 | </java> |
---|
275 | </target> |
---|
276 | |
---|
277 | <target name="ftopo" depends="compile,jar,keys"> |
---|
278 | <java classname="Ftopo" fork="true" > |
---|
279 | <classpath> |
---|
280 | <path refid="run.classpath"/> |
---|
281 | <pathelement path="${classes.dir}"/> |
---|
282 | </classpath> |
---|
283 | <arg value="${experiment.name}"/> |
---|
284 | </java> |
---|
285 | </target> |
---|
286 | |
---|
287 | </project> |
---|