Added expansion of path macros to src-conf files in extensions.
authorlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Wed, 13 Jul 2005 16:17:26 +0000 (16:17 +0000)
committerlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Wed, 13 Jul 2005 16:17:26 +0000 (16:17 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@1726 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

build.xml
custom/README.txt
custom/extension-build.xml

index c4824d3..471d730 100755 (executable)
--- a/build.xml
+++ b/build.xml
                <!-- 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" duplicate="preserve">
                <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 -->
index d9f6ebf..d1453e4 100644 (file)
@@ -36,7 +36,9 @@ the following directories
        src/ - [Optional] your extension's source
        src-conf/ - [Optional] This directory contains any files which are not java source
                files but still need to be included in the extension jar (and hence be 
-               available on the classpath).  This can include subdirectories.
+               available on the classpath).  This can include subdirectories.  The strings 
+               $IDP_HOME$, $SP_HOME$, and $EXTENSION_NAME$ will be exapanded for all files 
+               in this directory.
        tests/ - [Optional] Your extension's JUnit test case source.
        web/ - [Optional] Any web pages, images, JSPs, etc. that should be included with the war
        build.properties - [REQUIRED] build properties for your extension 
index 2fe339c..3a84017 100644 (file)
@@ -8,13 +8,6 @@
 <project name="Shibboleth-Extensions" default="ext-invoke" basedir=".">
 
     <!-- Loops through all the extension directories and executes a particular operation on them -->
-    <!-- 
-        Required parameters
-            exts.dir - the root directory of the extensions (contains all the individual extension directories)
-            ext.build.function - the particular extension build function to invoke, acceptable values
-                   ext-invoke, ext-clean, ext-install-filesystem 
-               (some functions may require additional paramters, see documentation for each function)
-    -->
     <target name="ext-invoke" description="Invoke operation extensions">
         <for keepgoing="true" param="module-path">
             <dirset dir="${exts.dir}">
     </target>
 
     <!-- Builds a single extension, called multiple times by build-exts -->
+    <!--
+           Required Paramter
+               ext.filesystem.home - the path on the filesystem that the extension will be installed
+               ext.home.token - the token that represents the extensions installation point
+       -->
     <target name="ext-build" depends="ext-build-init" description="Builds the extension">
         <echo message="--- Starting to build module ${ext.name} in ${ext.root}" />
 
     </target>
 
     <!-- Jars up the extension -->
-    <target name="ext-package" depends="ext-compile" description="Packages up the extension">
-        <jar jarfile="${ext.dist}/${ext.name}.jar" basedir="${ext.classes}" excludes="${ext.name}.jar" />
+    <!-- 
+        Required parameters
+            exts.dir - the root directory of the extensions (contains all the individual extension directories)
+            ext.build.function - the particular extension build function to invoke, acceptable values
+                   ext-invoke, ext-clean, ext-install-filesystem 
+               (some functions may require additional paramters, see documentation for each function)
+    -->
+    <target name="ext-package" depends="ext-build-init" description="Packages up the extension">
+        <if>
+            <available file="${ext.classes}"/>
+            <then>
+                <replace dir="${ext.classes}" token="${ext.home.token}" value="${ext.filesystem.home}" excludes="*.class"/>
+                <replace dir="${ext.classes}" token="$EXTENSION_NAME$" value="${ext.name}" excludes="*.class"/>
+                <jar jarfile="${ext.dist}/${ext.name}.jar" basedir="${ext.classes}" excludes="${ext.name}.jar" />
+            </then>
+        </if>
     </target>
 
     <!-- Install extension files (configuration, scripts, etc) on to the filesystem -->
                 the various configuration files (those in the extensions 'etc' and 'src-conf' directories)
     -->
     <target name="ext-install-filesystem" depends="ext-build-init" description="Installs extension files on to the filesystem">
-        <echo message="Installing extension ${ext.name} to ${ext.filesystem.home}"/>
-        
+        <echo message="Installing extension ${ext.name} to ${ext.filesystem.home}" />
+
         <!-- Copy anything in the etc directory to the extension's installation point etc directory -->
-               <if>
-                       <available file="${ext.etc}" />
-                       <then>
-                               <if>
-                                       <available file="${ext.filesystem.home}/etc/${ext.name}" />
-                                       <then>
-                                               <echo>--------------------------------------------------------------------------------------</echo>
-                                               <echo>---</echo>
-                                               <echo>---   NOTE:  Existing Shibboleth extension module configuration at ${line.separator}---   ${ext.filesystem.home}/etc/${ext.name} will not be overwritten.</echo>
-                                               <echo>---</echo>
-                                               <echo>--------------------------------------------------------------------------------------</echo>
-                                       </then>
-                                       <else>
-                                               <mkdir dir="${ext.filesystem.home}/etc/${ext.name}" />
-                                               <copy todir="${ext.filesystem.home}/etc/${ext.name}">
-                                                       <fileset dir="${ext.etc}">
-                                                               <include name="*" />
-                                                       </fileset>
-                                               </copy>
-                                               <replace dir="${ext.filesystem.home}/etc/${ext.name}" 
-                                                       token="${ext.home.token}" 
-                                                       value="${ext.filesystem.home}"/>
-                                               <replace dir="${ext.filesystem.home}/etc/${ext.name}" 
-                                                       token="$EXTENSION_NAME$" 
-                                                       value="${ext.name}"/>
-                                       </else>
-                               </if>
-                       </then>
-               </if>
+        <if>
+            <available file="${ext.etc}" />
+            <then>
+                <if>
+                    <available file="${ext.filesystem.home}/etc/${ext.name}" />
+                    <then>
+                        <echo>--------------------------------------------------------------------------------------</echo>
+                        <echo>---</echo>
+                        <echo>---   NOTE:  Existing Shibboleth extension module configuration at ${line.separator}---   ${ext.filesystem.home}/etc/${ext.name} will not be overwritten.</echo>
+                        <echo>---</echo>
+                        <echo>--------------------------------------------------------------------------------------</echo>
+                    </then>
+                    <else>
+                        <mkdir dir="${ext.filesystem.home}/etc/${ext.name}" />
+                        <copy todir="${ext.filesystem.home}/etc/${ext.name}">
+                            <fileset dir="${ext.etc}">
+                                <include name="*" />
+                            </fileset>
+                        </copy>
+                        <replace dir="${ext.filesystem.home}/etc/${ext.name}" token="${ext.home.token}" value="${ext.filesystem.home}" />
+                        <replace dir="${ext.filesystem.home}/etc/${ext.name}" token="$EXTENSION_NAME$" value="${ext.name}" />
+                    </else>
+                </if>
+            </then>
+        </if>
 
         <!-- Copy anything in the bin directory to the extension's installation point bin directory -->
         <if>
                         <include name="*" />
                     </fileset>
                 </copy>
-                <chmod dir="${ext.filesystem.home}/bin" perm="ug+rx" includes="**/*"/>
+                <chmod dir="${ext.filesystem.home}/bin" perm="ug+rx" includes="**/*" />
             </then>
         </if>
 
                 </copy>
             </then>
         </if>
-        
+
         <!-- Copy the extension jar to the extension's installation point lib directory -->
         <if>
-            <available file="${ext.dist}/${ext.name}.jar"/>
+            <available file="${ext.dist}/${ext.name}.jar" />
             <then>
-                <copy file="${ext.dist}/${ext.name}.jar" todir="${ext.filesystem.home}/lib"/>
+                <copy file="${ext.dist}/${ext.name}.jar" todir="${ext.filesystem.home}/lib" />
             </then>
         </if>
     </target>