-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
142 lines (125 loc) · 6.14 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<project name="texton" basedir="." default="war" xmlns:ivy="antlib:org.apache.ivy.ant">
<!--
Text Tonsorium
Build file for the project tools
Author: Bart Jongejan
-->
<property environment="env"/>
<!-- Define Ivy stuff -->
<property name="ivy.install.version" value="2.2.0" />
<property name="ivy.jar.dir" value="${basedir}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<property name="central.repo" value="https://repo1.maven.org/maven2" />
<property name="jboss.repo" value="https://repository.jboss.org/maven2" />
<!-- Define folder names -->
<property name="lib.dir" value="lib"/>
<property name="tomcat.dir" value="${CATALINA_HOME}/lib"/>
<!-- Assume that the 'Bracmat' project is in the same folder as the 'DK-ClarinTools' project
(Clone Bracmat from https://github.com/BartJongejan/Bracmat)
-->
<target name="bracmatlocationW" if="windows">
<property name="bracmatjar.dir" value="../Bracmat/java-JNI/java"/>
</target>
<target name="bracmatlocationU" if="Ubuntu">
<property name="bracmatjar.dir" value="../Bracmat/java-JNI/java"/>
</target>
<property name="src.dir" value="src"/>
<property name="class.dir" value="classes"/>
<property name="javadoc.dir" value="javadoc"/>
<property name="jar.dir" value="jar"/>
<property name="war.dir" value="war"/>
<property name="web.dir" value="web-source"/>
<property name="conf.dir" value="conf"/>
<target name="setClassPath" depends="bracmatlocationW,bracmatlocationU">
<!-- Set Classpath equal to what is needed -->
<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
<fileset dir="${bracmatjar.dir}" includes="*.jar"/>
<fileset dir="${conf.dir}" includes="**/*.jar"/>
<fileset dir="${tomcat.dir}" includes="servlet-api.jar"/>
</path>
</target>
<!-- Delete everything autogenerated -->
<target name="clean" description="Clean the project">
<delete dir="${class.dir}"/>
<delete dir="${war.dir}" />
<delete dir="${jar.dir}"/>
<delete dir="${javadoc.dir}" />
</target>
<!-- Delete everything autogenerated, including downloaded libs and ivy.xml -->
<target name="clean-all" depends="clean" description="Delete everything autogenerated, including downloaded libs">
<delete file="ivy.xml" />
<delete dir="${lib.dir}" />
<delete dir="${ivy.jar.dir}" />
</target>
<target name="download-ivy" if="ivy">
<mkdir dir="${ivy.jar.dir}" />
<!-- download Ivy from web site so that it can be used even without any special installation -->
<echo message="installing ivy..." />
<get src="${central.repo}/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true" />
</target>
<!-- Install Ivy. Only run on first compile -->
<target name="install-ivy" depends="download-ivy" description="--> install ivy">
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar" />
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path" />
<ivy:settings file="${conf.dir}/ivy.settings.xml" />
</target>
<target name="resolve" depends="install-ivy" description="--> retrieve dependencies with ivy">
<ivy:retrieve />
</target>
<target name="is-windows" if="windows" depends="setClassPath">
<echo message="This is warning message." />
<copy overwrite="true" file="properties_local_windows.xml" tofile="${conf.dir}/properties.xml"/>
<copy overwrite="true" file="ivy_tomcat.xml" tofile="ivy.xml"/>
<!--<copy overwrite="true" file="${env.CATALINA_HOME}/${lib.dir}/servlet-api.jar" tofile="${ivy.jar.dir}/servlet-api.jar"/>-->
<delete file="${ivy.jar.dir}/slf4j-log4j12-1.5.8.jar"/>
</target>
<target name="is-Ubuntu" if="Ubuntu" depends="setClassPath">
<echo message="This is warning message." />
<echo message="${CATALINA_HOME}" />
<copy overwrite="true" file="properties_ubuntu.xml" tofile="${conf.dir}/properties.xml"/>
<copy overwrite="true" file="ivy_tomcat.xml" tofile="ivy.xml"/>
<!--<copy overwrite="true" file="${CATALINA_HOME}/${lib.dir}/servlet-api.jar" tofile="${ivy.jar.dir}/servlet-api.jar"/>-->
<delete file="${ivy.jar.dir}/slf4j-log4j12-1.5.8.jar"/>
</target>
<!-- Set the appropriate environment -->
<target name="envir" depends="is-windows, is-Ubuntu"/>
<!--Compile the module, clean first -->
<target name="compile" depends="clean, resolve, envir" description="Compiles the whole bundle">
<mkdir dir="${class.dir}"/>
<javac srcdir="${src.dir}" destdir="${class.dir}" classpathref="classpath" encoding="utf-8" debuglevel="lines,vars,source" debug="true" >
<compilerarg value="-Xlint:unchecked" />
</javac>
</target>
<!--Make jar files -->
<target name="jar" depends="compile" description="Jar the project">
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${class.dir}">
<manifest>
<!-- don't write anything in MANIFEST.MF -->
</manifest>
</jar>
</target>
<!-- Pack as war file -->
<target name="war" depends="envir, jar" description="Pack to servlet war">
<mkdir dir="${war.dir}"/>
<war destfile="${war.dir}/${ant.project.name}.war" webxml="web.xml">
<fileset dir="${web.dir}"/>
<lib dir="${jar.dir}"/>
<lib dir="${lib.dir}">
<exclude name="**/servlet.jar"/>
<exclude name="**/servlet-api.jar"/>
</lib>
<classes dir="${conf.dir}"/>
</war>
</target>
<!-- Create javadocs -->
<target name="javadoc" description="Create Javadocs">
<mkdir dir="${javadoc.dir}" />
<javadoc destdir="${javadoc.dir}">
<fileset dir="${src.dir}/" includes="**/*.java" />
</javadoc>
</target>
</project>