Cleanup.
[java-idp.git] / build.xml
index 3519771..441a0f7 100755 (executable)
--- a/build.xml
+++ b/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>
                </copy>
 
                <!-- Build extensions -->
-               <!--
-               <antcall target="build-exts">
+               <antcall target="ext-invoke">
                        <param name="exts.dir" value="${custom}"/>
+            <param name="ext.build.function" value="ext-build"/>      
                </antcall>
-               -->
        </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">
+
+    <target name="clean-all" depends="clean-build, clean-dist, clean-test, clean-javadocs, clean-util"/>
+       
+    <target name="clean-build">
                <delete dir="${build}" />
                <delete dir="${custom.libs}"/>
                <delete dir="${custom.webapges}"/>
+           <antcall target="ext-invoke">
+               <param name="exts.dir" value="${custom}"/>
+            <param name="ext.build.function" value="ext-clean-build"/>   
+           </antcall>
        </target>
-       <target name="clean-test">
+       
+    <target name="clean-test">
                <delete>
                        <fileset dir="${root}">
                                <include name="**/TEST*.txt" />
                        </fileset>
                </delete>
        </target>
-       <target name="clean-dist">
+       
+    <target name="clean-dist">
                <delete dir="${dist}" />
+        <antcall target="ext-invoke">
+            <param name="exts.dir" value="${custom}"/>
+            <param name="ext.build.function" value="ext-clean-dist"/>   
+        </antcall>   
        </target>
-       <target name="clean-javadocs">
+       
+    <target name="clean-javadocs">
                <delete dir="${javadocs}" />
+        <antcall target="ext-invoke">
+            <param name="exts.dir" value="${custom}"/>
+            <param name="ext.build.function" value="ext-clean-javadocs"/>   
+        </antcall>
        </target>
-       <target name="clean-util">
+       
+    <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">
        <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" />
+                       <classpath>
+                           <fileset dir="${custom.libs}">
+                               <include name="*.jar"/>
+                           </fileset>
+                           <filelist refid="test.path"/>
+                       </classpath>
                        <formatter type="plain" />
                        <test name="edu.internet2.middleware.shibboleth.aa.arp.ArpTests" />
                        <test name="edu.internet2.middleware.shibboleth.aa.attrresolv.ResolverTests" />
        <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" />
+                   <classpath>
+                               <fileset dir="${custom.libs}">
+                                       <include name="*.jar"/>
+                               </fileset>
+                               <filelist refid="test.path"/>
+                       </classpath>
                        <formatter type="plain" />
                        <test name="edu.internet2.middleware.shibboleth.aap.AAPTests" />
                </junit>
 
 
        <!-- Tomcat Management -->
-       <target name="setupTomcatTasks">
+       <target name="setupTomcatTasks" depends="init">
                <path id="tomcat.classpath">
                        <fileset dir="${tomcat.home}/server/lib" includes="catalina-ant.jar"/>
                </path>
                <!-- copy values to deployment descriptor -->
                <copy file="${configroot}/${idp.deployment.descriptor}" tofile="${configroot}/idp.xml" overwrite="true" />
                <replace file="${configroot}/idp.xml" token="$IDP_HOME$" value="${idp.home.url}" />
+     
+        <!-- package extensions -->
+        <antcall target="ext-invoke">
+            <param name="exts.dir" value="${custom}"/>
+            <param name="ext.build.function" value="ext-package"/>
+            <param name="ext.filesystem.home" value="${idp.home}"/>
+            <param name="ext.home.token" value="$IDP_HOME$"/>
+        </antcall>
 
                <!-- create the war -->
-               <war warfile="${dist}/${idp.webapp.name}.war" webxml="${configroot}/idp.xml" basedir="${approot}" update="no">
+               <war warfile="${dist}/${idp.webapp.name}.war" webxml="${configroot}/idp.xml" basedir="${approot}" update="no" duplicate="preserve">
                        <!-- Grab any custom extension libraries -->
                        <lib dir="${custom.libs}"/>
 
                <copy file="${configroot}/${sp.deployment.descriptor}" tofile="${configroot}/sp.xml" overwrite="true" />
                <replace file="${configroot}/sp.xml" token="$SP_HOME$" value="${sp.home.url}" />
 
+        <!-- package extensions -->
+        <antcall target="ext-invoke">
+            <param name="exts.dir" value="${custom}"/>
+            <param name="ext.build.function" value="ext-package"/>
+            <param name="ext.filesystem.home" value="${sp.home}"/>
+            <param name="ext.home.token" value="$SP_HOME$"/>
+        </antcall>
+        
                <!-- create the war -->
                <war warfile="${dist}/${sp.webapp.name}.war" webxml="${configroot}/sp.xml" basedir="${approot}" update="no">
                        <!-- Grab any custom extension libraries -->
 
        <!-- Prompt user for filesystem installation options and save them to build.properties -->
        <target name="install.idp.filesystem.prompt" depends="init, install.init">
-               <input message="Select an installation base for the Shibboleth Identity Provider [default: ${idp.home}]"
+               <input message="Select a home directory for the Shibboleth Identity Provider [default: ${idp.home}]"
                        addproperty="idp.home.input" defaultvalue="${idp.home}" />
                <var name="idp.home" value="${idp.home.input}" />
                <input message="Enter tomcat home directory [default: ${tomcat.home}]"
                <if>
                        <available file="${idp.home}/etc" />
                        <then>
-                               <xinput type="confirm" addproperty="copy-idp-conf1">The directory `${idp.home}${file.separator}etc` already exists.  Do you want to overwrite the existing configuration?</xinput>
-                               <if>
-                                       <equals arg1="${copy-idp-conf1}" arg2="y" />
-                                       <then>
-                                               <xinput type="confirm" addproperty="copy-idp-conf">WARNING!!! You are about to delete your Shibboleth IdP configuration.  Are you certain you certain this is what you want?</xinput>
-                                       </then>
-                               </if>
+                               <echo>--------------------------------------------------------------------------------------</echo>
+                               <echo>---</echo>
+                               <echo>---   NOTE:  Existing Identiity Provider configuration at ${idp.home}/etc ${line.separator}---   will not be overwritten.</echo>
+                               <echo>---</echo>
+                               <echo>--------------------------------------------------------------------------------------</echo>
+                               <property name="copy-idp-conf" value="n" />
                        </then>
                        <else>
                                <property name="copy-idp-conf" value="y" />
                        <fileset dir="lib" includesfile="conf/idp-lib.include" />
                </copy>
 
+               <copy todir="${idp.home}/endorsed">
+                       <fileset dir="endorsed" />
+               </copy>
+
                <copy todir="${idp.home}/bin">
                        <fileset dir="bin"/>
                </copy>
                                <antcall target="install.idp.filesystem.config" />
                        </then>
                </if>
+
+        <antcall target="ext-invoke">
+            <param name="exts.dir" value="${custom}"/>
+            <param name="ext.build.function" value="ext-install-filesystem"/>
+            <param name="ext.filesystem.home" value="${idp.home}"/>
+            <param name="ext.home.token" value="$IDP_HOME$"/>
+        </antcall>   
        </target>
 
        <!-- Install Shibboleth SP to filesystem using the properties in build.properties -->
                                <antcall target="install.sp.filesystem.config" />
                        </then>
                </if>
+
+        <antcall target="ext-invoke">
+            <param name="exts.dir" value="${custom}"/>
+            <param name="ext.build.function" value="ext-install-filesystem"/>
+            <param name="ext.filesystem.home" value="${sp.home}"/>
+            <param name="ext.home.token" value="$SP_HOME$"/>
+        </antcall>      
        </target>
 
 
                <input message="Enter tomcat password [default: ${tomcat.password}]" addproperty="tomcat.password.input" defaultValue="${tomcat.password}" />
                <var name="tomcat.password" value="${tomcat.password.input}" />
 
+        <antcall target="package-idp" />
                <antcall target="tomcat.deploy" />
                <antcall target="savePropertyFile" />
        </target>