root/gs3-extensions/mat/trunk/src/build.xml @ 32100

Revision 32100, 6.5 KB (checked in by kjdon, 23 months ago)

just tried this and this target failed as it couldn't find servlets.xml. the mat servlet is already specified in web.xml so I have removed the call to add-servlet-details. Note, the servlet itself crashed when I tried to use it, so may need some work done on it.

  • Property svn:executable set to *
Line 
1<project name="Mat" basedir="." default="main">
2  <property environment="env"/>
3  <property name="gsdl3srchome" value="${env.GSDL3SRCHOME}"/>
4
5  <property name="mat.web" value="${gsdl3srchome}/web/mat"/>
6  <property name="mat.bin.scripts" value="bin/script"/>
7  <property name="mat.web.scripts" value="${mat.web}/script"/>
8  <property name="mat.src"     value="src"/>
9  <property name="mat.build"   value="build"/>
10  <property name="mat.classes" value="${mat.build}/classes"/>
11  <property name="mat.classes.base" value="org/greenstone"/>
12  <property name="mat.admin.classes" value="${mat.classes.base}/admin"/>
13  <property name="mat.main.classes" value="${mat.classes.base}/mat"/>
14  <property name="mat.lib"     value="lib"/>
15  <property name="mat.tmp"     value="tmp"/>
16  <property name="mat.resources" value="resources"/>
17  <property name="mat.tomcat.resources" value="${mat.resources}/tomcat"/>
18  <property name="mat.script.resources" value="${mat.resources}/script"/>
19
20  <property name="gs.jni" value="${gsdl3srchome}/lib/jni"/>
21  <property name="gs.webinf" value="${gsdl3srchome}/web/WEB-INF"/>
22  <property name="gs.webinf.lib" value="${gs.webinf}/lib"/>
23  <property name="gs.webinf.classes" value="${gs.webinf}/classes"/>
24
25  <property name="tomcat" value="${gsdl3srchome}/packages/tomcat"/>
26  <property name="tomcat.lib" value="${tomcat}/lib"/>
27 
28  <path id="classpath">
29    <fileset dir="${mat.lib}">
30      <include name="**/*.jar"/>
31    </fileset>
32    <fileset dir="${gsdl3srchome}/lib/java">
33      <include name="**/*.jar"/>
34    </fileset>
35    <dirset  dir="${mat.lib}">
36      <include name="**/classes"/>
37    </dirset>
38  </path>
39
40  <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask"  classpathref="classpath"/>
41  <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="classpath"/>
42 
43  <target name="create_log_folder">
44    <mkdir dir="../logs/mat"/>
45  </target>
46 
47  <target name="clean">
48    <delete file="guiext.jar"/>
49    <delete dir="${mat.build}"/>
50   
51    <xmltask source="${gs.webinf}/web.xml" dest="${gs.webinf}/web.xml">
52      <remove path="/web-app/servlet[servlet-name='mat']"/>
53      <remove path="/web-app/servlet-mapping[servlet-name='mat']"/>
54    </xmltask>
55  </target>
56 
57 <!-- <target name="install" depends="setup-tmp,create_log_folder,add-servlet-details">-->
58    <target name="install" depends="setup-tmp,create_log_folder"> 
59    <mkdir dir="${mat.classes}"/>
60    <javac srcdir="${mat.src}" destdir="${mat.classes}" classpathref="classpath"/>
61
62    <jar destfile="${mat.lib}/mat.jar">
63      <fileset dir="${mat.classes}">
64    <include name="${mat.main.classes}/**"/>
65      </fileset>
66    </jar>
67    <copy file="${mat.lib}/mat.jar" todir="${gs.webinf.lib}"/>
68
69    <jar destfile="guiext.jar">
70      <fileset dir="${mat.classes}">
71    <include name="${mat.admin.classes}/**"/>
72      </fileset>
73    </jar>
74
75    <mkdir dir="${mat.web.scripts}"/>
76    <copy todir="${mat.web.scripts}">
77      <fileset dir="${mat.script.resources}"/>
78    </copy>
79    <copy todir="${mat.web.scripts}">
80      <fileset dir="${mat.bin.scripts}"/>
81    </copy>
82  </target>
83
84  <target name="compress-extension">
85    <if>
86      <bool>
87    <not><available file="7z.jar"/></not>
88      </bool>
89
90      <exec executable="svn">
91    <arg value="export"/>
92    <arg value="http://svn.greenstone.org/main/trunk/release-kits/shared/core/ant-tasks/7z-ant/7z.jar"/>
93      </exec>
94
95    </if>
96    <taskdef name="sevenzip" classname="org.apache.tools.ant.SevenZip" classpath="7z.jar"/>
97 
98    <if>
99      <bool><equals arg1="${os.name}" arg2="Linux"/></bool>
100      <property name="os" value="linux"/>
101     
102      <else>
103   
104    <if>
105      <bool><equals arg1="${os.name}" arg2="Mac OS X"/></bool>
106      <property name="os" value="mac"/>
107     
108      <else>
109     
110        <if>
111          <bool><or>
112          <equals arg1="${os.name}" arg2="Windows 95"/>
113          <equals arg1="${os.name}" arg2="Windows 98"/>
114          <equals arg1="${os.name}" arg2="Windows 2000"/>
115          <equals arg1="${os.name}" arg2="Windows XP"/>
116          <equals arg1="${os.name}" arg2="Windows NT"/>
117          <equals arg1="${os.name}" arg2="Windows ME"/>
118          <equals arg1="${os.name}" arg2="Windows Vista"/>
119          <equals arg1="${os.name}" arg2="Windows 7"/>
120        </or></bool>
121          <property name="os" value="windows"/>
122        </if>
123
124      </else>
125    </if>
126      </else>
127    </if>
128   
129    <zip destfile="mat.comp" compress="false">
130      <zipfileset dir="${basedir}">
131    <include name="bin"/>
132    <include name="bin/**/*"/>
133    <include name="build"/>
134    <include name="build/**/*"/>
135    <include name="FAQ.txt"/>
136    <include name="guiext.jar"/>
137    <include name="Mat.bat"/>
138    <include name="Mat.sh"/>
139    <include name="properties.xml"/>
140    <include name="README.txt"/>
141    <include name="resources"/>
142    <include name="resources/**/*"/>
143      </zipfileset>
144    </zip>
145   
146    <if>
147      <bool>
148    <equals arg1="${os}" arg2="Windows"/>
149      </bool>
150     
151      <exec executable="${gsdl3srchome}/winutil/7zip.exe">
152    <arg line="a -t7z -mx=9 mat.lzma mat.comp"/>
153      </exec>
154
155      <else>
156    <sevenzip task="encode" input="mat.comp" output="mat.lzma" dictionnary="26"/>
157      </else>
158    </if>
159  </target>
160
161  <target name="add-servlet-details">
162    <xmltask source="${gs.webinf}/web.xml">
163      <copy path="/web-app/servlet[servlet-name='mat']/servlet-name/text()" property="mat.exists"/>
164    </xmltask>
165
166    <if>
167      <bool>
168    <not><equals arg1="${mat.exists}" arg2="mat"/></not>
169      </bool>
170      <xmltask source="${gs.webinf}/web.xml" dest="${gs.webinf}/web.xml">
171    <insert path="/web-app/servlet[last()]" position="after">
172  <![CDATA[
173  <servlet>
174    <servlet-name>mat</servlet-name>
175    <description>Metadata Analysis Tool</description>
176    <servlet-class>org.greenstone.mat.servlet.MatServlet</servlet-class>
177  </servlet>
178  ]]>
179    </insert>
180    <insert path="/web-app/servlet-mapping[last()]" position="after">
181  <![CDATA[
182  <servlet-mapping>
183    <servlet-name>mat</servlet-name>
184    <url-pattern>/mat</url-pattern>
185  </servlet-mapping>
186  ]]>
187    </insert>
188      </xmltask>
189
190      <else>
191    <echo>MAT servlet definition already exists in the Greenstone web.xml</echo>
192      </else>
193    </if>
194  </target>
195
196  <target name ="clean-tmp">
197    <delete dir="${mat.tmp}"/>
198    <echo> ${mat.tmp} has been removed </echo>
199  </target>
200
201  <target name ="setup-tmp">
202    <mkdir dir="./tmp"/>
203    <echo> ${mat.tmp} has been created </echo>
204    <echo file="${mat.tmp}/log.txt">This is the log file.</echo>
205  </target>
206  <target name="clean-compile" depends="clean,install"/>
207 
208</project>
Note: See TracBrowser for help on using the browser.