-<!-- Main build configutaion for Shibboleth java components - Walter Hoehn 06/04/2002 -->
-
-<project name="Shibboleth" default="install" basedir=".">
-
- <!-- Set global properties for this build -->
- <property name="distnameWayf" value="shibboleth-wayf" />
- <property name="root" value="." />
- <property name="src" value="${root}/src/" />
- <property name="tests" value="${root}/tests/" />
- <property name="approot" value="${root}/webApplication/" />
- <property name="appconfig" value="${src}/conf/" />
- <property name="configroot" value="${root}/webAppConfig/" />
- <property name="build" value="${approot}/WEB-INF/classes/" />
- <property name="libdir" value="${approot}/WEB-INF/lib/" />
- <property name="buildlibs" value="${root}/lib/" />
- <property name="endorsed" value="${root}/endorsed/" />
- <property name="distlibs" value="${root}/lib/" />
- <property name="custom" value="${root}/custom/" />
- <property name="custom.libs" value="${custom}/lib"/>
- <property name="custom.webapges" value="${custom}/web"/>
- <property name="dist" value="${root}/dist/" />
- <property name="docs" value="${root}/doc/" />
- <property name="javadocs" value="${docs}/api/" />
-
- <property name="year" value="2002-2005"/>
- <property name="copyright" value="Copyright © ${year} UCAID. All Rights Reserved."/>
-
-
- <!-- antcontrib tasks -->
- <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${buildlibs}/ant-contrib.jar"/>
-
- <!-- Import the tasks for building custom extensions -->
- <import file="${custom}/extension-build.xml"/>
-
- <!-- Construct the CLASSPATH -->
- <path id="build.path">
- <pathelement path="${classpath}" />
- <pathelement location="${build}" />
- <fileset dir="${custom}">
- <include name="**/*.jar" />
- </fileset>
- <fileset dir="${endorsed}">
- <include name="**/*.jar" />
- </fileset>
- <fileset dir="${libdir}">
- <include name="**/*.jar" />
- </fileset>
- <fileset dir="${buildlibs}">
- <include name="**/*.jar" />
- </fileset>
- </path>
-
-
- <!-- Prepare directory structure for project build-->
- <target name="init">
- <mkdir dir="${build}" />
- <mkdir dir="${dist}" />
- <mkdir dir="${custom.libs}"/>
- <mkdir dir="${custom.webapges}"/>
-
- <if>
- <not> <available file="build.properties" /> </not>
- <then>
- <copy file="conf/default.build.properties" tofile="build.properties" />
- </then>
- </if>
-
- <property file="build.properties" />
- </target>
-
-
- <!-- This target should be run before checking code into the repository -->
- <target name="pre-checkin" depends="compile, test-all, clean-all" />
-
-
- <!-- Compile classes and move them to ${build} -->
- <target name="compile" depends="init"
- description="Compile source files">
- <!-- Compile the shib code into the build path -->
- <javac srcdir="${src}" destdir="${build}" includes="**/*.java" debug="on" source="1.4">
- <classpath refid="build.path" />
- </javac>
- <!-- Copy xml schemas to the build path -->
- <copy todir="${build}/schemas">
- <fileset dir="${src}/schemas"/>
- </copy>
-
- <!-- Build extensions -->
- <antcall target="build-exts">
- <param name="exts.dir" value="${custom}"/>
- </antcall>
- </target>
-
-
- <!-- Generate API docs -->
- <target name="javadocs">
- <mkdir dir="${docs}" />
- <mkdir dir="${javadocs}" />
- <javadoc packagenames='edu.internet2.middleware.*'
- sourcepath='${src}' destdir='${javadocs}'
- author='true' version='true'
- windowtitle='Shibboleth Java API' doctitle='Shibboleth Java API'
- bottom='${copyright}'>
- <classpath refid="build.path" />
- </javadoc>
- </target>
-
-
- <!-- Build command-line utilities -->
- <target name="build-util" depends="compile">
- <jar jarfile="${distlibs}/shib-util.jar" basedir="${build}" />
- </target>
-
- <!-- Cleanup after the build, test, and distribution processes -->
- <target name="clean" depends="clean-all" />
- <target name="clean-all" depends="clean-build, clean-dist, clean-test, clean-javadocs, clean-util, clean-ext" />
- <target name="clean-build">
- <delete dir="${build}" />
- <delete dir="${custom.libs}"/>
- <delete dir="${custom.webapges}"/>
- </target>
- <target name="clean-test">
- <delete>
- <fileset dir="${root}">
- <include name="**/TEST*.txt" />
- </fileset>
- </delete>
- </target>
- <target name="clean-dist">
- <delete dir="${dist}" />
- </target>
- <target name="clean-javadocs">
- <delete dir="${javadocs}" />
- </target>
- <target name="clean-util">
- <delete>
- <fileset dir="${buildlibs}">
- <include name="shib-util.jar" />
- </fileset>
- </delete>
- </target>
- <!-- For IDE development, run this target first to delete all
- directories generated by the install process before
- recreating and reinstalling everything. -->
- <target name="clean-install" depends="init"
- description="Delete old configuration and Tomcat webapp directories.">
- <delete dir="${idp.home}" />
- <delete dir="${sp.home}" />
- <delete dir="${tomcat.home}/webapps/${idp.webapp.name}" />
- <delete dir="${tomcat.home}/webapps/${sp.webapp.name}" />
- </target>
-
-
- <!-- Add to the classpath for unit tests -->
- <path id="test.path">
- <path refid="build.path"/>
- <pathelement location="${tests}"/>
- </path>
-
- <!-- Compile classes needed for unit testing -->
- <target name="compile-tests" depends="compile">
- <javac srcdir="${tests}" destdir="${build}" includes="**/*.java" debug="on" source="1.4">
- <classpath refid="build.path" />
- </javac>
- </target>
-
- <!-- Run automated tests on compiled code -->
- <target name="test-all" depends="test-IdP, test-SP" />
-
- <target name="test-IdP" depends="compile-tests">
- <junit printsummary="no" fork="yes" haltonfailure="yes" haltonerror="yes" dir="${root}">
- <jvmarg value="-Djava.endorsed.dirs=${endorsed}" />
- <classpath refid="test.path" />
- <formatter type="plain" />
- <test name="edu.internet2.middleware.shibboleth.aa.arp.ArpTests" />
- <test name="edu.internet2.middleware.shibboleth.aa.attrresolv.ResolverTests" />
- <test name="edu.internet2.middleware.shibboleth.common.CredentialsTests" />
- <test name="edu.internet2.middleware.shibboleth.common.provider.NameMapperTests" />
- <test name="edu.internet2.middleware.shibboleth.common.TrustTests" />
- <test name="edu.internet2.middleware.shibboleth.idp.provider.DNHostNameExtractionTests" />
- <test name="edu.internet2.middleware.shibboleth.metadata.MetadataTests" />
- </junit>
- </target>
-
- <target name="test-SP" depends="compile-tests">
- <junit printsummary="no" fork="yes" haltonfailure="yes" haltonerror="yes" dir="${root}">
- <jvmarg value="-Djava.endorsed.dirs=${endorsed}" />
- <classpath refid="test.path" />
- <formatter type="plain" />
- <test name="edu.internet2.middleware.shibboleth.aap.AAPTests" />
- </junit>
- </target>
-
-
- <!-- Tomcat Management -->
- <target name="setupTomcatTasks">
- <path id="tomcat.classpath">
- <fileset dir="${tomcat.home}/server/lib" includes="catalina-ant.jar"/>
- </path>
-
- <taskdef name="tomcatStart" classname="org.apache.catalina.ant.StartTask" classpathref="tomcat.classpath"/>
- <taskdef name="tomcatStop" classname="org.apache.catalina.ant.StopTask" classpathref="tomcat.classpath"/>
- <taskdef name="tomcatDeploy" classname="org.apache.catalina.ant.DeployTask" classpathref="tomcat.classpath"/>
- <taskdef name="tomcatUndeploy" classname="org.apache.catalina.ant.UndeployTask" classpathref="tomcat.classpath"/>
- </target>
-
- <target name="tomcat.start" depends="setupTomcatTasks" description="Start a deployed webapp using Tomcat manager">
- <tomcatStart url="${tomcat.url}" username="${tomcat.username}" password="${tomcat.password}" path="/${idp.webapp.name}"/>
- </target>
-
- <target name="tomcat.stop" depends="setupTomcatTasks" description="Stop a deployed webapp using Tomcat manager">
- <tomcatStop url="${tomcat.url}" username="${tomcat.username}" password="${tomcat.password}" path="/${idp.webapp.name}"/>
- </target>
-
- <target name="tomcat.deploy" depends="setupTomcatTasks" description="Upload and deploy using Tomcat manager">
- <tomcatDeploy url="${tomcat.url}" username="${tomcat.username}" password="${tomcat.password}" path="/${idp.webapp.name}"
- war="file:${basedir}/${dist}/${idp.webapp.name}.war"/>
- </target>
-
- <target name="tomcat.undeploy" depends="setupTomcatTasks" description="Undeploy using Tomcat manager">
- <tomcatUndeploy url="${tomcat.url}" username="${tomcat.username}" password="${tomcat.password}" path="/${idp.webapp.name}"/>
- </target>