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