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 |
|
---|
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 | -->
|
---|
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 |
|
---|
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 -->
|
---|
38 |
|
---|
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"/>
|
---|
43 |
|
---|
44 | <!-- local ext paths -->
|
---|
45 | <loadproperties prefix="gs3." srcFile="${basedir}/../../build.properties"/>
|
---|
46 | <property name="src.home" value="${basedir}/src"/>
|
---|
47 | <property name="dst.home" value="${basedir}/web"/>
|
---|
48 | <available property="ext.web.exists" file="${basedir}/web" type="dir" />
|
---|
49 |
|
---|
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"/>
|
---|
52 |
|
---|
53 | <condition property="tomcat.dir" value="${gs3.tomcat.installed.path}" else="${basedir}/../../packages/tomcat">
|
---|
54 | <and>
|
---|
55 | <isset property="gs3.tomcat.installed.path"/>
|
---|
56 | <not>
|
---|
57 | <equals arg1="${gs3.tomcat.installed.path}" arg2=""/>
|
---|
58 | </not>
|
---|
59 | </and>
|
---|
60 | </condition>
|
---|
61 | <condition property="webswing.context" value="${gs3.webswing.context}" else="webswing-server">
|
---|
62 | <and>
|
---|
63 | <isset property="gs3.webswing.context"/>
|
---|
64 | <not>
|
---|
65 | <equals arg1="${gs3.webswing.context}" arg2=""/>
|
---|
66 | </not>
|
---|
67 | </and>
|
---|
68 | </condition>
|
---|
69 |
|
---|
70 |
|
---|
71 | <!-- TARGETS -->
|
---|
72 | <target name="usage" description="Print a help message">
|
---|
73 | <echo message=" Execute 'ant -projecthelp' for a list of targets."/>
|
---|
74 | <echo message=" Execute 'ant -help' for Ant help."/>
|
---|
75 | <echo>To install the Webswing extension for Greenstone3, run 'ant add-webapp'.
|
---|
76 | To remove the files and folders installed by add-service, run 'ant del-webapp'.
|
---|
77 | </echo>
|
---|
78 | </target>
|
---|
79 |
|
---|
80 | <target name="compile" description="Compile up the webswing java classes, war them up, and install webseing-server.war into Greenstone's Tomcats webapps dir">
|
---|
81 |
|
---|
82 | <exec os="${os.unix}" executable="bash" dir="src" failonerror="true">
|
---|
83 | <arg value="-c" />
|
---|
84 | <arg value="./COMPILE.sh" />
|
---|
85 | </exec>
|
---|
86 |
|
---|
87 | <echo>Copying src/webswing-20.2.5/webswing-server/webswing-server-war/target/webswing-server.war ${tomcat.dir}/webapps </echo>
|
---|
88 | <copy file="src/webswing-20.2.5/webswing-server/webswing-server-war/target/webswing-server.war" todir="${tomcat.dir}/webapps"/>
|
---|
89 |
|
---|
90 | </target>
|
---|
91 |
|
---|
92 | <target name="clean" description="Delete the webswing compiled classes">
|
---|
93 | <exec os="${os.unix}" executable="./CLEAN.sh" dir="src" failonerror="true" />
|
---|
94 | <exec os="${os.windows}" executable=".\\CLEAN.bat" dir="src" failonerror="true" />
|
---|
95 | </target>
|
---|
96 |
|
---|
97 |
|
---|
98 | <target name="install-etc-files">
|
---|
99 |
|
---|
100 | <if>
|
---|
101 | <bool><not><available file="${web.extdir}" type="dir"/></not></bool>
|
---|
102 | <echo>Creating web extension directory: ${web.extdir}</echo>
|
---|
103 | <mkdir dir="${web.extdir}"/>
|
---|
104 | </if>
|
---|
105 | <if>
|
---|
106 | <bool><not><available file="${web.extdir}/etc" type="dir"/></not></bool>
|
---|
107 | <echo>Creating web extension directory: ${web.extdir}/etc</echo>
|
---|
108 | <mkdir dir="${web.extdir}/etc"/>
|
---|
109 | </if>
|
---|
110 |
|
---|
111 | <for param="configFile" list="${etc-config-files}">
|
---|
112 | <sequential>
|
---|
113 | <echo message="Processing ${basedir}/web/etc/@{configFile}.in"/>
|
---|
114 | <copy file="${basedir}/web/etc/@{configFile}.in" tofile="${web.extdir}/etc/@{configFile}" filtering="true" overwrite="true">
|
---|
115 | <filterset>
|
---|
116 | <filter token="gsdl3srchome" value="${gsdl3srchome}"/>
|
---|
117 | </filterset>
|
---|
118 | </copy>
|
---|
119 | </sequential>
|
---|
120 | </for>
|
---|
121 |
|
---|
122 | <for param="configDir" list="${etc-config-dirs}">
|
---|
123 | <sequential>
|
---|
124 | <echo/>
|
---|
125 | <echo>Installing ${basedir}/web/@{configDir}/ (excluding .svn)</echo>
|
---|
126 | <copy todir="${web.extdir}">
|
---|
127 | <fileset dir="${basedir}/web">
|
---|
128 | <include name="@{configDir}/**"/>
|
---|
129 | <exclude name="**/.svn"/>
|
---|
130 | </fileset>
|
---|
131 | </copy>
|
---|
132 | </sequential>
|
---|
133 | </for>
|
---|
134 | </target>
|
---|
135 |
|
---|
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" />
|
---|
139 | </target>
|
---|
140 |
|
---|
141 |
|
---|
142 | <target name="add-extension" depends="install-etc-files,install-webswing-for-tomcat"
|
---|
143 | description="Run this target to setup the Webswing extension for Greenstone3" />
|
---|
144 |
|
---|
145 |
|
---|
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}
|
---|
149 | Do 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>
|
---|
156 |
|
---|
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>
|
---|
165 | </target>
|
---|
166 |
|
---|
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}"/>
|
---|
175 | </target>
|
---|
176 |
|
---|
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 |
|
---|
180 | </project>
|
---|