Fixed eclipse config to work with new XML libs.
[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-origin" 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"/>
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="${libdir}">
47             <include name="**/*.jar" />
48         </fileset>
49         <fileset dir="${buildlibs}">
50             <include name="**/*.jar" />
51         </fileset>
52     </path>
53
54
55     <!-- Prepare directory structure for project build-->
56     <target name="init">
57     <mkdir dir="${build}" />
58     <mkdir dir="${dist}" />
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         <javac srcdir="${src}" destdir="${build}" includes="**/*.java" debug="on">
69             <classpath refid="build.path" />
70         </javac>
71         <copy todir="${build}/schemas">
72             <fileset dir="${src}/schemas"/>
73         </copy>
74         <copy todir="${build}/conf">
75             <fileset dir="${src}/conf"/>
76         </copy>
77     </target>
78     
79     <target name="compile-tests" depends="compile">
80         <javac srcdir="${tests}" destdir="${build}" includes="**/*.java" debug="on">
81             <classpath refid="build.path" />
82         </javac>
83     </target>
84
85
86         <!-- Generate API docs -->
87         <target name="javadocs">
88                 <mkdir dir="${docs}" />
89                 <mkdir dir="${javadocs}" />
90                 <javadoc packagenames='edu.internet2.middleware.*'
91                         sourcepath='${src}' destdir='${javadocs}'
92                         author='true' version='true'
93                         windowtitle='Shibboleth Java API' doctitle='Shibboleth Java API'
94                         bottom='${copyright}'>
95                 <classpath refid="build.path" />
96         </javadoc>
97         </target>
98
99     <!-- Create various product distributions and move them to ${dist} -->
100
101     <target name="dist-all" depends="compile, test-all, package-all, clean-build" />
102     <target name="package-all">
103         <war warfile="${dist}/${distname}.war" webxml="${configroot}/all.xml" basedir="${approot}" update="no" />
104     </target>
105
106     <target name="dist-origin" depends="compile, test-origin, package-origin, clean-build" />
107     <target name="package-origin">
108         <war warfile="${dist}/${distname}.war" webxml="${configroot}/origin.xml" basedir="${approot}" update="no" />
109     </target>
110
111         <!-- Ant target used to test the Java Service Provider.
112              *** You may not agree with these decisions.
113              Tomcat must be stopped during the build.
114              Compile everything, deploy the WAR, and delete the old directory 
115              so the WAR gets expanded when Tomcat restarts.
116              Ant and Eclipse should agree on the Build directory, and the
117              class files should remain in place after deployment. 
118              -->
119     <target name="dist-target" depends="compile, package-target">
120         <copy file="${dist}/${distname}.war" tofile="${tomcat.home}/webapps/${distname}.war" />
121         <delete dir="${tomcat.home}/webapps/${distname}" quiet="yes" />
122     </target>   
123         
124     <target name="package-target">
125         <war warfile="${dist}/${distname}.war" webxml="${configroot}/target.xml" basedir="${approot}" update="no" />
126     </target>
127     <target name="dist-wayf" depends="compile, package-wayf, clean-build" />
128     <target name="package-wayf">
129         <war warfile="${dist}/${distname}-wayf.war" webxml="${configroot}/wayf.xml" basedir="${approot}" update="no" />
130     </target>
131
132     <!-- Build utilities -->
133     <target name="build-util" depends="compile">
134         <jar jarfile="${distlibs}/shib-util.jar" basedir="${build}" />
135     </target>
136
137     
138     <!-- Cleanup after the build, test, and distribution processes -->
139     <target name="clean" depends="clean-all" />
140     <target name="clean-all" depends="clean-build, clean-dist, clean-test, clean-javadocs, clean-util" />
141     <target name="clean-build">
142         <delete dir="${build}" />
143     </target>
144     <target name="clean-test">
145         <delete>
146             <fileset dir="${root}">
147                 <include name="**/TEST*.txt" />
148             </fileset>
149         </delete>
150     </target>
151     <target name="clean-dist">
152         <delete dir="${dist}" />
153     </target>
154         <target name="clean-javadocs">
155                 <delete dir="${javadocs}" />
156         </target>
157     <target name="clean-util">
158         <delete>
159             <fileset dir="${buildlibs}">
160                 <include name="shib-util.jar" />
161             </fileset>
162         </delete>
163     </target>
164
165     <!-- Run automated tests on compiled code -->
166     <target name="test-all" depends="test-origin" />
167     <target name="test-origin" depends="compile-tests">
168         <junit printsummary="no" fork="yes" haltonfailure="yes" haltonerror="yes" dir="${root}">
169                         <jvmarg value="-Djava.endorsed.dirs=${endorsed}" />
170             <classpath refid="build.path" />
171             <formatter type="plain" />
172             <test name="edu.internet2.middleware.shibboleth.aa.arp.ArpTests" />
173                         <test name="edu.internet2.middleware.shibboleth.aa.attrresolv.ResolverTests" />
174         </junit>
175     </target>
176     
177     <!-- Tomcat Management -->
178     <target name="start" description="Start a deployed webapp using Tomcat manager">
179         <tomcatStop url="${url}" username="${username}" password="${password}" path="/${distname}"/>
180     </target>
181
182     <target name="stop" description="Stop a deployed webapp using Tomcat manager">
183         <tomcatStop url="${url}" username="${username}" password="${password}" path="/${distname}"/>
184     </target>
185
186     <target name="deploy" description="Upload and deploy using Tomcat manager">
187         <tomcatDeploy url="${url}" username="${username}" password="${password}" path="/${distname}"
188                 war="file:${basedir}/${dist}/${distname}.war"/>
189     </target>
190
191     <target name="undeploy" description="Undeploy using Tomcat manager">
192         <tomcatUndeploy url="${url}" username="${username}" password="${password}" path="/${distname}"/>
193     </target>
194     
195     <!-- Automated key generation -->
196         <target name="genSecret" depends="compile">
197         <taskdef name="genSecret" classname="edu.internet2.middleware.shibboleth.utils.HandleRepositorySecretGenerator" classpathref="build.path"/>
198                 <genSecret keyStorePath="${appconfig}/handle.jks" keyStorePassword="shibhs" keyStoreKeyAlias="handleKey" keyStoreKeyPassword="shibhs" />
199         </target>
200
201     <target name="genSalt" depends="compile">
202         <taskdef name="genSalt" classname="edu.internet2.middleware.shibboleth.utils.HandleRepositorySecretGenerator" classpathref="build.path"/>
203         <genSalt keyStorePath="${appconfig}/persistent.jks" keyStorePassword="shibhs" keyStoreKeyAlias="handleKey" keyStoreKeyPassword="shibhs" />
204     </target>
205 </project>