1<?xml version="1.0"?>
2<project name="Apache Santuario" default="help" basedir=".">
3
4    <!-- G L O B A L    P R O P E R T I E S -->
5    <!-- Product name and version properties -->
6    <property name="product.Name" value="Apache XML Security for Java"/>
7    <property name="product.name" value="xml-security"/>
8    <property name="product.shortname" value="xmlsec"/>
9
10    <property name="product.version.major" value="1"/>
11    <property name="product.version.minor" value="5"/>
12    <property name="product.version.level" value="5"/>
13    <property name='product.version.qualifier' value=''/>
14    <property name="product.version"
15	  value="${product.version.major}.${product.version.minor}.${product.version.level}${product.version.qualifier}"/>
16    <property name="product_version"
17	  value="${product.version.major}_${product.version.minor}_${product.version.level}${product.version.qualifier}"/>
18    <property name="year" value="2000-2013"/>
19    <property name="copyright"
20			  value="Copyright © ${year} Apache XML Project. All Rights Reserved."/>
21
22    <!-- directory properties -->
23    <property name="dir.src"            value="${basedir}/src/main/java" />
24    <property name="dir.src.test"       value="${basedir}/src/test/java" />
25    <property name="dir.src.samples"    value="${basedir}/samples" />
26    <property name="dir.libs"           value="${basedir}/libs" />
27    <property name="dir.build"          value="${basedir}/build" />
28    <property name="dir.build.bin"      value="${dir.build}/classes" />
29    <property name="dir.build.libs"     value="${dir.build}/libs" />
30    <property name="dir.build.test"     value="${dir.build}/test" />
31    <property name="dir.build.samples"  value="${dir.build}/samples" />
32    <property name="dir.build.docs"     value="${dir.build}/docs" />
33    <property name="dir.build.docs.xml" value="${dir.build.docs}/xml" />
34    <property name="dir.build.docs.html" value="${dir.build.docs}/html" />
35    <property name="dir.build.src"      value="${dir.build}/src" />
36    <property name="dir.build.dist"     value="${dir.build}/dist" />
37    <property name="dir.build.srcdist"  value="${dir.build.dist}/src/${product.name}-${product_version}"/>
38    <property name="dir.build.bindist"  value="${dir.build.dist}/bin/${product.name}-${product_version}"/>
39    <property name="dir.build.junit.xml"  value="${dir.build.docs.xml}/junit" />
40    <property name="dir.build.junit.html" value="${dir.build.docs.html}/junit" />
41    <property name="dir.build.javadoc"  value="${dir.build.docs.html}/javadoc" />
42    <property name="dir.build.coverage" value="${dir.build.docs.html}/coverage" />
43    <property name="dir.manifest"       value="${dir.build.bin}/META-INF"/>
44
45    <!-- library properties -->
46    <property name="lib.logging"        value="${dir.libs}/commons-logging-1.1.1.jar" />
47    <property name="lib.log4j"          value="${dir.libs}/log4j-1.2.16.jar" />
48    <property name="lib.xalan.1"        value="${dir.libs}/xalan-2.7.1.jar" />
49    <property name="lib.xalan.2"        value="${dir.libs}/serializer-2.7.1.jar" />
50    <property name="lib.xalan.3"        value="${dir.libs}/xml-apis-1.3.04.jar" />
51    <property name="lib.xerces.1"       value="${dir.libs}/xercesImpl-2.9.1.jar" />
52    <property name="lib.jce"            value="${dir.libs}/${jce.provider.prefix}-${jce.provider.jar}" />
53    <property name="lib.junit"		value="${dir.libs}/junit-4.8.2.jar" />
54    <property name="lib.clover"		value="${dir.libs}/clover.jar" />
55
56    <!-- Apache Santuario libraries (for bin distribution) -->
57    <property name="lib.xmlsec"         value="${dir.libs}/xmlsec-${product.version}.jar" />
58    <property name="lib.xmlsec.samples" value="${dir.libs}/xmlsecSamples-${product.version}.jar"/>
59    <property name="lib.xmlsec.tests"   value="${dir.libs}/xmlsecTests-${product.version}.jar" />
60
61    <!-- JAR properties -->
62    <property name="jar.library"        value="${dir.build}/xmlsec-${product.version}.jar" />
63    <property name="jar.samples"        value="${dir.build}/xmlsecSamples-${product.version}.jar" />
64    <property name="jar.tests"          value="${dir.build}/xmlsecTests-${product.version}.jar" />
65    <property name="jar.manifest"       value="${dir.manifest}/MANIFEST.MF"/>
66
67
68    <!-- build variable properties -->
69
70    <!-- T A S K D E F S -->
71    <taskdef resource="clovertasks"/>
72
73    <!-- C O N D I T I O N A L    P R O P E R T I E S -->
74    <target name="do.build.src" >
75        <!-- global properties applies here -->
76    </target >
77
78    <!-- P A T H S -->
79    <path id="id.classpath.xalan" >
80        <pathelement location="${lib.xalan.1}" />
81        <pathelement location="${lib.xalan.2}" />
82        <pathelement location="${lib.xalan.3}" />
83    </path >
84    <path id="id.classpath.xerces" >
85        <pathelement location="${lib.xerces.1}" />
86    </path >
87    <path id="id.classpath.logging" >
88        <pathelement location="${lib.logging}" />
89        <pathelement location="${lib.log4j}" />
90    </path >
91    <path id="id.classpath.common" >
92        <path refid="id.classpath.xalan" />
93        <path refid="id.classpath.xerces" />
94        <path refid="id.classpath.logging" />
95    </path >
96    <path id="id.classpath.crypt" >
97        <pathelement location="${lib.jce}" />
98    </path >
99    <path id="id.classpath.coverage" >
100    	<pathelement location="${lib.clover}" />
101    </path >
102    <path id="id.classpath.sig" >
103    </path >
104    <path id="id.classpath" >
105        <path refid="id.classpath.common" />
106        <path refid="id.classpath.crypt" />
107        <path refid="id.classpath.sig" />
108        <!--path refid="id.classpath.coverage" /-->
109    </path >
110    <path id="id.classpath.test" >
111        <path refid="id.classpath" />
112        <pathelement path="${lib.junit}"/>
113        <pathelement location="${dir.build.bin}" />
114        <pathelement location="${dir.build.test}" />
115        <path refid="id.classpath.coverage" />
116        <pathelement location="${lib.xmlsec}" />
117        <pathelement location="${lib.xmlsec.samples}" />
118        <pathelement location="${lib.xmlsec.tests}" />
119    </path>
120    <path id="id.classpath.samples" >
121        <path refid="id.classpath" />
122        <pathelement location="${dir.build.bin}" />
123    	<pathelement location="${dir.build.test}" />
124        <pathelement location="${dir.build.samples}" />
125        <pathelement location="${lib.xmlsec}" />
126        <pathelement location="${lib.xmlsec.samples}" />
127        <pathelement location="${lib.xmlsec.tests}" />
128    </path>
129
130    <!-- P A T T E R N S E T S -->
131    <patternset id="id.patternset.distFiles">
132	<include name="build.xml"/>
133	<include name="pom.xml"/>
134	<include name="LICENSE"/>
135	<include name="NOTICE"/>
136    </patternset>
137
138    <patternset id="id.patternset.srcFiles">
139	<include name="src/**/*"/>
140    </patternset>
141
142    <patternset id="id.patternset.sampleFiles">
143	<include name="samples/**/*"/>
144    </patternset>
145
146    <!-- T A R G E T S -->
147
148    <!-- Welcome screen -->
149
150    <target name="init">
151	<echo message=""/>
152	<echo message="-------------------------------------------------------------------"/>
153	<echo message="--------- ${product.Name} v${product.version} [${year}] -----------"/>
154	<echo message="-------------------------------------------------------------------"/>
155	<echo message="Building with ${ant.version}"/>
156	<echo message="Java ${java.version} located at ${java.home} "/>
157	<echo message="-------------------------------------------------------------------"/>
158	<echo message=""/>
159    </target>
160
161    <!-- environment targets -->
162    <!-- set up -->
163    <target name="env.mk.dirs" depends="init" unless="has.dirs" >
164        <mkdir dir="${dir.build}" />
165        <mkdir dir="${dir.build.bin}" />
166        <mkdir dir="${dir.build.docs}" />
167        <mkdir dir="${dir.build.test}" />
168        <mkdir dir="${dir.build.libs}" />
169        <mkdir dir="${dir.build.dist}" />
170        <mkdir dir="${dir.build.samples}" />
171        <property name="has.dirs" value="true" />
172    </target >
173
174    <!-- tear down -->
175    <target depends="init" name="env.rm.dirs" >
176        <delete dir="${dir.build}" />
177    </target >
178
179    <target depends="init" name="env.rm.files" >
180	<delete file="signature.xml"/>
181	<delete file="axisSignature.xml"/>
182	<delete file="encryptedInfo.xml"/>
183	<delete file="decryptedInfo.xml"/>
184	<delete file="kek"/>
185	<delete>
186		<fileset dir="." includes="merlin16*.html,merlins*.xml" />
187	</delete>
188    </target >
189
190    <target depends="init" name="with.clover" >
191    	<clover-setup initstring="clover-db/coverage.db" >
192    		<fileset dir="${dir.src}" >
193	  		<include name="**/*.java" />
194	  		<exclude name="**/*Exception.java" />
195		</fileset >
196     	</clover-setup >
197    </target >
198
199    <!-- check targets -->
200
201    <target name="do.check.bindist">
202	<condition property="is.bin.dist">
203	    <and>
204		<available file="${lib.xmlsec}" />
205		<available file="${lib.xmlsec.samples}" />
206		<available file="${lib.xmlsec.tests}" />
207		<not>
208		    <available type="dir" file="src" />
209		</not>
210	    </and>
211	</condition>
212    </target>
213
214
215    <!-- B U I L D  T A R G E T S -->
216    <property environment="env"/>
217    <!-- source -->
218    <target name="build.src"
219            depends="do.build.src,env.mk.dirs,do.check.bindist"
220			unless="is.bin.dist">
221        <javac target="1.5" source="1.5" srcdir="${dir.src}"
222               destdir="${dir.build.bin}"
223               debug="${build.compile.debug}"
224               includeAntRuntime="yes">
225            <compilerarg value="-XDignore.symbol.file" />
226            <classpath refid="id.classpath" />
227            <include name="**/org/apache/xml/security/**/*.java" />
228            <include name="**/javax/xml/crypto/**/*.java" />
229            <include name="**/org/apache/jcp/xml/dsig/internal/**/*.java" />
230        </javac >
231
232        <copy todir="${dir.build.bin}" >
233            <fileset dir="${dir.src}"
234                     includes="**/org/apache/xml/security/resource/*,
235                               **/org/apache/xml/security/resource/schema/*"/>
236        </copy >
237    </target >
238
239    <!-- tests -->
240    <target name="build.test"
241    		depends="build.src"
242		unless="is.bin.dist">
243    	<javac target="1.5" source="1.5" srcdir="${dir.src.test}"
244               destdir="${dir.build.test}"
245               debug="${build.compile.debug}"
246               includeAntRuntime="false">
247        	<classpath refid="id.classpath.test" />
248        	<include name="**/org/apache/xml/security/**/*.java" />
249        	<include name="**/javax/xml/crypto/**/*.java" />
250        </javac>
251        <copy todir="${dir.build.test}">
252	      	<fileset dir="${dir.src.test}" includes="**/*.properties"/>
253      		<fileset dir="${dir.src.test}" includes="**/*.xml"/>
254      		<fileset dir="${dir.src.test}" includes="**/*.zip"/>
255    	</copy>
256    </target>
257
258    <!-- samples -->
259    <target name="build.samples"
260		depends="build.src"
261		unless="is.bin.dist">
262	<javac target="1.5" source="1.5" srcdir="${dir.src.samples}"
263		destdir="${dir.build.samples}"
264		debug="${build.compile.debug}"
265        includeAntRuntime="false">
266		<classpath refid="id.classpath.samples"/>
267	</javac>
268        <copy todir="${dir.build.samples}/data">
269      		<fileset dir="${dir.src.samples}/data" includes="**/*.xml"/>
270      		<fileset dir="${dir.src.samples}/data" includes="**/*.zip"/>
271    	</copy>
272    </target>
273
274
275	<!-- T E S T  T A R G E T S -->
276	<!-- big test -->
277	<target name="test" depends="build.jar"
278		description="Starts all Junit tests">
279	    <delete dir="${dir.build.junit.xml}"/>
280	    <delete dir="${dir.build.junit.html}"/>
281	    <mkdir dir="${dir.build.junit.xml}"/>
282	    <mkdir dir="${dir.build.junit.html}"/>
283	    <!-- The unit tests include so-called interoperability tests against
284	         cryptographic values generated using software from other vendors.
285	         This package includes many of these vectors, but not the ones from
286	         the IBM alphaWorks XML Security Suite. They are not included because
287	         IBM even has these signatures under copyright.
288	         If you want to test against IBM, download xss4j from
289
290	         http://www.alphaworks.ibm.com/tech/xmlsecuritysuite
291
292	         and put the files into the
293
294	         src/test/resources/com/ibm/xss4j-20030127/
295
296	         directory. If the file enveloped-rsa.sig is found in that directory,
297	         IBM is 'magically' included in the test ;-))
298	    -->
299	    <available file="src/test/resources/com/ibm/xss4j-20030127/enveloped-rsa.sig" property="ibm.available"/>
300	    <junit filtertrace="true" fork="true" printsummary="on"
301		   failureproperty="build.test.failed">
302	        <jvmarg value="-Djava.compiler=NONE"/>
303	        <sysproperty key="basedir" value="${basedir}"/>
304                <sysproperty key="proxyHost" value="${proxy.host}"/>
305                <sysproperty key="proxyPort" value="${proxy.port}"/>
306                <sysproperty key="java.util.logging.config.file"
307			     value="${basedir}/logging.properties"/>
308                <sysproperty key="product.version" value="${product.version}"/>
309	        <classpath refid="id.classpath.test"/>
310	        <formatter type="xml"/>
311	        <!-- Also put output to screen -->
312	        <formatter type="plain" usefile="false"/>
313	        <batchtest fork="yes" todir="${dir.build.junit.xml}">
314	            <fileset dir="${dir.src.test}">
315	                <include name="org/apache/xml/security/**/*Test.java"/>
316	             </fileset>
317	        </batchtest>
318	        <test if="ibm.available" name="org.apache.xml.security.test.interop.IBMTest" todir="${dir.build.junit.xml}"/>
319	    </junit>
320	    <junitreport todir="${dir.build.junit.xml}">
321	        <fileset dir="${dir.build.junit.xml}">
322	            <include name="TEST-*.xml"/>
323	        </fileset>
324	        <report format="frames" todir="${dir.build.junit.html}"/>
325	    </junitreport>
326	    <fail if="build.test.failed" message="Unit Tests Failed"/>
327	</target>
328
329    <!-- Test JSR 105/XML DSig API -->
330    <target name="test_jsr105" depends="build.jar"
331	    description="Runs JSR 105 interop and unit tests">
332        <delete dir="${dir.build.junit.xml}"/>
333        <delete dir="${dir.build.junit.html}"/>
334        <mkdir dir="${dir.build.junit.xml}"/>
335        <mkdir dir="${dir.build.junit.html}"/>
336        <junit filtertrace="true" fork="true" printsummary="on"
337	       failureproperty="build.test.failed">
338            <sysproperty key="basedir" value="${basedir}"/>
339            <sysproperty key="proxyHost" value="${proxy.host}"/>
340	    <sysproperty key="proxyPort" value="${proxy.port}"/>
341	    <sysproperty key="java.util.logging.config.file" value="${basedir}/logging.properties"/>
342            <classpath refid="id.classpath.test"/>
343	    <formatter type="xml"/>
344	    <!-- Also put output to screen -->
345	    <formatter type="plain" usefile="false"/>
346	    <batchtest fork="yes" todir="${dir.build.junit.xml}">
347	        <fileset dir="${dir.src.test}">
348	            <include name="javax/xml/crypto/**/*Test.java"/>
349            </fileset>
350            </batchtest>
351        </junit>
352        <junitreport todir="${dir.build.junit.xml}">
353            <fileset dir="${dir.build.junit.xml}">
354	        <include name="TEST-*.xml"/>
355            </fileset>
356	    <report format="frames" todir="${dir.build.junit.html}"/>
357        </junitreport>
358        <fail if="build.test.failed" message="Unit Tests Failed"/>
359    </target>
360
361    <!-- Run all the tests -->
362    <target name="all-tests" depends="test,test_jsr105"
363	    description="Runs all the test targets">
364    </target>
365
366    <!-- XML Encryption Samples -->
367    <target name="encrypt"
368	    depends="build.samples"
369	    description="encrypts xml data">
370	<delete file="build/encryptedInfo.xml"/>
371	<delete file="build/kek"/>
372	<java classname="org.apache.xml.security.samples.encryption.Encrypter"
373		  failonerror="true"
374		  fork="yes"
375		  taskname="Encrypter">
376		<classpath refid="id.classpath.samples"/>
377	</java>
378    </target>
379
380    <target name="decrypt"
381	    depends="build.samples"
382	    description="decrypts xml data">
383	<delete file="build/decryptedInfo.xml"/>
384	<java classname="org.apache.xml.security.samples.encryption.Decrypter"
385		  failonerror="true"
386		  fork="yes"
387		  taskname="Decrypter">
388		<classpath refid="id.classpath.samples"/>
389	</java>
390    </target>
391
392    <target name="encryptAndDecrypt"
393	    depends="encrypt, decrypt"
394	    description="encrypts and decrypts an element's contents" />
395
396    <!-- Signature Samples -->
397
398    <target name="sign"
399	    depends="build.samples"
400	    description="creates a signature" >
401	<delete file="build/signature.xml"/>
402	<java classname="org.apache.xml.security.samples.signature.CreateSignature"
403		  failonerror="true"
404		  fork="yes"
405		  taskname="CreateSignature">
406		<classpath refid="id.classpath.samples"/>
407	</java>
408    </target>
409
410    <target name="verify"
411	    depends="build.samples"
412	    description="verifies a signature">
413	<java classname="org.apache.xml.security.samples.signature.VerifySignature"
414		  failonerror="true"
415		  fork="yes"
416		  taskname="VerifySignature">
417		<classpath refid="id.classpath.samples"/>
418	</java>
419    </target>
420
421    <target name="signAndVerify"
422	    depends="sign, verify"
423	    description="creates and verifies a signature" />
424
425    <!-- Axis Signature Samples -->
426
427    <target name="axis-sign"
428	    depends="build.samples"
429	    description="axis sign sample">
430	<echo message="Running org.apache.xml.security.samples.AxisSigner"/>
431	<java classname="org.apache.xml.security.samples.AxisSigner"
432		  failonerror="true" fork="yes" taskname="SignAxis">
433		<classpath refid="id.classpath.samples"/>
434	</java>
435    </target>
436
437    <target name="axis-verify"
438	    depends="build.samples"
439	    description="axis verify sample">
440	<echo message="Running org.apache.xml.security.samples.AxisVerifier"/>
441	<java classname="org.apache.xml.security.samples.AxisVerifier"
442		  failonerror="true"
443		  fork="yes"
444		  taskname="VerifyAxis">
445		<classpath refid="id.classpath.samples"/>
446	</java>
447    </target>
448
449    <target depends="axis-sign, axis-verify" name="AxisSignAndVerify"/>
450
451    <!-- Mega Samples -->
452    <target name="mega-sample"
453	    depends="build.samples">
454	<echo message="Now I&apos;ll try to verify merlins example fifteen-HMAC"/>
455	<java classname="org.apache.xml.security.samples.signature.VerifyMerlinsExamplesFifteen"
456		  fork="yes">
457		<classpath refid="id.classpath.samples"/>
458	</java>
459
460	<echo message=""/>
461	<echo message="Now I&apos;ll try to verify merlins example sixteen"/>
462	<java classname="org.apache.xml.security.samples.signature.VerifyMerlinsExamplesSixteen"
463		  fork="yes">
464		<classpath refid="id.classpath.samples"/>
465	</java>
466
467	<echo message=""/>
468	<echo message="Now I&apos;ll try to verify merlins example twenty three"/>
469	<java classname="org.apache.xml.security.samples.signature.VerifyMerlinsExamplesTwentyThree"
470		  fork="yes">
471		<classpath refid="id.classpath.samples"/>
472	</java>
473
474	<echo message=""/>
475	<echo message="Now I&apos;ll create a signature in signature.xml and verify it"/>
476	<java classname="org.apache.xml.security.samples.signature.CreateSignature"
477		  fork="yes">
478		<classpath refid="id.classpath.samples"/>
479	</java>
480	<java classname="org.apache.xml.security.samples.signature.VerifySignature"
481		  fork="yes">
482		<classpath refid="id.classpath.samples"/>
483	</java>
484
485	<echo message=""/>
486	<echo message="Now I&apos;ll create a signature like merlin-16 but without XSLT"/>
487	<java classname="org.apache.xml.security.samples.signature.CreateMerlinsExampleSixteen"
488		  fork="yes">
489		<classpath refid="id.classpath.samples"/>
490	</java>
491
492	<echo message=""/>
493	<echo message="Please look into log.txt, merlinsSixteenRecreated.xml and signature.xml"/>
494
495
496	<echo message=""/>
497	<echo message="Now I&apos;ll create a signature like merlin-23 but without XSLT"/>
498	<java classname="org.apache.xml.security.samples.signature.CreateMerlinsExampleTwentyThree"
499		  fork="yes">
500		<classpath refid="id.classpath.samples"/>
501	</java>
502
503	<echo message=""/>
504	<echo message="Please look into log.txt, merlinsTwentyThreeRecreated.xml and signature.xml"/>
505    </target>
506
507    <target name="createEnvelope"
508	    depends="build.samples">
509	<java classname="org.apache.xml.security.samples.signature.CreateEnvelopingSignature"
510		  fork="yes">
511		<classpath refid="id.classpath.samples"/>
512	</java>
513    </target>
514
515    <!-- JSR 105 Samples -->
516    <target name="jsr105-samples"
517	    depends="build.samples">
518        <echo message="Generating a detached signature"/>
519        <java classname="javax.xml.crypto.dsig.samples.GenDetached"
520	    fork="yes">
521	    <classpath refid="id.classpath.samples"/>
522	    <sysproperty key="proxyHost" value="${proxy.host}"/>
523	    <sysproperty key="proxyPort" value="${proxy.port}"/>
524	</java>
525	<echo message="Generating an enveloped signature"/>
526	<java classname="javax.xml.crypto.dsig.samples.GenEnveloped"
527	    fork="yes">
528	    <arg value="${dir.src.samples}/javax/xml/crypto/dsig/samples/envelope.xml"/>
529	    <classpath refid="id.classpath.samples"/>
530	</java>
531	<echo message="Generating an enveloping signature"/>
532	<java classname="javax.xml.crypto.dsig.samples.GenEnveloping"
533	    fork="yes">
534	    <classpath refid="id.classpath.samples"/>
535	</java>
536	<echo message="Validating a signature"/>
537	<java classname="javax.xml.crypto.dsig.samples.Validate"
538	    fork="yes">
539	    <arg value="${dir.src.samples}/javax/xml/crypto/dsig/samples/envelopedSignature.xml"/>
540	    <classpath refid="id.classpath.samples"/>
541	</java>
542    </target>
543
544    <!-- D I S T R I B U T I O N  T A R G E T S -->
545    <!-- distribution targets -->
546
547    <target name="build.dist"
548	    depends="build.srcdist,build.bindist" />
549
550    <target name="build.srcdist"
551	description="Creates the source distribution" >
552
553	<mkdir dir="${dir.build.srcdist}"/>
554
555	<copy todir="${dir.build.srcdist}">
556	    <fileset dir=".">
557		<patternset refid="id.patternset.distFiles"/>
558		<patternset refid="id.patternset.srcFiles"/>
559		<patternset refid="id.patternset.sampleFiles"/>
560
561		<include name="ant/**/*"/>
562	    </fileset>
563	</copy>
564
565	<mkdir description="create an empty libs dir"
566	       dir="${dir.build.srcdist}/libs"/>
567
568	<zip basedir="${dir.build.dist}/src"
569	     zipfile="${dir.build}/${product.name}-src-${product_version}.zip"/>
570    </target>
571
572    <target name="build.bindist"
573	    depends="build.src,build.docs"
574	    description="Creates the binary distribution">
575
576	<mkdir dir="${dir.build.bindist}"/>
577
578	<copy todir="${dir.build.bindist}">
579	    <fileset dir=".">
580		<patternset refid="id.patternset.distFiles"/>
581		<patternset refid="id.patternset.srcFiles"/>
582		<patternset refid="id.patternset.sampleFiles"/>
583
584		<include name="ant/**/*"/>
585	    </fileset>
586	</copy>
587
588	<mkdir dir="${dir.build.bindist}/libs"/>
589
590	<copy file="${lib.xerces.1}"
591	      todir="${dir.build.bindist}/libs"/>
592	<copy file="${lib.xalan.1}"
593	      todir="${dir.build.bindist}/libs"/>
594	<copy file="${lib.xalan.2}"
595	      todir="${dir.build.bindist}/libs"/>
596	<copy file="${lib.xalan.3}"
597	      todir="${dir.build.bindist}/libs"/>
598	<copy file="${lib.logging}"
599	      todir="${dir.build.bindist}/libs"/>
600
601	<copy description="copy xmlsec JAR"
602	      file="${jar.library}"
603	      todir="${dir.build.bindist}/libs"/>
604	<copy description="copy xmlsec sample JAR"
605	      file="${jar.samples}"
606	      todir="${dir.build.bindist}/libs"/>
607	<copy description="copy xmlsec test JAR"
608	      file="${jar.tests}"
609	      todir="${dir.build.bindist}/libs"/>
610
611	<mkdir dir="${dir.build.bindist}/doc"/>
612	<mkdir dir="${dir.build.bindist}/doc/Java/api" />
613	<copy todir="${dir.build.bindist}/doc/Java/api">
614	    <fileset dir="${dir.build.docs.html}/javadoc"/>
615	</copy>
616
617	<zip basedir="${dir.build.dist}/bin"
618	     zipfile="${dir.build}/${product.name}-bin-${product_version}.zip"/>
619    </target>
620
621
622    <!-- M I S C E L A N E O U S  T A R G E T S -->
623
624    <!-- documentation -->
625    <target name="build.docs">
626	<mkdir dir="${dir.build.javadoc}"/>
627	<javadoc classpathref="id.classpath"
628		 destdir="${dir.build.javadoc}">
629	    <packageset dir="${dir.src}">
630      		<include name="org/apache/xml/security/**"/>
631      		<include name="javax/xml/crypto/**"/>
632            </packageset>
633            <group title="JSR 105 Packages" packages="javax.xml.crypto*"/>
634            <group title="XMLSec Packages" packages="org.apache.xml.security*"/>
635    	</javadoc>
636    </target>
637
638    <target name="clover.report.html" depends="with.clover">
639	<clover-report>
640      		<current outfile="${dir.build.coverage}"
641      				 title="Apache XML-Security coverage">
642      			<fileset dir="${dir.src}">
643		  		<include name="**/*.java"/>
644		  		<exclude name="**/*Exception.java" />
645			</fileset>
646         		<format type="html"/>
647      		</current>
648   	</clover-report>
649    </target>
650
651    <!-- jars -->
652    <target name="manifest">
653	<tstamp/>
654	<mkdir dir="${dir.manifest}"/>
655	<copy file="${basedir}/LICENSE" tofile="${dir.manifest}/LICENSE.txt"/>
656	<copy file="${basedir}/NOTICE" tofile="${dir.manifest}/NOTICE.txt"/>
657	<manifest file="${jar.manifest}" mode="replace">
658            <attribute name="Built-By" value="${user.name}"/>
659            <section name="${product.shortname}">
660		<attribute name="Implementation-Title"
661                           value="${product.Name}"/>
662		<attribute name="Implementation-Version"
663                           value="${product.version} ${TODAY}"/>
664		<attribute name="Implementation-Vendor"
665                           value="Apache Software Foundation"/>
666            </section>
667        </manifest>
668    </target>
669
670    <target name="jar"
671	    depends="manifest,build.src">
672
673	<!-- Main Library -->
674	<jar basedir="${dir.build.bin}"
675	     excludes="org/apache/xml/security/temp/**"
676	     includes="org/apache/**, javax/xml/crypto/**"
677	     destfile="${jar.library}"
678	     manifest="${jar.manifest}">
679	  <metainf file="${dir.manifest}/*.txt"/>
680	</jar>
681    </target>
682
683    <target name="build.jar"
684	    depends="manifest,build.src,build.test,build.samples">
685
686	<!-- Main Library -->
687	<jar basedir="${dir.build.bin}"
688	     excludes="org/apache/xml/security/temp/**"
689	     includes="org/apache/**, javax/xml/crypto/**"
690	     destfile="${jar.library}"
691	     manifest="${jar.manifest}">
692	  <metainf file="${dir.manifest}/*.txt"/>
693	</jar>
694
695	<!-- Samples -->
696	<jar basedir="${dir.build.samples}"
697	     excludes="org/apache/xml/security/temp/**"
698	     includes="org/apache/**, javax/xml/crypto/**"
699	     destfile="${jar.samples}"
700	     manifest="${jar.manifest}">
701	  <metainf file="${dir.manifest}/*.txt"/>
702	</jar>
703
704	<!-- Tests -->
705	<jar basedir="${dir.build.test}"
706	     excludes="org/apache/xml/security/temp/**"
707	     includes="org/apache/**, javax/xml/crypto/**"
708	     destfile="${jar.tests}"
709	     manifest="${jar.manifest}">
710	  <metainf file="${dir.manifest}/*.txt"/>
711	</jar>
712    </target>
713
714    <target name="build.src.jar"
715	    depends="manifest,build.src">
716
717	<jar basedir="${dir.build.bin}"
718	     excludes="org/apache/xml/security/temp/**"
719	     includes="**/LICENSE, **/NOTICE, org/apache/**, javax/xml/crypto/**, *.txt"
720	     jarfile="${jar.library}"
721	     manifest="${jar.manifest}"/>
722    </target>
723
724    <!-- archive targets -->
725    <target name="build.arch"
726            depends="env.mk.dirs" >
727    </target >
728
729    <!-- aliases -->
730    <target name="build.all"        depends="env.mk.dirs,build.src,build.docs,build.test,build.samples,build.jar,build.arch" />
731
732    <target name="compile"          depends="build.src" />
733    <target name="docs"             depends="build.docs" />
734    <target name="javadoc"          depends="build.docs" />
735    <target name="dist"             depends="build.dist" />
736    <target name="clean"            depends="env.rm.dirs,env.rm.files"/>
737    <target name="gump"		    depends="clean, docs, jar, test"/>
738    <target name="clover"	    depends="clean, with.clover, test, clover.report.html" />
739
740    <!-- maintenance targets -->
741
742    <!-- help targets -->
743    <target depends="init" name="help" >
744        <echo message="synopsis: ant [target]" />
745        <echo message="targets:" />
746        <echo message="compile  - builds xml-security source" />
747        <echo message="docs     - creates java documentation" />
748        <echo message="jar      - creates a jar file, containing the built source" />
749        <echo message="dist     - creates a distribution" />
750        <echo message="           (see ant help.dist for more information)" />
751        <echo message="clean    - resets the build environment" />
752        <echo message="test     - performs a series of tests" />
753        <echo message="           (see ant help.test for more information)" />
754        <echo message="help     - displays this help message (default)" />
755        <echo message=""/>
756        <echo message="See also help.samples for help on building samples"/>
757    </target >
758    <target depends="init" name="help.dist" >
759        <echo message="dist:" />
760        <echo message="this target will:" />
761        <echo message="1.  build the source files," />
762        <echo message="2.  create the appropriate java documentation," />
763        <echo message="3.  create distribution jars," />
764        <echo message="4.  copy the license, copies source and" />
765        <echo message="5.  creates distribution archives" />
766    </target >
767
768    <target depends="init" name="help.test" >
769        <echo message="test			- runs all unit and interop tests" />
770        <echo message="test_exc_c14n - runs the exclusive c14n tests" />
771        <echo message="test_xenc	- does all encryption related tests" />
772        <echo message="clover		- generates clover coverage reports" />
773    </target >
774
775    <target depends="init" name="help.samples" >
776	<echo message=""/>
777	<echo message="------------- Signature Samples ----------------"/>
778	<echo message=""/>
779	<echo message="sign               - runs CreateSignature sample"/>
780	<echo message="verify             - runs signature verification sample"/>
781	<echo message="signAndVerify      - runs sign and then verify"/>
782	<echo message="axis-sign          - runs axis signing sample"/>
783	<echo message="axis-verify        - runs axis verification sample"/>
784	<echo message="AxisSignAndVerify  - runs axis sign and verify"/>
785	<echo message="createEnvelope     - runs enveloping signature sample"/>
786	<echo message="mega-sample        - runs all big signature samples"/>
787	<echo message=""/>
788	<echo message="------------- Encryption Samples ----------------"/>
789	<echo message=""/>
790	<echo message="encrypt            - run encryption sample" />
791	<echo message="decrypt            - run decryption sample" />
792	<echo message="encryptAndDecrypt  - run encryption sample" />
793    </target>
794
795</project>
796