<project name="Shibboleth" default="install" basedir=".">
<!-- Set global properties for this build -->
- <property name="distname" value="shibboleth" />
+ <property name="distname" value="shibboleth-idp" />
+ <property name="distnameWayf" value="shibboleth-wayf" />
<property name="root" value="." />
<property name="src" value="${root}/src/" />
<property name="tests" value="${root}/tests/" />
<property name="buildlibs" value="${root}/lib/" />
<property name="endorsed" value="${root}/endorsed/" />
<property name="distlibs" value="${root}/lib/" />
- <property name="customlibs" value="${root}/custom/" />
+ <property name="custom" value="${root}/custom/" />
<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"/>
-
+
+
<!-- Construct the CLASSPATH -->
<path id="build.path">
<pathelement path="${classpath}" />
<pathelement location="${build}" />
- <fileset dir="${customlibs}">
+ <fileset dir="${custom}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${endorsed}">
</fileset>
</path>
- <path id="test.path">
- <path refid="build.path"/>
- <pathelement location="${tests}"/>
- </path>
-
<!-- Prepare directory structure for project build-->
<target name="init">
<property file="build.properties" />
</target>
- <target name="install.init">
- <taskdef name="xinput" classname="edu.internet2.middleware.shibboleth.utils.ant.XInput" classpath="${build}"/>
- <typedef name="xoption" classname="edu.internet2.middleware.shibboleth.utils.ant.XInputOption" classpath="${build}"/>
- </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 file, combine with schemas and conf directories">
+ 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>
+ <!-- Compile site-specific code into the build path -->
+ <javac srcdir="${custom}" 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>
- <!-- configuration is now stored outside of shibboleth.war
- <copy todir="${build}/conf">
- <fileset dir="${src}/conf"/>
+ <!-- Copy any site-specific jars to the build path -->
+ <copy todir="${libdir}">
+ <fileset dir="${custom}" includes="**/*.jar" />
</copy>
- -->
- </target>
-
- <target name="compile-tests" depends="compile">
- <javac srcdir="${tests}" destdir="${build}" includes="**/*.java" debug="on" source="1.4">
- <classpath refid="build.path" />
- </javac>
</target>
</javadoc>
</target>
- <!-- Create various product distributions and move them to ${dist} -->
-
- <target name="dist-all" depends="compile, test-all, package-all, clean-build" />
-
- <target name="package-all">
- <war warfile="${dist}/${distname}.war" webxml="${configroot}/all.xml" basedir="${approot}" update="no" />
- </target>
- <target name="dist-IdP-SP" depends="compile, package-IdP-SP, clean-build"
- description="Build application from source, create shibboleth.war file for IdP and SP"/>
- <target name="package-IdP-SP" depends="compile"
- description="Create shibboleth.war file from build output and IdP-SP deployment descriptor">
- <war warfile="${dist}/${distname}.war" webxml="${configroot}/IdP-SP.xml" basedir="${approot}" update="no" />
- </target>
-
- <target name="dist-wayf" depends="compile, package-wayf, clean-build" />
- <target name="package-wayf">
- <war warfile="${dist}/${distname}-wayf.war" webxml="${configroot}/wayf.xml" basedir="${approot}" update="no" />
- </target>
-
- <!-- Build utilities -->
+ <!-- Build command-line utilities -->
<target name="build-util" depends="compile">
<jar jarfile="${distlibs}/shib-util.jar" basedir="${build}" />
</target>
</delete>
</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}" />
<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}" />
<test name="edu.internet2.middleware.shibboleth.aap.AAPTests" />
</junit>
</target>
-
+
+
<!-- Tomcat Management -->
<target name="setupTomcatTasks">
<path id="tomcat.classpath">
</target>
- <!-- Automated key generation -->
+ <!-- Automated key generation for crypto handles -->
<target name="genSecret" depends="compile">
<taskdef name="genSecret" classname="edu.internet2.middleware.shibboleth.utils.HandleRepositorySecretGenerator" classpathref="build.path"/>
<genSecret keyStorePath="${appconfig}/handle.jks" keyStorePassword="shibhs" keyStoreKeyAlias="handleKey" keyStoreKeyPassword="shibhs" />
</target>
+
+ <!-- Generate salt for use with targetted id -->
<target name="genSalt" depends="compile">
<taskdef name="genSalt" classname="edu.internet2.middleware.shibboleth.utils.HandleRepositorySecretGenerator" classpathref="build.path"/>
<genSalt keyStorePath="${appconfig}/persistent.jks" keyStorePassword="shibhs" keyStoreKeyAlias="handleKey" keyStoreKeyPassword="shibhs" />
dname="cn=shibboleth.example.org, o=example.org, c=US"
/>
</target>
-
-
+
+
<!-- Install Shibboleth -->
+ <target name="install.init">
+ <taskdef name="xinput" classname="edu.internet2.middleware.shibboleth.utils.ant.XInput" classpath="${build}"/>
+ <typedef name="xoption" classname="edu.internet2.middleware.shibboleth.utils.ant.XInputOption" classpath="${build}"/>
+ </target>
+
<target name="install" depends="init, install.init" description="Install Shibboleth">
<if>
<xinput type="confirm" defaultvalue="y">Do you want to install the Shibboleth Identity Provider?</xinput>
<then>
- <input message="What name do you want to use for the web application? [default: ${shib.webapp.name}]"
+ <input message="What name do you want to use for the Identity Provider web application? [default: ${shib.webapp.name}]"
addproperty="shib.webapp.name.input" defaultValue="${shib.webapp.name}" />
<var name="shib.webapp.name" value="${shib.webapp.name.input}" />
</target>
<target name="install.idp" depends="init, install.init">
- <xinput message="Deploying java web application. Do you want to install it directly onto the filesystem or use the tomcat manager application?"
+ <xinput message="Deploying the java web application. Do you want to install it directly onto the filesystem or use the tomcat manager application?"
addproperty="idp.install-type.input" type="menu" casesensitive="no" defaultValue="${idp.install-type}">
<xoption>filesystem</xoption>
<xoption>manager</xoption>
</target>
<target name="install.idp.filesystem" depends="init, install.init, build-util">
- <input message="Enter Shibboleth install directory [default: ${shib.home}]"
+ <input message="Select an installation base for the Shibboleth Identity Provider [default: ${shib.home}]"
addproperty="shib.home.input" defaultvalue="${shib.home}" />
<var name="shib.home" value="${shib.home.input}" />
<copy file="${configroot}/idp.xml.dist" tofile="${configroot}/idp.xml" overwrite="true" />
<replace file="${configroot}/idp.xml" token="$SHIB_HOME$" value="${shib.home}" />
<war warfile="${dist}/${distname}.war" webxml="${configroot}/idp.xml" basedir="${approot}" update="no" />
+ <delete file="${configroot}/idp.xml"/>
<copy file="${dist}/${distname}.war" tofile="${tomcat.home}/webapps/${shib.webapp.name}.war" />
<if>
- <available file="${shib.home}" />
+ <available file="${shib.home}/etc" />
<then>
<if>
<xinput type="confirm">WARNING!! The directory `${shib.home}/etc` already exists. Do you want to overwrite the existing configuration?</xinput>
<copy todir="${shib.home}/bin">
<fileset dir="bin"/>
</copy>
+ <chmod dir="${shib.home}/bin" perm="ug+rx" includes="**/*"/>
- <mkdir dir="${shib.home}/logs />
+ <mkdir dir="${shib.home}/logs" />
<antcall target="savePropertyFile" />
</target>
<copy todir="${shib.home}/etc" overwrite="true">
<fileset dir="${src}/conf" includesfile="conf/idp-conf.include"/>
</copy>
+ <copy file="${shib.home}/etc/idp.xml.dist" tofile="${shib.home}/etc/idp.xml" overwrite="true" />
+ <delete file="${shib.home}/etc/idp.xml.dist"/>
<replace file="${shib.home}/etc/idp.xml" token="$SHIB_HOME$" value="${shib.home}" />
</target>
<entry key="tomcat.password" value="${tomcat.password}" />
</propertyfile>
</target>
+
+
+ <!-- Create an IdP war and copy it to the pre-configured tomcat directory -->
+ <target name="copy-IdP" depends="compile" description="Copy shibboleth.war to {tomcat.home}/webapps (Tomcat must be stopped first)">
+ <!-- This task assumes that a pre-existing properties file has the correct path information -->
+ <copy file="${configroot}/idp.xml.dist" tofile="${configroot}/idp.xml" overwrite="true" />
+ <replace file="${configroot}/idp.xml" token="$SHIB_HOME$" value="${shib.home}" />
+ <war warfile="${dist}/${distname}.war" webxml="${configroot}/idp.xml" basedir="${approot}" update="no" />
+ <copy file="${dist}/${distname}.war" tofile="${tomcat.home}/webapps/${shib.webapp.name}.war" />
+ <delete dir="${tomcat.home}/webapps/${distname}" quiet="yes" />
+ </target>
+
+
+ <!-- Create WAYF and move it to ${dist} -->
+ <target name="package-wayf" depends="compile, clean-build">
+ <war warfile="${dist}/${distnameWayf}.war" webxml="${configroot}/wayf.xml" basedir="${approot}" update="no" />
+ </target>
</project>