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.tcl"/> |
---|
31 | <property name="version" value="1.0"/> |
---|
32 | <property name="fedd.jar" value="fedd-${version}.jar"/> |
---|
33 | |
---|
34 | <path id="compile.classpath"> |
---|
35 | <fileset dir="${lib.dir}" includes="**/*.jar"/> |
---|
36 | </path> |
---|
37 | |
---|
38 | <path id="run.classpath"> |
---|
39 | <fileset dir="${lib.dir}" includes="**/*.jar"/> |
---|
40 | <fileset dir="${jar.dir}" includes="**/*.jar"/> |
---|
41 | </path> |
---|
42 | |
---|
43 | |
---|
44 | <taskdef resource="axis-tasks.properties" classpathref="compile.classpath" /> |
---|
45 | |
---|
46 | <target name="all" depends="clean,jar" description="Clean then build" /> |
---|
47 | <target name="run" depends="multistatus" description="Run multistatus" /> |
---|
48 | |
---|
49 | <!-- remove all derived and compiled files --> |
---|
50 | <target name="clean" depends="clean-keys"> |
---|
51 | <delete dir="${basedir}${file.separator}edu"/> |
---|
52 | <delete dir="${build.dir}"/> |
---|
53 | <delete dir="${doc.dir}"/> |
---|
54 | <delete dir="${devdoc.dir}"/> |
---|
55 | <delete file="${keystore.file}"/> |
---|
56 | </target> |
---|
57 | |
---|
58 | <!-- just remove command files --> |
---|
59 | <target name="clean-commands" > |
---|
60 | <delete> |
---|
61 | <fileset dir="${classes.dir}" |
---|
62 | includes="**/FeddCommand.class **/Create.class **/MultiStatus.class **/Terminate.class **/MakeFedid.class"/> |
---|
63 | </delete> |
---|
64 | </target> |
---|
65 | |
---|
66 | <!-- just remove keystore and ${fedid.pem}--> |
---|
67 | <target name="clean-keys"> |
---|
68 | <delete file="${keystore.file}"/> |
---|
69 | <delete file="${fedid.pem}"/> |
---|
70 | </target> |
---|
71 | |
---|
72 | |
---|
73 | <!-- Check to see if the keystore file exists, if so the keystore.present |
---|
74 | property is created. --> |
---|
75 | <target name="keystore.check"> |
---|
76 | <available property="keystore.present" |
---|
77 | file="${basedir}${file.separator}keystore"/> |
---|
78 | </target> |
---|
79 | |
---|
80 | <!-- Check to see if the ${fedid.pem} file exists, if so the fedid.present |
---|
81 | property is created. --> |
---|
82 | <target name="fedid.check"> |
---|
83 | <available property="fedid.present" |
---|
84 | file="${basedir}${file.separator}${fedid.pem}"/> |
---|
85 | </target> |
---|
86 | |
---|
87 | |
---|
88 | <!-- Convert ${cert.pem} to a fedid in ${fedid.pem} that is, make it a self |
---|
89 | signed-certificate with the same keys. This is only run if ${fedid.pem} |
---|
90 | does not exist --> |
---|
91 | <target name="makefedid" depends="compile,jar,fedid.check" |
---|
92 | unless="fedid.present"> |
---|
93 | <echo message="converting ${cert.pem} to a fedid in ${fedid.pem}"/> |
---|
94 | <java classname="MakeFedid" fork="true" > |
---|
95 | <classpath> |
---|
96 | <path refid="run.classpath"/> |
---|
97 | <pathelement path="${classes.dir}"/> |
---|
98 | </classpath> |
---|
99 | <arg file="${cert.pem}"/> |
---|
100 | <arg file="${fedid.pem}"/> |
---|
101 | <arg value="${user.name}"/> |
---|
102 | </java> |
---|
103 | </target> |
---|
104 | |
---|
105 | <!-- Convert ${fedid.pem} to a java keystore. Makes use of the ImportKey |
---|
106 | program available from http://www.agentbob.info/agentbob/79-AB.html . |
---|
107 | That web page describes this process in detail. --> |
---|
108 | <target name="keys" depends="keystore.check,makefedid" |
---|
109 | unless="keystore.present" > |
---|
110 | <echo message="Importing key ${fedid.pem}"/> |
---|
111 | <!-- splitkey.pl splits a combo certificate file (both key and cert) into a |
---|
112 | key.pem and cert.pem file for ImportKey --> |
---|
113 | <exec executable="/usr/bin/perl"> |
---|
114 | <arg value="./splitkey.pl"/> |
---|
115 | <arg file="${fedid.pem}"/> |
---|
116 | </exec> |
---|
117 | <exec executable="openssl"> |
---|
118 | <arg value="pkcs8"/> |
---|
119 | <arg value="-topk8"/> |
---|
120 | <arg value="-nocrypt"/> |
---|
121 | <arg value="-in"/> |
---|
122 | <arg file="./key.pem"/> |
---|
123 | <arg value="-inform"/> |
---|
124 | <arg value="PEM"/> |
---|
125 | <arg value="-out"/> |
---|
126 | <arg file="./key.der"/> |
---|
127 | <arg value="-outform"/> |
---|
128 | <arg value="DER"/> |
---|
129 | </exec> |
---|
130 | <exec executable="openssl"> |
---|
131 | <arg value="x509"/> |
---|
132 | <arg value="-in"/> |
---|
133 | <arg file="./cert.pem"/> |
---|
134 | <arg value="-inform"/> |
---|
135 | <arg value="PEM"/> |
---|
136 | <arg value="-out"/> |
---|
137 | <arg file="./cert.der"/> |
---|
138 | <arg value="-outform"/> |
---|
139 | <arg value="DER"/> |
---|
140 | </exec> |
---|
141 | <java classname="ImportKey" fork="true"> |
---|
142 | <arg file="./key.der"/> |
---|
143 | <arg file="./cert.der"/> |
---|
144 | <arg value="fedd"/> |
---|
145 | </java> |
---|
146 | <move file="${user.home}${file.separator}keystore.ImportKey" |
---|
147 | tofile="${keystore.file}"/> |
---|
148 | <delete> |
---|
149 | <fileset dir="${basedir}" includes="**/cert.*"/> |
---|
150 | <fileset dir="${basedir}" includes="**/key.*"/> |
---|
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 | </and> |
---|
200 | </condition> |
---|
201 | </target> |
---|
202 | |
---|
203 | |
---|
204 | <!-- compile the sources into the build directory. Depends on the |
---|
205 | wsdl-generated files being created, and only happens if one if |
---|
206 | one or more of the files checked for by the compile.check target |
---|
207 | is missing. --> |
---|
208 | <target name="compile" depends="wsdl-parse,compile.check" |
---|
209 | unless="compile.done" description="Compile the source"> |
---|
210 | <mkdir dir="${classes.dir}" /> |
---|
211 | <javac srcdir="${src.dir}" destdir="${classes.dir}" |
---|
212 | classpathref="compile.classpath" includeAntRuntime="no"/> |
---|
213 | </target> |
---|
214 | |
---|
215 | <!-- Create the fedd jar file in ${jar.dir} (build/jar) --> |
---|
216 | <target name="jar" depends="compile" description="make fedd jar"> |
---|
217 | <jar destfile="${jar.dir}${file.separator}${fedd.jar}" |
---|
218 | basedir="${classes.dir}" |
---|
219 | excludes="**/Create.class **/MultiStatus.class **/Terminate.class **/FeddCommand.class **/MakeFedid.class"/> |
---|
220 | </target> |
---|
221 | |
---|
222 | <!-- Test programs --> |
---|
223 | <target name="multistatus" depends="compile,jar,keys" |
---|
224 | description="run visualizer"> |
---|
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 | description="run visualizer"> |
---|
235 | <java classname="Create" fork="true" > |
---|
236 | <classpath> |
---|
237 | <path refid="run.classpath"/> |
---|
238 | <pathelement path="${classes.dir}"/> |
---|
239 | </classpath> |
---|
240 | <arg value="${user.name}-test"/> |
---|
241 | <arg file="${topology.file}"/> |
---|
242 | <arg file="${fedid.pem}"/> |
---|
243 | </java> |
---|
244 | </target> |
---|
245 | |
---|
246 | |
---|
247 | <target name="terminate" depends="compile,jar,keys" |
---|
248 | description="run visualizer"> |
---|
249 | <java classname="Terminate" fork="true" > |
---|
250 | <classpath> |
---|
251 | <path refid="run.classpath"/> |
---|
252 | <pathelement path="${classes.dir}"/> |
---|
253 | </classpath> |
---|
254 | <arg value="${user.name}-test"/> |
---|
255 | </java> |
---|
256 | </target> |
---|
257 | |
---|
258 | </project> |
---|