Synch'd metadata transformation files from /c.
[java-idp.git] / build.xml
1 <!-- Main build configutaion for Shibboleth java components - Walter Hoehn 06/04/2002 -->
2
3 <project name="Shibboleth" default="install" basedir=".">
4
5     <!-- Set global properties for this build -->
6     <property name="distname" value="shibboleth" />
7     <property name="root" value="." />
8     <property name="src" value="${root}/src/" />
9     <property name="tests" value="${root}/tests/" />
10     <property name="approot" value="${root}/webApplication/" />
11     <property name="appconfig" value="${src}/conf/" />
12     <property name="configroot" value="${root}/webAppConfig/" />
13     <property name="build" value="${approot}/WEB-INF/classes/" />
14     <property name="libdir" value="${approot}/WEB-INF/lib/" />
15     <property name="buildlibs" value="${root}/lib/" />
16     <property name="endorsed" value="${root}/endorsed/" />
17     <property name="distlibs" value="${root}/lib/" />
18     <property name="dist" value="${root}/dist/" />
19     <property name="docs" value="${root}/doc/" />
20     <property name="javadocs" value="${docs}/api/" />
21
22     <property name="year" value="2002-2005"/>
23     <property name="copyright" value="Copyright &#169; ${year} UCAID. All Rights Reserved."/>
24         
25     <!-- antcontrib tasks -->
26     <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${buildlibs}/ant-contrib.jar"/>
27         
28     <!-- Construct the CLASSPATH -->
29     <path id="build.path">
30         <pathelement path="${classpath}" />
31         <pathelement location="${build}" />
32         <fileset dir="${endorsed}">
33             <include name="**/*.jar" />
34         </fileset>
35         <fileset dir="${libdir}">
36             <include name="**/*.jar" />
37         </fileset>
38         <fileset dir="${buildlibs}">
39             <include name="**/*.jar" />
40         </fileset>
41     </path>
42
43    <path id="test.path">
44       <path refid="build.path"/>
45       <pathelement location="${tests}"/>
46     </path>
47
48
49     <!-- Prepare directory structure for project build-->
50     <target name="init">
51         <mkdir dir="${build}" />
52         <mkdir dir="${dist}" />
53         <var file="build.properties" />
54     </target>
55
56     <target name="install.init">
57         <taskdef name="xinput" classname="edu.internet2.middleware.shibboleth.utils.ant.XInput" classpath="${build}"/>
58         <typedef name="xoption" classname="edu.internet2.middleware.shibboleth.utils.ant.XInputOption" classpath="${build}"/>
59     </target>
60
61
62     <!-- This target should be run before checking code into the repository -->
63     <target name="pre-checkin" depends="compile, test-all, clean-all" />
64
65
66     <!-- Compile classes and move them to ${build} -->
67     <target name="compile" depends="init"
68         description="Compile source file, combine with schemas and conf directories">
69         <javac srcdir="${src}" destdir="${build}" includes="**/*.java" debug="on" 
70                 target="1.4" source="1.4">
71             <classpath refid="build.path" />
72         </javac>
73         <copy todir="${build}/schemas">
74             <fileset dir="${src}/schemas"/>
75         </copy>
76         <!-- configuration is now stored outside of shibboleth.war
77         <copy todir="${build}/conf">
78             <fileset dir="${src}/conf"/>
79         </copy>
80         -->
81     </target>
82     
83     <target name="compile-tests" depends="compile">
84         <javac srcdir="${tests}" destdir="${build}" includes="**/*.java" debug="on" target="1.4" source="1.4">
85             <classpath refid="build.path" />
86         </javac>
87     </target>
88
89
90         <!-- Generate API docs -->
91         <target name="javadocs">
92                 <mkdir dir="${docs}" />
93                 <mkdir dir="${javadocs}" />
94                 <javadoc packagenames='edu.internet2.middleware.*'
95                         sourcepath='${src}' destdir='${javadocs}'
96                         author='true' version='true'
97                         windowtitle='Shibboleth Java API' doctitle='Shibboleth Java API'
98                         bottom='${copyright}'>
99                 <classpath refid="build.path" />
100         </javadoc>
101         </target>
102
103     <!-- Create various product distributions and move them to ${dist} -->
104
105     <target name="dist-all" depends="compile, test-all, package-all, clean-build" />
106         
107     <target name="package-all">
108         <war warfile="${dist}/${distname}.war" webxml="${configroot}/all.xml" basedir="${approot}" update="no" />
109     </target>
110
111     <target name="dist-IdP-SP" depends="compile, package-IdP-SP, clean-build" 
112         description="Build application from source, create shibboleth.war file for IdP and SP"/>
113     <target name="package-IdP-SP" depends="compile"
114         description="Create shibboleth.war file from build output and IdP-SP deployment descriptor">
115         <war warfile="${dist}/${distname}.war" webxml="${configroot}/IdP-SP.xml" basedir="${approot}" update="no" />
116     </target>
117
118     <target name="dist-wayf" depends="compile, package-wayf, clean-build" />
119     <target name="package-wayf">
120         <war warfile="${dist}/${distname}-wayf.war" webxml="${configroot}/wayf.xml" basedir="${approot}" update="no" />
121     </target>
122
123     <!-- Build utilities -->
124     <target name="build-util" depends="compile">
125         <jar jarfile="${distlibs}/shib-util.jar" basedir="${build}" />
126     </target>
127
128     
129     <!-- Cleanup after the build, test, and distribution processes -->
130     <target name="clean" depends="clean-all" />
131     <target name="clean-all" depends="clean-build, clean-dist, clean-test, clean-javadocs, clean-util" />
132     <target name="clean-build">
133         <delete dir="${build}" />
134     </target>
135     <target name="clean-test">
136         <delete>
137             <fileset dir="${root}">
138                 <include name="**/TEST*.txt" />
139             </fileset>
140         </delete>
141     </target>
142     <target name="clean-dist">
143         <delete dir="${dist}" />
144     </target>
145         <target name="clean-javadocs">
146                 <delete dir="${javadocs}" />
147         </target>
148     <target name="clean-util">
149         <delete>
150             <fileset dir="${buildlibs}">
151                 <include name="shib-util.jar" />
152             </fileset>
153         </delete>
154     </target>
155
156     <!-- Run automated tests on compiled code -->
157     <target name="test-all" depends="test-IdP, test-SP" />
158     <target name="test-IdP" depends="compile-tests">
159         <junit printsummary="no" fork="yes" haltonfailure="yes" haltonerror="yes" dir="${root}">
160                         <jvmarg value="-Djava.endorsed.dirs=${endorsed}" />
161             <classpath refid="test.path" />
162             <formatter type="plain" />
163             <test name="edu.internet2.middleware.shibboleth.aa.arp.ArpTests" />
164                         <test name="edu.internet2.middleware.shibboleth.aa.attrresolv.ResolverTests" />
165                         <test name="edu.internet2.middleware.shibboleth.common.CredentialsTests" />
166                         <test name="edu.internet2.middleware.shibboleth.common.provider.NameMapperTests" />
167                         <test name="edu.internet2.middleware.shibboleth.common.TrustTests" />
168                         <test name="edu.internet2.middleware.shibboleth.idp.provider.DNHostNameExtractionTests" />
169                         <test name="edu.internet2.middleware.shibboleth.metadata.MetadataTests" />
170         </junit>
171     </target>
172     <target name="test-SP" depends="compile-tests">
173         <junit printsummary="no" fork="yes" haltonfailure="yes" haltonerror="yes" dir="${root}">
174                         <jvmarg value="-Djava.endorsed.dirs=${endorsed}" />
175             <classpath refid="test.path" />
176