source: other-projects/the-macronizer/trunk/build.xml@ 32752

Last change on this file since 32752 was 32752, checked in by ak19, 5 years ago

Minor tabbing corrections

  • Property svn:mime-type set to text/xml
File size: 6.4 KB
Line 
1<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2<project basedir="." default="war" name="TheMacronizer">
3
4 <property environment="env"/>
5 <!--
6 the associated Greenstone 3 installation folder
7 You're expected to run/source the gs3-setup script in the GS3
8 before running the default ant target in this file.
9 You will be warned of this if you attempt to run this ant
10 build.xml file without doing gs3-setup.
11 -->
12 <property name="gsdl3.web.home" value="${env.GSDL3HOME}"/>
13 <property name="gsdl3.src.home" value="${env.GSDL3SRCHOME}"/>
14
15 <property name="dist.dir.exp" location="releases" />
16
17 <property name="dist.filename.exp" value="TheMacronizer.war" />
18 <property name="build.dir.exp" location="web" />
19 <property name="lib.dir.exp" location="web/WEB-INF/lib" />
20 <property name="webinf.dir" location="web/WEB-INF" />
21 <property name="scripts.dir" location="src/scripts-and-sql" />
22
23 <!--
24 If changing these values, make sure you run 'ant clean'
25 -->
26 <property name="javac.source" value="1.8" />
27 <property name="javac.target" value="${javac.source}" />
28 <property name="javac.debug" value="true" />
29
30
31 <path id="classpath.exp">
32 <fileset dir="${lib.dir.exp}">
33 <include name="*.jar" />
34 </fileset>
35 </path>
36
37
38 <target name="clean">
39 <!-- delete only the class files built by themacronizer -->
40 <delete dir="${build.dir.exp}/WEB-INF/classes"/>
41 </target>
42
43
44 <target name="init">
45 <!-- has the gs3-setup script been run?? -->
46 <condition property="gs3-setup-not-done">
47 <not>
48 <isset property="env.GSDL3HOME"/>
49 </not>
50 </condition>
51 <fail if="gs3-setup-not-done" message="Please run 'gs3-setup' (Windows) or 'source gs3-setup.sh' (Linux/Mac) in the Greenstone3 installation that's associated with this Macronizer installation before this step."/>
52
53
54 <echo message="${ant.project.name}: ${ant.file}"/>
55 <mkdir dir="${build.dir.exp}/WEB-INF/classes"/>
56 <mkdir dir="${build.dir.exp}/WEB-INF/classes/monogram"/>
57 <copy includeemptydirs="false" todir="${build.dir.exp}/WEB-INF/classes/monogram/data">
58 <fileset dir="src/java/monogram/data" />
59 </copy>
60 </target>
61
62 <target name="build" depends="init">
63 <javac source="${javac.source}" target="${javac.target}" debug="${javac.debug}"
64 encoding="utf-8"
65 destdir="${build.dir.exp}/WEB-INF/classes" includeantruntime="false">
66 <src path="src"/>
67
68 <classpath>
69 <path refid="classpath.exp"/>
70 <pathelement location="src/jars/servlet-api.jar"/>
71 <pathelement path="src/java"/>
72 <pathelement path="webinf.dir"/>
73 </classpath>
74 </javac>
75
76 <!-- http://ant.apache.org/manual/Tasks/copy.html
77 By default, files are only copied if the source file is newer than the destination file,
78 or when the destination file does not exist. However, you can explicitly overwrite files
79 with the overwrite attribute.-->
80
81 <filter token="macronizer.home" value="${basedir}"/>
82
83 <!-- 1. Create the log4j.properties file from its log4j.properties.in template file and put it into the *Macronizer* installation's web/WEB-INF/classes folder -->
84 <copy file="${build.dir.exp}/log4j.properties.in" tofile="${build.dir.exp}/WEB-INF/classes/log4j.properties" filtering="true" overwrite="true"/>
85
86 <!-- 2. Create the macronizer.xml tomcat context file from the macronizer.xml.in template file and put it into the correct location in the associated GS3 installation -->
87 <copy file="${build.dir.exp}/macronizer.xml.in" tofile="${gsdl3.src.home}/packages/tomcat/conf/Catalina/localhost/macronizer.xml" filtering="true" overwrite="true"/>
88
89 <!-- mkdir Creates a directory. Also non-existent parent directories are created,
90 when necessary. Does nothing if the directory already exist. -->
91 <mkdir dir="${build.dir.exp}/logs"/>
92
93 <!-- For the MacroniserFileLogProcessor, which sets up a nightly cron to send useful logging info
94 from the daily macron.log.<date> files to a mysqldb, need to do some setup too -->
95 <copy file="${build.dir.exp}/mysql.properties.in" tofile="${build.dir.exp}/WEB-INF/classes/mysql.properties" filtering="true" overwrite="true"/>
96 <chmod file="${scripts.dir}/macronLogToDB.bash" perm="ugo+rx"/>
97 <filter token="macronizer.scripts" value="${scripts.dir}"/>
98 <filter token="macronizer.logs" value="${build.dir.exp}/logs"/>
99 <copy file="${basedir}/src/scripts-and-sql/cron.in" tofile="${basedir}/src/scripts-and-sql/cron.txt" filtering="true" overwrite="true"/>
100
101 <echo>*** Run the target 'logs-to-db-instructions' for instructions on setting up the MacroniserLogFileProcessor***</echo>
102 </target>
103
104 <target name="logs-to-db-instructions">
105 <echo> ************************************************************
106 Instructions on setting up the MacroniserLogFileProcessor
107 ************************************************************
108
109 1. Install mysql-5.7.23 as instructed at
110 http://wiki.greenstone.org/doku.php?id=en:user_advanced:greenstonesqlplugs#getting_and_running_mysql
111 (And when you run that mysql installation's db server, shut it down or run its mysql client,
112 do so as per the instructions there)
113
114 2. Use separate terminals to use the above instructions link to:
115 - Start the mysql server
116 - Connect to the mysql client
117
118 3. After connecting to the client, in the mysql client terminal
119 - IMPORTANT: don't forget to immediately follow with 'set names utf8mb4;'
120 - CREATE AND INITIALISE the Macroniser database and its tables by running
121 the MySQL_Code.sql script by typing the following and hitting ENTER:
122 source ${scripts.dir}/MySQL_Code.sql
123
124 3. Edit ${build.dir.exp}/WEB-INF/classes/mysql.properties to set the db password.
125 - If you set up a different username for the mysql db, set that in mysql.properties too.
126 - If nothing is set, MacronLogFileProcessor will assume the username is root.
127
128 4. Set up the daily cronjob as follows:
129 - open a terminal and type 'export EDITOR=emacs' (or set to the text editor you prefer)
130 - type 'crontab -e' and the editor will open the cronfile
131 - append the contents from ${scripts.dir}/cron.txt to the cronfile
132
133 ************************************************************
134 </echo>
135 </target>
136
137 <target name="war" depends="build">
138 <echo>Basedir: ${basedir}</echo>
139 <jar destfile="${dist.filename.exp}">
140 <fileset dir="${build.dir.exp}" />
141 </jar>
142 </target>
143
144</project>
Note: See TracBrowser for help on using the repository browser.