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