root/gs3-extensions/solr/trunk/src/build.xml @ 25900

Revision 25900, 5.0 KB (checked in by ak19, 7 years ago)

Adding an ant build file with add-service and del-service targets for the Solr extension to replace the existing bash scripts ADD-SERVICE.sh and DEL-SERVICE.sh. This bypasses the need for batch scripts that parallel the bash scripts.

Line 
1<?xml version="1.0"?>
2<project name="gs3-solr-ext" default="usage" basedir=".">
3
4  <!-- DIRECTORY LOCATIONS -->
5  <property name="web.home" value="${basedir}/../../web"/>
6  <property name="gsdlsrcdir" value="${basedir}/../../src/java/org/greenstone/gsdl3"/>
7  <property name="ext.gsdlsrcdir" value="${basedir}/src/java/org/greenstone/gsdl3"/>
8  <property name="classesdir" value="${web.home}/WEB-INF/classes"/>
9  <property name="jarwebdir" value="${web.home}/WEB-INF/lib"/> 
10  <property name="web.extdir" value="${web.home}/ext/solr"/>
11  <property name="web.list" value="solr.xml"/>
12 
13  <!-- FILE LISTINGS.-->
14  <!-- Created as property elements rather than as filelist elements, since
15    they can then be reused for the add-service and delete-service targets. -->
16  <property name="jars"
17        value="apache-solr-core-3.3.0.jar
18        apache-solr-solrj-3.3.0.jar
19        lucene-spatial-3.3.0.jar
20        lucene-spellchecker-3.3.0.jar
21        lucene-analyzers-3.3.0.jar
22        lucene-highlighter-3.3.0.jar
23        commons-io-1.4.jar
24        commons-fileupload-1.2.1.jar
25        velocity-1.6.1.jar
26        log4j-over-slf4j-1.6.1.jar
27        slf4j-api-1.6.1.jar
28        slf4j-jdk14-1.6.1.jar"/>
29 
30  <property name="java-service-files"
31            value="SolrSearch.java         
32           GS2SolrSearch.java
33           GS2SolrRetrieve.java"/> 
34           
35  <property name="java-util-files"
36            value="SolrQueryWrapper.java           
37           SolrQueryResult.java"/>             
38 
39  <property name="property-files"
40            value="SharedSoleneGS2FieldSearch.properties"/> 
41
42  <property name="web-list-files"
43            value="solr.xml"/>
44
45           
46  <!-- TARGETS -->
47  <target name="usage" description="Print a help message">
48    <echo message="  Execute 'ant -projecthelp' for a list of targets."/>
49    <echo message="  Execute 'ant -help' for Ant help."/>
50    <echo>To install the Solr extension for Greenstone3, run 'ant add-service'.
51    To remove the files and folders installed by add-service, run 'ant del-service'.
52    </echo>
53  </target>         
54 
55  <target name="copy-files" description="Helper-target: copy files across for add-service target">
56 
57    <echo>Adding to gsdl3 java code-base:
58    ${ext.gsdlsrcdir}/service's files ${java-service-files}
59    AND ${ext.gsdlsrcdir}/util's files ${java-util-files}</echo>
60   
61    <copy todir="${gsdlsrcdir}/service">
62        <filelist id="java-src-files-service" dir="${ext.gsdlsrcdir}/service" files="${java-service-files}"/>
63    </copy>
64    <copy todir="${gsdlsrcdir}/util">
65        <filelist id="java-src-files-util" dir="${ext.gsdlsrcdir}/util" files="${java-util-files}"/>           
66    </copy>
67   
68    <echo/>
69    <echo>Adding to gsdl3 properties area: properties/${property-files}</echo>
70    <copy todir="${classesdir}">
71        <filelist id="prop-files" dir="properties" files="${property-files}"/>
72    </copy>
73
74    <echo/>
75    <echo>Adding to gsdl3 web jar lib directory: ${basedir}/lib/java's ${jars}</echo>
76    <copy todir="${jarwebdir}">
77        <filelist id="jar-files" dir="lib/java" files="${jars}"/>
78    </copy>
79   
80    <echo/>
81    <echo>Creating web extension directory: ${web.extdir}</echo>
82    <mkdir dir="${web.extdir}"/>
83   
84    <echo/>
85    <echo>Adding to gsdl3 web solr ext directory: ${web-list-files}</echo>
86    <copy todir="${web.extdir}">
87        <filelist id="web-list" dir="${basedir}" files="${web-list-files}"/>
88    </copy>
89   
90    <!-- copy the content of the web folder (avoiding the top-level .svn directory) -->
91    <available property="ext.web.exists" file="${basedir}/web" type="dir" />   
92  </target>
93 
94 
95  <target name="add-service" depends="copy-files" if="ext.web.exists"
96    description="Run this target to setup the Solr extension for Greenstone3">
97   
98    <echo/>
99    <echo>Copy to gsdl3 web: the content of the ${basedir}/web folder (excluding .svn)</echo>
100    <copy todir="${web.extdir}">
101        <dirset dir="${basedir}/web">
102            <exclude name=".svn"/>
103        </dirset>
104    </copy>
105  </target>
106 
107  <target name="del-service"
108    description="Run this target to unset the Solr extension for Greenstone3"> 
109   
110    <!-- failonerror is set to false in case some files don't exist
111    and can't be deleted therefore -->
112   
113    <echo>Removing from gsdl3 java code-base area:
114    ${ext.gsdlsrcdir}/service's files ${java-service-files}
115    AND ${ext.gsdlsrcdir}/util's files ${java-util-files}</echo>   
116   
117    <delete failonerror="false">
118        <filelist dir="${gsdlsrcdir}/service" files="${java-service-files}"/>
119    </delete>
120    <delete failonerror="false">
121        <filelist dir="${gsdlsrcdir}/util" files="${java-util-files}"/>       
122    </delete>
123   
124    <echo/>
125    <echo>Removing from  gsdl3 properties area: properties/${property-files}</echo>
126    <delete failonerror="false">
127        <filelist dir="${classesdir}" files="${property-files}"/>
128    </delete>
129
130    <echo/>
131    <echo>Removing from gsdl3 web jar lib directory: ${basedir}/lib/java's ${jars}</echo>
132    <delete failonerror="false">
133        <filelist dir="${jarwebdir}" files="${jars}"/>
134    </delete>   
135   
136    <echo/>
137    <echo>Removing web solr extension directory: ${web.extdir}</echo>
138    <delete failonerror="false" includeEmptyDirs="true" dir="${web.extdir}"/>   
139   
140  </target>
141 
142</project>
Note: See TracBrowser for help on using the browser.