Pulled the local principal implementation class out of the name identifier interface...
[java-idp.git] / build.xml
1 <!-- Main build configutaion for Shibboleth java components - Walter Hoehn 06/04/2002 -->
2
3 <project name="Shibboleth" default="dist-IdP" 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         <!-- Configure properties to find Tomcat and access the Manager application -->
26         <property name="tomcat.home" value="/usr/local/tomcat"/>
27         <property name="url" value="http://localhost:8080/manager"/>
28         <property name="username" value="manager"/>
29         <property name="password" value="password"/>
30
31         <!-- Uncomment this for Tomcat Tasks
32         <path id="tomcat.classpath">
33         <fileset dir="${tomcat.home}/server/lib" includes="catalina-ant.jar"/>
34         </path>
35
36         <taskdef name="tomcatStart" classname="org.apache.catalina.ant.StartTask" classpathref="tomcat.classpath"/>
37         <taskdef name="tomcatStop" classname="org.apache.catalina.ant.StopTask" classpathref="tomcat.classpath"/>
38         <taskdef name="tomcatDeploy" classname="org.apache.catalina.ant.DeployTask" classpathref="tomcat.classpath"/>
39         <taskdef name="tomcatUndeploy" classname="org.apache.catalina.ant.UndeployTask" classpathref="tomcat.classpath"/>
40         -->
41         
42     <!-- Construct the CLASSPATH -->
43     <path id="build.path">
44         <pathelement path="${classpath}" />
45         <pathelement location="${build}" />
46         <fileset dir="${endorsed}">
47             <include name="**/*.jar" />
48         </fileset>
49         <fileset dir="${libdir}">
50             <include name="**/*.jar" />
51         </fileset>
52         <fileset dir="${buildlibs}">
53             <include name="**/*.jar" />
54         </fileset>
55     </path>
56
57
58     <!-- Prepare directory structure for project build-->
59     <target name="init">
60     <mkdir dir="${build}" />
61     <mkdir dir="${dist}" />
62     </target>
63
64
65     <!-- This target should be run before checking code into the repository -->
66     <target name="pre-checkin" depends="compile, test-all, clean-all" />
67
68
69     <!-- Compile classes and move them to ${build} -->
70     <target name="compile" depends="init"
71         description="Compile source file, combine with schemas and conf directories">
72         <javac srcdir="${src}" destdir="${build}" includes="**/*.java" debug="on" 
73                 target="1.4" source="1.4">
74             <classpath refid="build.path" />
75         </javac>
76         <copy todir="${build}/schemas">
77             <fileset dir="${src}/schemas"/>
78         </copy>
79         <copy todir="${build}/conf">
80             <fileset dir="${src}/conf"/>
81         </copy>
82     </target>
83     
84     <target name="compile-tests" depends="compile">
85         <javac srcdir="${tests}" destdir="${build}" includes="**/*.java" debug="on">
86             <classpath refid="build.path" />
87         </javac>
88     </target>
89
90
91         <!-- Generate API docs -->
92         <target name="javadocs">
93                 <mkdir dir="${docs}" />
94                 <mkdir dir="${javadocs}" />
95                 <javadoc packagenames='edu.internet2.middleware.*'
96                         sourcepath='${src}' destdir='${javadocs}'
97                         author='true' version='true'
98                         windowtitle='Shibboleth Java API' doctitle='Shibboleth Java API'
99                         bottom='${copyright}'>
100                 <classpath refid="build.path" />
101         </javadoc>
102         </target>
103
104     <!-- Create various product distributions and move them to ${dist} -->
105
106     <target name="dist-all" depends="compile, test-all, package-all, clean-build" />
107         
108     <target name="package-all">
109         <war warfile="${dist}/${distname}.war" webxml="${configroot}/all.xml" basedir="${approot}" update="no" />
110     </target>
111
112     <target name="dist-IdP" depends="compile, test-IdP, package-IdP, clean-build" />
113     <target name="package-IdP">
114         <war warfile="${dist}/${distname}.war" webxml="${configroot}/origin.xml" basedir="${approot}" update="no" />
115     </target>
116         
117     <target name="dist-IdP-SP" depends="compile, package-IdP-SP, clean-build" 
118         description="Build application from source, create shibboleth.war file for IdP and SP"/>
119     <target name="package-IdP-SP" depends="compile"
120         description="Create shibboleth.war file from build output and IdP-SP deployment descriptor">
121         <war warfile="${dist}/${distname}.war" webxml="${configroot}/IdP-SP.xml" basedir="${approot}" update="no" />
122     </target>
123
124     <target name="dist-wayf" depends="compile, package-wayf, clean-build" />
125     <target name="package-wayf">
126         <war warfile="${dist}/${distname}-wayf.war" webxml="${configroot}/wayf.xml" basedir="${approot}" update="no" />
127     </target>
128
129     <!-- Build utilities -->
130     <target name="build-util" depends="compile">
131         <jar jarfile="${distlibs}/shib-util.jar" basedir="${build}" />
132     </target>
133
134     
135     <!-- Cleanup after the build, test, and distribution processes -->
136     <target name="clean" depends="clean-all" />
137     <target name="clean-all" depends="clean-build, clean-dist, clean-test, clean-javadocs, clean-util" />
138     <target name="clean-build">
139         <delete dir="${build}" />
140     </target>
141     <target name="clean-test">
142         <delete>
143             <fileset dir="${root}">
144                 <include name="**/TEST*.txt" />
145             </fileset>
146         </delete>
147     </target>
148     <target name="clean-dist">
149         <delete dir="${dist}" />
150     </target>
151         <target name="clean-javadocs">
152                 <delete dir="${javadocs}" />
153         </target>
154     <target name="clean-util">
155         <delete>
156             <fileset dir="${buildlibs}">
157                 <include name="shib-util.jar" />
158             </fileset>
159         </delete>
160     </target>
161
162     <!-- Run automated tests on compiled code -->
163     <target name="test-all" depends="test-IdP" />
164     <target name="test-IdP" depends="compile-tests">
165         <junit printsummary="no" fork="yes" haltonfailure="yes" haltonerror="yes" dir="${root}">
166                         <jvmarg value="-Djava.endorsed.dirs=${endorsed}" />
167             <classpath refid="build.path" />
168             <formatter type="plain" />
169             <test name="edu.internet2.middleware.shibboleth.aa.arp.ArpTests" />
170                         <test name="edu.internet2.middleware.shibboleth.aa.attrresolv.ResolverTests" />
171         </junit>
172     </target>
173     
174     <!-- Tomcat Management -->
175     <target name="start" description="Start a deployed webapp using Tomcat manager">
176         <tomcatStop url="${url}" username="${username}" password="${password}" path="/${distname}"/>
177     </target>
178
179     <target name="stop" description="Stop a deployed webapp using Tomcat manager">
180         <tomcatStop url="${url}" username="${username}" password="${password}" path="/${distname}"/>
181     </target>
182
183     <target name="deploy" description="Upload and deploy using Tomcat manager">
184         <tomcatDeploy url="${url}" username="${username}" password="${password}" path="/${distname}"
185                 war="file:${basedir}/${dist}/${distname}.war"/>
186     </target>
187
188     <target name="undeploy" description="Undeploy using Tomcat manager">
189         <tomcatUndeploy url="${url}" username="${username}" password="${password}" path="/${distname}"/>
190     </target>
191         
192         <target name="distcopy" description="Copy shibboleth.war to {tomcat.home}/webapps (Tomcat must be stopped first)">
193                 <!-- Deploy war file by copy and delete. Tomcat must not be
194                      running when this occurs. --> 
195                 <copy file="${dist}/${distname}.war" 
196                         tofile="${tomcat.home}/webapps/${distname}.war" 
197                 />
198                 <delete dir="${tomcat.home}/webapps/${distname}" quiet="yes" />
199         </target>
200         
201     
202     <!-- Automated key generation -->
203         <target name="genSecret" depends="compile">
204         <taskdef name="genSecret" classname="edu.internet2.middleware.shibboleth.utils.HandleRepositorySecretGenerator" classpathref="build.path"/>
205                 <genSecret keyStorePath="${appconfig}/handle.jks" keyStorePassword="shibhs" keyStoreKeyAlias="handleKey" keyStoreKeyPassword="shibhs" />
206         </target>
207
208     <target name="genSalt" depends="compile">
209         <taskdef name="genSalt" classname="edu.internet2.middleware.shibboleth.utils.HandleRepositorySecretGenerator" classpathref="build.path"/>
210         <genSalt keyStorePath="${appconfig}/persistent.jks" keyStorePassword="shibhs" keyStoreKeyAlias="handleKey" keyStoreKeyPassword="shibhs" />
211     </target>
212         
213         <target name="exampleCertificate">
214                 <genkey alias="tomcat" storepass="exampleorg"
215                         keystore="${tomcat.home}/conf/example.jks"
216                         keyalg="RSA" validity="365"
217                         dname="cn=shibboleth.example.org, o=example.org, c=US"
218                 />
219         </target>
220 </project>