forked from simplenlg/simplenlg
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
200 lines (167 loc) · 8.11 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!-- SimpleNLG Ant Script -->
<!--
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
License for the specific language governing rights and limitations
under the License.
The Original Code is "Simplenlg".
The Initial Developer of the Original Code is Ehud Reiter, Albert Gatt and Dave Westwater.
Portions created by Ehud Reiter, Albert Gatt and Dave Westwater are Copyright (C) 2010-11 The University of Aberdeen. All Rights Reserved.
Contributor(s): Ehud Reiter, Albert Gatt, Dave Westwater, Roman Kutlak, Margaret Mitchell, Saad Mahamood.
-->
<project name="simplenlg" basedir="." default="main">
<presetdef name="javac">
<javac includeantruntime="false" />
</presetdef>
<property name="src.dir" value="src/main/java"/>
<property name="testsrc.dir" value="src/test/java"/>
<property name="res.dir" value="src/main/resources" />
<property name="testres.dir" value="src/test/resources" />
<property name="build.dir" value="build"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<property name="report.dir" value="${build.dir}/junitreport"/>
<property name="lexicon.dir" value="${testres.dir}/NIHLexicon" />
<property name="lib.dir" value="${build.dir}/lib"/>
<property name="test.lib.dir" value="${build.dir}/test/lib"/>
<property name="main-class" value="simplenlg.server.SimpleServer"/>
<!-- Compiles to Java 1.6 -->
<property name="ant.build.javac.source" value="1.6"/>
<property name="ant.build.javac.target" value="1.6"/>
<path id="classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="test-classpath">
<fileset dir="${test.lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="application" location="${jar.dir}/${ant.project.name}.jar"/>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="download-deps">
<mkdir dir="${lib.dir}"/>
<get dest="${lib.dir}" src="http://clojars.org/repo/gov/nih/nlm/nls/lexaccess/lexaccess-dist/2013/lexaccess-dist-2013.jar"/>
<mkdir dir="${test.lib.dir}"/>
<get dest="${test.lib.dir}" src="http://central.maven.org/maven2/junit/junit/4.12/junit-4.12.jar"/>
<get dest="${test.lib.dir}" src="http://central.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"/>
</target>
<!-- Compiles SimpleNLG and includes the lexicon.properties file -->
<target name="compile" depends="download-deps">
<mkdir dir="${classes.dir}"/>
<javac target="1.6" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath">
<!-- Someone is using internal Sun/Oracle classes... -->
<compilerarg value="-XDignore.symbol.file" />
</javac>
<copy todir="${classes.dir}">
<fileset dir="${res.dir}" includes="*.properties"/>
</copy>
<copy todir="${classes.dir}/simplenlg/lexicon">
<fileset dir="${res.dir}" includes="default-lexicon.xml" />
</copy>
</target>
<!-- Compiles SimpleNLG without including the lexicon.properties file -->
<target name="compile-noproperties">
<mkdir dir="${classes.dir}"/>
<javac target="1.6" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath">
<!-- Someone is using internal Sun/Oracle classes... -->
<compilerarg value="-XDignore.symbol.file" />
</javac>
<copy todir="${classes.dir}/simplenlg/lexicon">
<fileset dir="${res.dir}" includes="default-lexicon.xml" />
</copy>
</target>
<!-- Check to see if the code compiles -->
<target name="compile.test" depends="compile">
<mkdir dir="${classes.dir}"/>
<javac target="1.6" srcdir="${testsrc.dir}" destdir="${classes.dir}" classpathref="classpath"/>
</target>
<!-- Builds a SimpleNLG Library JAR and bundles third-party libraries -->
<target name="jar" depends="compile">
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
<!--Copies all the jar files into the package-->
<fileset dir="${classes.dir}" includes="**/*.class" />
<fileset dir="${src.dir}" includes="**/*.java" />
<zipgroupfileset dir="${lib.dir}" includes="**/*.jar">
<exclude name="lexaccess-dist-2013.jar"/>
</zipgroupfileset>
</jar>
</target>
<!-- Builds a SimpleNLG Library JAR without bundling third-party libraries -->
<target name="jar-nodeps" depends="compile-noproperties">
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
<fileset dir="${classes.dir}" excludes="**/*.properties" />
<fileset dir="${classes.dir}" includes="**/*.class" />
<fileset dir="${src.dir}" includes="**/*.java" />
</jar>
</target>
<!-- Runs the SimpleNLG SimpleServer -->
<target name="run" depends="jar">
<unzip src="${lexicon.dir}/lexAccess2013.data.zip" dest="${lexicon.dir}" />
<echo message="**** Starting the SimpleNLG Simple Server"/>
<echo message="**** Waiting for clients. Type 'exit' and press enter to quit. "/>
<java fork="true" classname="${main-class}">
<classpath>
<path refid="classpath"/>
<path refid="application"/>
</classpath>
<jvmarg line="-Xmx512m"/>
</java>
<delete file="${lexicon.dir}/lexAccess2013.data" />
</target>
<!-- Standard JUnit that excludes test that require platform
specific enviroment variables -->
<target name="junit" depends="compile.test,jar">
<mkdir dir="${report.dir}"/>
<unzip src="${lexicon.dir}/lexAccess2013.data.zip" dest="${lexicon.dir}"/>
<junit fork="true" printsummary="yes">
<classpath>
<path refid="classpath"/>
<path refid="test-classpath"/>
<path refid="application"/>
</classpath>
<jvmarg line="-Xmx512m"/>
<formatter type="xml"/>
<batchtest todir="${report.dir}">
<fileset dir="${testsrc.dir}">
<!-- the following files are excluded as they are not actual
tests. Usually, just a superclass with the test setup. -->
<exclude name="**/SyntaxTests.*" />
<exclude name="**/SharedLexiconTests.*" />
<exclude name="**/SimpleNLG4Test.*" />
<exclude name="**/StandAloneExample*" />
<exclude name="**/ClauseAggregationTest2*"/>
</fileset>
</batchtest>
</junit>
<delete file="${lexicon.dir}/lexAccess2013.data"/>
</target>
<!-- Runs the JUnit Report -->
<target name="junitreport">
<junitreport todir="${report.dir}">
<fileset dir="${report.dir}" includes="TEST-*.xml"/>
<report todir="${report.dir}"/>
</junitreport>
</target>
<!-- Cleans the build directory and builds a JAR with third party libs -->
<target name="clean-build" depends="clean,jar"/>
<!-- Cleans the build directory and builds a JAR without third party libs -->
<target name="clean-build-nodeps" depends="clean,jar-nodeps"/>
<!-- Cleans the build directoy, builds SimpleNLG and runs the SimpleServer -->
<target name="main" depends="clean,run"/>
</project>