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 |
|
---|
22 | <!--
|
---|
23 | If changing these values, make sure you run 'ant clean'
|
---|
24 | -->
|
---|
25 | <property name="javac.source" value="1.8" />
|
---|
26 | <property name="javac.target" value="${javac.source}" />
|
---|
27 | <property name="javac.debug" value="true" />
|
---|
28 |
|
---|
29 |
|
---|
30 | <path id="classpath.exp">
|
---|
31 | <fileset dir="${lib.dir.exp}">
|
---|
32 | <include name="*.jar" />
|
---|
33 | </fileset>
|
---|
34 | </path>
|
---|
35 |
|
---|
36 |
|
---|
37 | <target name="clean">
|
---|
38 | <!-- delete only the class files built by themacronizer -->
|
---|
39 | <delete dir="${build.dir.exp}/WEB-INF/classes"/>
|
---|
40 | </target>
|
---|
41 |
|
---|
42 |
|
---|
43 | <target name="init">
|
---|
44 | <!-- has the gs3-setup script been run?? -->
|
---|
45 | <condition property="gs3-setup-not-done">
|
---|
46 | <not>
|
---|
47 | <isset property="env.GSDL3HOME"/>
|
---|
48 | </not>
|
---|
49 | </condition>
|
---|
50 | <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."/>
|
---|
51 |
|
---|
52 |
|
---|
53 | <echo message="${ant.project.name}: ${ant.file}"/>
|
---|
54 | <mkdir dir="${build.dir.exp}/WEB-INF/classes"/>
|
---|
55 | <mkdir dir="${build.dir.exp}/WEB-INF/classes/monogram"/>
|
---|
56 | <copy includeemptydirs="false" todir="${build.dir.exp}/WEB-INF/classes/monogram/data">
|
---|
57 | <fileset dir="src/java/monogram/data" />
|
---|
58 | </copy>
|
---|
59 | </target>
|
---|
60 |
|
---|
61 | <target name="build" depends="init">
|
---|
62 | <javac source="${javac.source}" target="${javac.target}" debug="${javac.debug}"
|
---|
63 | encoding="utf-8"
|
---|
64 | destdir="${build.dir.exp}/WEB-INF/classes" includeantruntime="false">
|
---|
65 | <src path="src"/>
|
---|
66 |
|
---|
67 | <classpath>
|
---|
68 | <path refid="classpath.exp"/>
|
---|
69 | <pathelement location="src/jars/servlet-api.jar"/>
|
---|
70 | <pathelement path="src/java"/>
|
---|
71 | <pathelement path="webinf.dir"/>
|
---|
72 | </classpath>
|
---|
73 | </javac>
|
---|
74 |
|
---|
75 | <!-- http://ant.apache.org/manual/Tasks/copy.html
|
---|
76 | By default, files are only copied if the source file is newer than the destination file,
|
---|
77 | or when the destination file does not exist. However, you can explicitly overwrite files
|
---|
78 | with the overwrite attribute.-->
|
---|
79 |
|
---|
80 | <filter token="macronizer.home" value="${basedir}"/>
|
---|
81 |
|
---|
82 | <!-- 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 -->
|
---|
83 | <copy file="${build.dir.exp}/log4j.properties.in" tofile="${build.dir.exp}/WEB-INF/classes/log4j.properties" filtering="true" overwrite="true"/>
|
---|
84 | <copy file="${build.dir.exp}/mysql.properties.in" tofile="${build.dir.exp}/WEB-INF/classes/mysql.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 | </target>
|
---|
93 |
|
---|
94 |
|
---|
95 | <target name="war" depends="build">
|
---|
96 | <echo>Basedir: ${basedir}</echo>
|
---|
97 | <jar destfile="${dist.filename.exp}">
|
---|
98 | <fileset dir="${build.dir.exp}" />
|
---|
99 | </jar>
|
---|
100 | </target>
|
---|
101 |
|
---|
102 | </project>
|
---|