Renamed sites files to avoid colliding with 1.2, changed providerId to match metadata
[java-idp.git] / build.xml
index 5afba28..256cb9d 100755 (executable)
--- a/build.xml
+++ b/build.xml
@@ -3,7 +3,8 @@
 <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 &#169; ${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>
-    </target>
-    
-    <target name="compile-tests" depends="compile">
-        <javac srcdir="${tests}" destdir="${build}" includes="**/*.java" debug="on" source="1.4">
-            <classpath refid="build.path" />
-        </javac>
+               <!-- Copy any site-specific jars to the build path -->
+               <copy todir="${libdir}">
+               <fileset dir="${custom}" includes="**/*.jar" />
+        </copy>
     </target>
 
 
         </javadoc>
        </target>
 
-    <!-- Create WAYF and move it to ${dist} -->
-    <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>
         <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>
         <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>