Changeset 36527


Ignore:
Timestamp:
2022-08-28T23:22:17+12:00 (5 weeks ago)
Author:
davidb
Message:

Getting closer to a working version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs3-extensions/webswing/trunk/build.xml

    r36526 r36527  
    1313  <taskdef name="getuserandpassword" classname="org.greenstone.anttasks.MyGetUserAndPassword" classpathref="project.classpath"/>
    1414  <taskdef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
    15   <!--<taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>-->
    1615  <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
    1716  <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask" classpathref="project.classpath"/>
     
    1918  <taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpathref="project.classpath"/>
    2019
    21 
    22   <!-- Perhaps the following needs to be moved into a sub-module/sub-projectc so it can be imported (<import file="....xml") -->
     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  -->
    2324
    2425  <property name="os.linux"   value="Linux"/>
     
    2829  <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!!!-->
    2930
     31  <!--
     32  <property environment="env"/>
     33  -->
     34 
     35  <!-- Directory Locations -->
     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 -->
    3038
    31   <property environment="env"/>
     39  <!-- greenstone3 paths -->
     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 -->
     42  <property name="web.extdir" value="${web.home}/ext/webswing"/>
    3243 
    33   <!-- DIRECTORY LOCATIONS -->
    3444  <!-- local ext paths -->
    3545  <loadproperties prefix="gs3." srcFile="${basedir}/../../build.properties"/>
     
    3848  <available property="ext.web.exists" file="${basedir}/web" type="dir" />
    3949
    40  
    41   <!-- greenstone3 paths -->
    42   <!-- http://stackoverflow.com/questions/3136849/how-do-i-convert-a-relative-path-in-ant-to-an-absolute-path
    43        http://stackoverflow.com/questions/8295860/pathconvert-with-relative-file-names -->
    44 
    45   <property name="gsdl3srchome" location="${basedir}/../.."/> <!-- location property creates an absolute path -->
    46   <property name="web.home" location="${basedir}/../../web"/> <!-- location property creates an absolute path -->
    47   <property name="web.extdir" value="${web.home}/ext/webswing"/>
    48 
     50  <property name="etc-config-files" value="catalina-opts-extra.args,webswing.config,webswing.properties"/>
     51  <property name="etc-config-dirs"  value="api,apps,fonts,ssl"/>
    4952 
    5053  <condition property="tomcat.dir" value="${gs3.tomcat.installed.path}" else="${basedir}/../../packages/tomcat">
     
    5659    </and>
    5760  </condition>
    58   <condition property="webswing.context" value="${gs3.webswing.context}" else="webswing">
     61  <condition property="webswing.context" value="${gs3.webswing.context}" else="webswing-server">
    5962    <and>
    6063      <isset property="gs3.webswing.context"/>
     
    6568  </condition>
    6669
    67   <!--
    68   <condition property="compile.javac.flags" value="${env.JAVACFLAGS}" else="">
    69     <isset property="env.JAVACFLAGS"/>
    70   </condition>
    71   -->
    72 
    73   <!-- FILE LISTINGS.-->
    74   <!-- Created as property elements rather than as filelist elements, since
    75     they can then be reused for the add-service and delete-service targets. -->
    76   <!--
    77   <property name="config-files"
    78     value="${dst.home}/webswing.config
    79        ${dst.home}/webswing.properties"/> 
    80            
    81   -->
    8270 
    8371  <!-- TARGETS -->
     
    10795  </target>
    10896
    109   <property name="etc-config-files" value="catalina-opts-extra.args,webswing.config,webswing.properties"/>
    110   <property name="etc-config-dirs"  value="api,apps,fonts,ssl"/>
    11197 
    112   <target name="install-etc-files" description="Helper-target: copy web/etc config files across for add-extension target">
     98  <target name="install-etc-files">
    11399   
    114     <echo/>
    115     <!--
    116     <echo>Adding to gsdl3 properties area: properties/${property-files}</echo>
    117     <copy todir="${web.classesdir}">
    118           <filelist id="prop-files" dir="properties" files="${property-files}"/>
    119     </copy>
    120     <echo/>
    121     -->
    122 
    123     <!--
    124     <echo>Adding to gsdl3 web jar lib directory: ${basedir}/lib/java's ${jars}</echo>
    125     <copy todir="${web.libdir}">
    126           <filelist id="jar-files" dir="lib/java" files="${jars}"/>
    127     </copy>
    128     -->
    129 
    130 
    131100    <if>
    132101      <bool><not><available file="${web.extdir}" type="dir"/></not></bool>   
     
    162131    </copy>
    163132      </sequential>
    164     </for>
    165    
    166     <!--
    167    
    168     <echo/>
    169     <echo>Adding to gsdl3 web solr ext directory: solr.xml and solr.xml.in</echo>
    170     <copy file="solr.xml.in" tofile="${web.extdir}/solr.xml.in"/>
    171     <pathconvert targetos="unix" property="src.gsdl3.home.unix">
    172       <path path="../../web"/>
    173     </pathconvert>
    174     <filter token="gsdl3home" value="${src.gsdl3.home.unix}"/>
    175     <copy file="solr.xml.in" tofile="${web.extdir}/solr.xml" filtering="true" overwrite="true"/>
    176    
    177     <echo/>
    178     <echo>Adding example solr-jdbm-demo collection to ${localsite.collectdir}</echo>
    179     <copy todir="${localsite.collectdir}/solr-jdbm-demo"
    180           preservelastmodified="true"
    181           failonerror="true" > 
    182       <fileset dir="${basedir}/collect/solr-jdbm-demo" includes="**"/> 
    183     </copy>
    184     <echo>Unzipping pre-built index</echo>
    185     <unzip dest="${localsite.collectdir}/solr-jdbm-demo" src="${localsite.collectdir}/solr-jdbm-demo/index.zip" />
    186 
    187     -->
     133    </for> 
    188134  </target>
    189135
    190   <target name="copy-etc-file">
    191     <echo message="Copying ${theConfigFile} to ${web.extdir}/webswing/etc"/>
    192   </target>
    193 
    194   <!-- Setting up solr to work with tomcat server instead of jetty server -->
    195   <target name="install-webswing-for-tomcat" description="Helper-target: setting up webswing to work with tomcat">
    196    
    197     <!-- slf4j and commons logging bridge needed to avoid exception about incompatibility in tomcat log files-->
    198     <echo>Copying ${basedir}/lib/ext/jcl-over-slf4j-1.6.6.jar again to ${web.libdir}</echo>
    199     <copy todir="${web.libdir}">
    200       <filelist id="logging-bridge" dir="lib/ext" files="jcl-over-slf4j-1.6.6.jar"/>
    201     </copy>
    202    
    203     <echo>Upddating xalan related jar files, morphology and gs3-solrserver jars from ${web.libdir} in solr.war</echo>
    204     <war destfile="webapps/solr.war" update="true" >
    205         <zipfileset dir="lib/russianmorphology" includes="*.jar" prefix="WEB-INF/lib"/>
    206         <zipfileset dir="lib/ext" includes="*.jar" prefix="WEB-INF/lib"/>
    207         <zipfileset dir="${web.libdir}" includes="${shared-xalan-jars}" prefix="WEB-INF/lib"/>
    208         <zipfileset dir="${build.home}" includes="gs3-solrserver.jar" prefix="WEB-INF/lib"/>
    209     </war>   
    210    
    211     <echo>Copying ${basedir}/webapps/solr.war to ${tomcat.dir}/webapps/${solr.context}.war</echo>
    212     <copy file="webapps/solr.war" tofile="${tomcat.dir}/webapps/${solr.context}.war" />
    213    
    214     <echo>Generating solr context file in ${tomcat.context.dir}</echo>
    215    
    216     <!-- we want unix paths (forward slashes) in the tomcat context file -->
    217     <pathconvert targetos="unix" property="gsdl3.web.home">
    218       <path path="${web.home}"/><!-- creates an absolute path-->
    219     </pathconvert>
    220     <pathconvert targetos="unix" property="tomcat.home">
    221       <path path="${tomcat.dir}"/><!-- creates an absolute path-->
    222     </pathconvert>
    223     <filter token="gsdl3webhome" value="${gsdl3.web.home}"/>
    224     <filter token="tomcathome" value="${tomcat.home}"/>
    225     <filter token="solr.context" value="${solr.context}"/>
    226     <copy file="solr-tomcat-context.xml.in" tofile="${tomcat.context.dir}/${solr.context}.xml" filtering="true" overwrite="true"/>
    227 
     136  <target name="install-webswing-for-tomcat">
     137    <echo>Copying ${basedir}/web/webswing-server.war to ${tomcat.dir}/webapps/${webswing.context}.war</echo>
     138    <copy file="${baseir}/web/webswing-server.war" tofile="${tomcat.dir}/webapps/${webswing.context}.war" />   
    228139  </target> 
    229140 
    230   <!-- copy the content of the web folder (avoiding the top-level .svn directory) -->
    231   <!--
    232   <target name="install-solr-web" if="ext.web.exists">
    233     <echo/>
    234     <echo>Copy to gsdl3 web: the content of the ${basedir}/web folder (excluding .svn)</echo>
    235     <copy todir="${web.extdir}">
    236       <dirset dir="${basedir}/web">
    237     <exclude name=".svn"/>
    238       </dirset>
    239     </copy>
    240   </target>
    241 
    242   -->
    243141 
    244142  <target name="add-extension" depends="install-etc-files,install-webswing-for-tomcat"
    245143      description="Run this target to setup the Webswing extension for Greenstone3" />
    246  
    247   <target name="del-extension" depends="del-etc-files,del-webswing-for-tomcat"
    248       description="Run this target to unset the Webswing extension for Greenstone3" />
    249144
    250145
    251   <target name="del-etc-files" description="Helper-target to delete files for del-extension target">
    252     <!-- failonerror is set to false in case some files don't exist
    253     and can't be deleted therefore -->
     146  <target name="accept-del-extension" unless="delextension.accepted">
     147    <input addproperty="delextension.ok" validargs="y,n">This will recursively delete all the files in:
     148    ${web.extdir}
     149Do you want to continue [y/n]
     150    </input>
     151    <condition property="do.abort-delextension">
     152      <equals arg1="n" arg2="${delextension.ok}"/>
     153    </condition>
     154    <fail if="do.abort-delextension">... Exiting</fail>
     155  </target>
    254156
    255     <echo/>
    256 <!--    <echo>Removing from gsdl3 properties area: properties/${property-files}</echo>
    257     <delete failonerror="false">
    258           <filelist dir="${web.classesdir}" files="${property-files}"/>
    259     </delete>
    260 
    261     <echo/>-->
    262     <echo>Removing from gsdl3 web jar lib directory: ${basedir}/lib/java's ${jars} gs3-solr.jar</echo>
    263     <delete failonerror="false">
    264           <filelist dir="${web.libdir}" files="${jars} gs3-solr.jar"/>
    265     </delete>   
    266    
    267     <echo/>
    268     <echo>Removing web solr extension directory: ${web.extdir}</echo>
    269     <delete failonerror="false" includeEmptyDirs="true" dir="${web.extdir}"/>   
    270 
    271     <echo/>
    272     <echo>Removing solr-jdbm-demo collection from: ${localsite.collectdir}</echo>
    273     <delete failonerror="false" includeEmptyDirs="true" dir="${localsite.collectcdir}/solr-jdbm-demo"/>
    274 
     157  <target name="del-etc-files" description="Helper-target to delete webswing installed files">
     158    <!-- failonerror is set to false in case some files don't exist
     159     and can't be deleted therefore -->
     160    <echo/>
     161    <echo>Removing 'webswing' from ${web.extdir}</echo>
     162    <echo>
     163       delete failonerror="false" includeEmptyDirs="true" dir="${web.extdir}/webswing"
     164    </echo>
    275165  </target>
    276166 
    277   <target name="del-webswing-for-tomcat" description="Helper-target to remove files for getting webswing to work with tomcat">
    278 
    279     <echo/>
    280     <echo>Removing solr modifications to tomcat: context file, solr.war and deployed version, jar files</echo>
    281 
    282     <!-- Actually need to ensure tomcat is not running at this point
    283          But if solr.war is deleted first, it can't be re-deployed when deleting the solr folder subsequently
    284       -->
    285     <delete failonerror="false" file="${tomcat.dir}/webapps/${solr.context}.war"/>
    286     <delete failonerror="false" includeEmptyDirs="true" dir="${tomcat.dir}/webapps/${solr.context}"/>
    287 
    288     <delete failonerror="false" file="${tomcat.context.dir}/${solr.context}.xml"/>
    289 
    290     <!-- delete all the jar files in tomcat/lib that were copied from ext/solr/lib/ext
    291          which are all the jar files that are present in both tomcat/lib and ext/solr/lib/ext
    292          https://ant.apache.org/manual/Types/selectors.html#presentselect -->
    293     <delete failonerror="false">     
    294       <fileset dir="${tomcat.lib.dir}" includes="**/*.jar">     
    295         <present present="both" targetdir="lib/ext"/>
    296       </fileset>
    297     </delete>
    298 
    299     <!-- remove logging bridge jar file that was added into greenstone 3 web lib area -->
    300     <delete failonerror="false" file="${web.libdir}/jcl-over-slf4j-1.6.6.jar"/>
    301 
    302     <!--http://stackoverflow.com/questions/2140637/how-do-i-build-a-list-of-file-names-->
     167  <target name="del-webswing-for-tomcat" description="Helper-target to remove files for getting webswing to work with tomcat">   
     168    <!-- Actually need to ensure tomcat is not running at this point
     169     But if webswing-server.war is deleted first, it can't be re-deployed when deleting the webswing folder subsequently
     170    -->   
     171    <echo/>
     172    <echo>Removing webswing webapp installed to tomcat</echo>
     173    <delete failonerror="false" file="${tomcat.dir}/webapps/${webswing.context}.war"/>
     174    <delete failonerror="false" includeEmptyDirs="true" dir="${tomcat.dir}/webapps/${webswing.context}"/>   
    303175  </target>
    304176 
     177  <target name="del-extension" depends="accept-del-extension,del-etc-files,del-webswing-for-tomcat"
     178      description="Run this target to remove the Webswing extension for Greenstone3" />
     179
    305180</project>
Note: See TracChangeset for help on using the changeset viewer.