A few build file cleanups.
[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="distlibs" value="${root}/lib/" />
17     <property name="dist" value="${root}/dist/" />
18     <property name="docs" value="${root}/docs/" />
19     <property name="javadocs" value="${docs}/api/" />
20
21     <property name="year" value="2002"/>
22     <property name="copyright" value="Copyright &#169; ${year} UCAID. All Rights Reserved."/>
23
24
25     <!-- Construct the CLASSPATH -->
26     <path id="build.path">
27         <pathelement path="${classpath}" />
28         <pathelement location="${build}" />
29         <fileset dir="${libdir}">
30             <include name="**/*.jar" />
31         </fileset>
32         <fileset dir="${buildlibs}">
33             <include name="**/*.jar" />
34         </fileset>
35     </path>
36
37
38     <!-- Prepare directory structure for project build-->
39     <target name="init">
40     <mkdir dir="${build}" />
41     <mkdir dir="${dist}" />
42     </target>
43
44
45     <!-- This target should be run before checking code into the repository -->
46     <target name="pre-checkin" depends="compile, test-all, clean-all" />
47
48
49     <!-- Compile classes and move them to ${build} -->
50     <target name="compile" depends="init">
51         <javac srcdir="${src}" destdir="${build}" includes="**/*.java" debug="on">
52             <classpath refid="build.path" />
53         </javac>
54         <copy todir="${build}/schemas">
55             <fileset dir="${src}/schemas"/>
56         </copy>
57         <copy todir="${build}/conf">
58             <fileset dir="${src}/conf"/>
59         </copy>
60     </target>
61     
62     <target name="compile-tests" depends="compile">
63         <javac srcdir="${tests}" destdir="${build}" includes="**/*.java" debug="on">
64             <classpath refid="build.path" />
65         </javac>
66     </target>
67
68
69         <!-- Generate API docs -->
70         <target name="javadocs">
71                 <mkdir dir="${docs}" />
72                 <mkdir dir="${javadocs}" />
73                 <javadoc packagenames='edu.internet2.middleware.*'
74                         sourcepath='${src}' destdir='${javadocs}'
75                         author='true' version='true'
76                         windowtitle='Shibboleth Java API' doctitle='Shibboleth Java API'
77                         bottom='${copyright}'>
78                 <classpath refid="build.path" />
79         </javadoc>
80         </target>
81
82     <!-- Create various product distributions and move them to ${dist} -->
83
84     <target name="dist-all" depends="compile, genSecret, test-all, package-all, clean-build" />
85     <target name="package-all">
86         <war warfile="${dist}/${distname}.war" webxml="${configroot}/all.xml" basedir="${approot}" update="no" />
87     </target>
88
89     <target name="dist-origin" depends="compile, genSecret, test-origin, package-origin, clean-build" />
90     <target name="package-origin">
91         <war warfile="${dist}/${distname}.war" webxml="${configroot}/origin.xml" basedir="${approot}" update="no" />
92     </target>
93     
94     <target name="dist-wayf" depends="compile, package-wayf, clean-build" />
95     <target name="package-wayf">
96         <war warfile="${dist}/${distname}-wayf.war" webxml="${configroot}/wayf.xml" basedir="${approot}" update="no" />
97     </target>
98
99     <!-- Build utilities -->
100     <target name="build-util" depends="compile">
101         <jar jarfile="${distlibs}/shib-util.jar" basedir="${build}" />
102     </target>
103
104     
105     <!-- Cleanup after the build, test, and distribution processes -->
106     <target name="clean" depends="clean-all" />
107     <target name="clean-all" depends="clean-build, clean-dist, clean-test, clean-javadocs, clean-util" />
108     <target name="clean-build">
109         <delete dir="${build}" />
110     </target>
111     <target name="clean-test">
112         <delete>
113             <fileset dir="${root}">
114                 <include name="**/TEST*.txt" />
115             </fileset>
116         </delete>
117     </target>
118     <target name="clean-dist">
119         <delete dir="${dist}" />
120     </target>
121         <target name="clean-javadocs">
122                 <delete dir="${javadocs}" />
123         </target>
124     <target name="clean-util">
125         <delete>
126             <fileset dir="${buildlibs}">
127                 <include name="shib-util.jar" />
128             </fileset>
129         </delete>
130     </target>
131
132     <!-- Run automated tests on compiled code -->
133     <target name="test-all" depends="test-origin" />
134     <target name="test-origin" depends="compile-tests">
135         <junit printsummary="no" fork="yes" haltonfailure="yes" haltonerror="yes" dir="${root}">
136             <classpath refid="build.path" />
137             <formatter type="plain" />
138             <test name="edu.internet2.middleware.shibboleth.aa.arp.ArpTests" />
139         </junit>
140     </target>
141     
142         <target name="genSecret" depends="compile">
143         <taskdef name="genSecret" classname="edu.internet2.middleware.shibboleth.utils.HandleRepositorySecretGenerator" classpathref="build.path"/>
144                 <genSecret keyStorePath="${appconfig}/handle.jks" keyStorePassword="shibhs" keyStoreKeyAlias="handleKey" keyStoreKeyPassword="shibhs" />
145         </target>
146
147 </project>