[36525] | 1 | <?xml version="1.0"?>
|
---|
| 2 | <project name="gs3-webswing-ext" default="usage" basedir=".">
|
---|
| 3 |
|
---|
| 4 | <!-- ============ classpath =================== -->
|
---|
| 5 | <path id="project.classpath">
|
---|
| 6 | <fileset dir="../../lib/java">
|
---|
| 7 | <include name="**/*.jar"/>
|
---|
| 8 | </fileset>
|
---|
| 9 | </path>
|
---|
| 10 |
|
---|
| 11 | <!-- ============ self defined tasks =================== -->
|
---|
| 12 | <taskdef name="mysetproxy" classname="org.greenstone.anttasks.MySetProxy" classpathref="project.classpath"/>
|
---|
| 13 | <taskdef name="getuserandpassword" classname="org.greenstone.anttasks.MyGetUserAndPassword" classpathref="project.classpath"/>
|
---|
| 14 | <taskdef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
|
---|
| 15 | <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
|
---|
| 16 | <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask" classpathref="project.classpath"/>
|
---|
| 17 | <taskdef name="foreach" classname="net.sf.antcontrib.logic.ForEach" classpathref="project.classpath"/>
|
---|
| 18 | <taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpathref="project.classpath"/>
|
---|
| 19 |
|
---|
[36527] | 20 | <!--
|
---|
| 21 | Perhaps the following (and the above) should bo be moved into a sub-module/sub-projectc so it can be imported
|
---|
| 22 | (<import file="<filename>.xml")
|
---|
| 23 | -->
|
---|
[36525] | 24 |
|
---|
| 25 | <property name="os.linux" value="Linux"/>
|
---|
| 26 | <property name="os.mac" value="Mac OS X"/>
|
---|
| 27 | <property name="os.solaris" value="SunOS"/>
|
---|
| 28 | <property name="os.unix" value="${os.linux},${os.mac},${os.solaris}"/>
|
---|
| 29 | <property name="os.windows" value="Windows 95,Windows 98,Windows 2000,Windows 2003,Windows XP,Windows NT,Windows ME,Windows Vista,Windows 7,Windows Server 2008,Windows Server 2008 R2,Windows 8,Windows 10,Windows 11"/> <!-- check this!!!-->
|
---|
| 30 |
|
---|
[36527] | 31 | <!--
|
---|
[36525] | 32 | <property environment="env"/>
|
---|
[36527] | 33 | -->
|
---|
[36525] | 34 |
|
---|
[36527] | 35 | <!-- Directory Locations -->
|
---|
[36525] | 36 | <!-- http://stackoverflow.com/questions/3136849/how-do-i-convert-a-relative-path-in-ant-to-an-absolute-path
|
---|
| 37 | http://stackoverflow.com/questions/8295860/pathconvert-with-relative-file-names -->
|
---|
| 38 |
|
---|
[36527] | 39 | <!-- greenstone3 paths -->
|
---|
[36584] | 40 | <property name="gsdl3srchome" location="${basedir}/../.."/> <!-- location property creates an absolute path -->
|
---|
| 41 | <property name="web.home" location="${basedir}/../../web"/> <!-- location property creates an absolute path, default if not set with -D argument -->
|
---|
| 42 | <property name="web.writablehome" location="${basedir}/../../web"/> <!-- location property creates an absolute path, default if not set with -D argument -->
|
---|
| 43 | <property name="web.extdir" value="${web.writablehome}/ext/webswing"/>
|
---|
[36527] | 44 |
|
---|
| 45 | <!-- local ext paths -->
|
---|
| 46 | <loadproperties prefix="gs3." srcFile="${basedir}/../../build.properties"/>
|
---|
| 47 | <property name="src.home" value="${basedir}/src"/>
|
---|
| 48 | <property name="dst.home" value="${basedir}/web"/>
|
---|
| 49 | <available property="ext.web.exists" file="${basedir}/web" type="dir" />
|
---|
[36525] | 50 |
|
---|
[36527] | 51 | <property name="etc-config-files" value="catalina-opts-extra.args,webswing.config,webswing.properties"/>
|
---|
| 52 | <property name="etc-config-dirs" value="api,apps,fonts,ssl"/>
|
---|
[36525] | 53 |
|
---|
| 54 | <condition property="tomcat.dir" value="${gs3.tomcat.installed.path}" else="${basedir}/../../packages/tomcat">
|
---|
| 55 | <and>
|
---|
| 56 | <isset property="gs3.tomcat.installed.path"/>
|
---|
| 57 | <not>
|
---|
| 58 | <equals arg1="${gs3.tomcat.installed.path}" arg2=""/>
|
---|
| 59 | </not>
|
---|
| 60 | </and>
|
---|
| 61 | </condition>
|
---|
[36527] | 62 | <condition property="webswing.context" value="${gs3.webswing.context}" else="webswing-server">
|
---|
[36525] | 63 | <and>
|
---|
| 64 | <isset property="gs3.webswing.context"/>
|
---|
| 65 | <not>
|
---|
| 66 | <equals arg1="${gs3.webswing.context}" arg2=""/>
|
---|
| 67 | </not>
|
---|
| 68 | </and>
|
---|
| 69 | </condition>
|
---|
| 70 |
|
---|
| 71 |
|
---|
| 72 | <!-- TARGETS -->
|
---|
| 73 | <target name="usage" description="Print a help message">
|
---|
| 74 | <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
|
---|
| 75 | <echo message=" Execute 'ant -help' for Ant help."/>
|
---|
| 76 | <echo>To install the Webswing extension for Greenstone3, run 'ant add-webapp'.
|
---|
| 77 | To remove the files and folders installed by add-service, run 'ant del-webapp'.
|
---|
| 78 | </echo>
|
---|
| 79 | </target>
|
---|
| 80 |
|
---|
| 81 | <target name="compile" description="Compile up the webswing java classes, war them up, and install webseing-server.war into Greenstone's Tomcats webapps dir">
|
---|
| 82 |
|
---|
| 83 | <exec os="${os.unix}" executable="bash" dir="src" failonerror="true">
|
---|
| 84 | <arg value="-c" />
|
---|
| 85 | <arg value="./COMPILE.sh" />
|
---|
| 86 | </exec>
|
---|
| 87 |
|
---|
| 88 | <echo>Copying src/webswing-20.2.5/webswing-server/webswing-server-war/target/webswing-server.war ${tomcat.dir}/webapps </echo>
|
---|
| 89 | <copy file="src/webswing-20.2.5/webswing-server/webswing-server-war/target/webswing-server.war" todir="${tomcat.dir}/webapps"/>
|
---|
| 90 |
|
---|
| 91 | </target>
|
---|
| 92 |
|
---|
| 93 | <target name="clean" description="Delete the webswing compiled classes">
|
---|
| 94 | <exec os="${os.unix}" executable="./CLEAN.sh" dir="src" failonerror="true" />
|
---|
| 95 | <exec os="${os.windows}" executable=".\\CLEAN.bat" dir="src" failonerror="true" />
|
---|
| 96 | </target>
|
---|
| 97 |
|
---|
| 98 |
|
---|
[36527] | 99 | <target name="install-etc-files">
|
---|
[36525] | 100 |
|
---|
| 101 | <if>
|
---|
| 102 | <bool><not><available file="${web.extdir}" type="dir"/></not></bool>
|
---|
| 103 | <echo>Creating web extension directory: ${web.extdir}</echo>
|
---|
| 104 | <mkdir dir="${web.extdir}"/>
|
---|
| 105 | </if>
|
---|
| 106 | <if>
|
---|
| 107 | <bool><not><available file="${web.extdir}/etc" type="dir"/></not></bool>
|
---|
| 108 | <echo>Creating web extension directory: ${web.extdir}/etc</echo>
|
---|
| 109 | <mkdir dir="${web.extdir}/etc"/>
|
---|
| 110 | </if>
|
---|
| 111 |
|
---|
| 112 | <for param="configFile" list="${etc-config-files}">
|
---|
| 113 | <sequential>
|
---|
[36584] | 114 | <echo message="Installing ${basedir}/web/etc/@{configFile}.in"/>
|
---|
| 115 | <copy file="${basedir}/web/etc/@{configFile}.in" tofile="${web.extdir}/etc/@{configFile}.in" overwrite="true" />
|
---|
[36525] | 116 | </sequential>
|
---|
| 117 | </for>
|
---|
| 118 |
|
---|
[36526] | 119 | <for param="configDir" list="${etc-config-dirs}">
|
---|
| 120 | <sequential>
|
---|
| 121 | <echo/>
|
---|
[36584] | 122 | <echo>Installing directory ${basedir}/web/@{configDir}/ (excluding .svn)</echo>
|
---|
[36526] | 123 | <copy todir="${web.extdir}">
|
---|
| 124 | <fileset dir="${basedir}/web">
|
---|
| 125 | <include name="@{configDir}/**"/>
|
---|
| 126 | <exclude name="**/.svn"/>
|
---|
| 127 | </fileset>
|
---|
[36525] | 128 | </copy>
|
---|
| 129 | </sequential>
|
---|
[36527] | 130 | </for>
|
---|
[36525] | 131 | </target>
|
---|
| 132 |
|
---|
[36527] | 133 | <target name="install-webswing-for-tomcat">
|
---|
| 134 | <echo>Copying ${basedir}/web/webswing-server.war to ${tomcat.dir}/webapps/${webswing.context}.war</echo>
|
---|
[36537] | 135 | <copy file="${basedir}/web/webswing-server.war" tofile="${tomcat.dir}/webapps/${webswing.context}.war" />
|
---|
[36525] | 136 | </target>
|
---|
| 137 |
|
---|
| 138 |
|
---|
| 139 | <target name="add-extension" depends="install-etc-files,install-webswing-for-tomcat"
|
---|
| 140 | description="Run this target to setup the Webswing extension for Greenstone3" />
|
---|
| 141 |
|
---|
| 142 |
|
---|
[36584] | 143 | <target name="configure-extension">
|
---|
| 144 | <for param="configFile" list="${etc-config-files}">
|
---|
| 145 | <sequential>
|
---|
| 146 | <echo message="Configuring ${web.extdir}/etc/@{configFile}"/>
|
---|
| 147 | <copy file="${web.extdir}/etc/@{configFile}.in" tofile="${web.extdir}/etc/@{configFile}" filtering="true" overwrite="true">
|
---|
| 148 | <filterset>
|
---|
| 149 | <filter token="gsdl3srchome" value="${gsdl3srchome}"/>
|
---|
| 150 | </filterset>
|
---|
| 151 | </copy>
|
---|
| 152 | </sequential>
|
---|
| 153 | </for>
|
---|
| 154 | </target>
|
---|
| 155 |
|
---|
[36527] | 156 | <target name="accept-del-extension" unless="delextension.accepted">
|
---|
| 157 | <input addproperty="delextension.ok" validargs="y,n">This will recursively delete all the files in:
|
---|
| 158 | ${web.extdir}
|
---|
| 159 | Do you want to continue [y/n]
|
---|
| 160 | </input>
|
---|
| 161 | <condition property="do.abort-delextension">
|
---|
| 162 | <equals arg1="n" arg2="${delextension.ok}"/>
|
---|
| 163 | </condition>
|
---|
| 164 | <fail if="do.abort-delextension">... Exiting</fail>
|
---|
| 165 | </target>
|
---|
[36525] | 166 |
|
---|
[36527] | 167 | <target name="del-etc-files" description="Helper-target to delete webswing installed files">
|
---|
| 168 | <!-- failonerror is set to false in case some files don't exist
|
---|
| 169 | and can't be deleted therefore -->
|
---|
| 170 | <echo/>
|
---|
| 171 | <echo>Removing 'webswing' from ${web.extdir}</echo>
|
---|
| 172 | <echo>
|
---|
| 173 | delete failonerror="false" includeEmptyDirs="true" dir="${web.extdir}/webswing"
|
---|
| 174 | </echo>
|
---|
[36525] | 175 | </target>
|
---|
| 176 |
|
---|
[36527] | 177 | <target name="del-webswing-for-tomcat" description="Helper-target to remove files for getting webswing to work with tomcat">
|
---|
| 178 | <!-- Actually need to ensure tomcat is not running at this point
|
---|
| 179 | But if webswing-server.war is deleted first, it can't be re-deployed when deleting the webswing folder subsequently
|
---|
| 180 | -->
|
---|
| 181 | <echo/>
|
---|
| 182 | <echo>Removing webswing webapp installed to tomcat</echo>
|
---|
| 183 | <delete failonerror="false" file="${tomcat.dir}/webapps/${webswing.context}.war"/>
|
---|
| 184 | <delete failonerror="false" includeEmptyDirs="true" dir="${tomcat.dir}/webapps/${webswing.context}"/>
|
---|
[36525] | 185 | </target>
|
---|
| 186 |
|
---|
[36527] | 187 | <target name="del-extension" depends="accept-del-extension,del-etc-files,del-webswing-for-tomcat"
|
---|
| 188 | description="Run this target to remove the Webswing extension for Greenstone3" />
|
---|
| 189 |
|
---|
[36525] | 190 | </project>
|
---|