forked from stanfordnlp/CoreNLP
-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.xml
494 lines (455 loc) · 20 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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
<!-- JavaNLP core build file -->
<project name="core" default="compile" basedir=".">
<property name="build.path" value="${basedir}/classes" />
<property name="source.path" value="${basedir}/src" />
<property name="doc.path" value="${basedir}/doc" />
<property name="data.path" value="${basedir}/data" />
<property name="tests.path" value="${basedir}/test/src" />
<property name="itests.path" value="${basedir}/itest/src" />
<!-- included tasks may use project.core as a property name -->
<property name="project.core" value="${basedir}" />
<property name="compile.debug" value="true"/>
<property name="compile.deprecation" value="false"/>
<property name="compile.optimize" value="true"/>
<property name="compile.source" value="1.8" />
<property name="compile.target" value="1.8" />
<property name="compile.encoding" value="utf-8" />
<target name="classpath" description="Sets the classpath">
<echo message="${ant.project.name}" />
<path id="classpath">
<fileset dir="${basedir}/lib">
<include name="*.jar"/>
<exclude name="javanlp*"/>
</fileset>
<fileset dir="${basedir}/liblocal">
<include name="*.jar"/>
<exclude name="javanlp*"/>
</fileset>
</path>
</target>
<target name="clean" description="Delete old classes">
<echo message="${ant.project.name}" />
<delete dir="${build.path}"/>
</target>
<target name="javacceverything" depends="classpath"
description="javacc everything that can be javacced">
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${project.core}/lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<echo message="${ant.project.name}" />
<for param="javacc.target">
<path>
<fileset dir="${source.path}">
<include name="**/*.jj"/>
</fileset>
</path>
<sequential>
<javacc target="@{javacc.target}" javacchome="${basedir}/lib" />
</sequential>
</for>
</target>
<target name="flexeverything" depends="classpath"
description="JFlex everything that can be JFlexed">
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${project.core}/lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<taskdef classname="jflex.anttask.JFlexTask" name="jflex">
<classpath>
<pathelement location="${project.core}/lib/jflex-1.5.1.jar"/>
</classpath>
</taskdef>
<echo message="${ant.project.name}" />
<for param="flex.target">
<path>
<fileset dir="${source.path}">
<include name="**/*.flex"/>
</fileset>
</path>
<sequential>
<jflex file="@{flex.target}" />
</sequential>
</for>
</target>
<target name="compile" depends="classpath"
description="Compile core sources">
<echo message="${ant.project.name}" />
<mkdir dir="${build.path}" />
<javac srcdir="${source.path}:${tests.path}:${itests.path}"
destdir="${build.path}"
debug="${compile.debug}"
encoding="${compile.encoding}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}"
source="${compile.source}"
target="${compile.target}"
fork="true"
memorymaximumsize="2g"
includeantruntime="false">
<classpath refid="classpath" />
<!-- <compilerarg value="-Xmaxerrs"/>
<compilerarg value="20"/> -->
<compilerarg value="-Xlint:cast"/>
<compilerarg value="-Xlint:classfile"/>
<compilerarg value="-Xlint:divzero"/>
<compilerarg value="-Xlint:empty"/>
<compilerarg value="-Xlint:finally"/>
<compilerarg value="-Xlint:path"/>
<compilerarg value="-Xlint:try"/>
<!--
<compilerarg value="-Xlint:deprecation"/>
<compilerarg value="-Xlint:dep-ann"/>
<compilerarg value="-Xlint:fallthrough"/>
<compilerarg value="-Xlint:options"/>
<compilerarg value="-Xlint:overrides"/>
<compilerarg value="-Xlint:processing"/>
<compilerarg value="-Xlint:rawtypes"/>
<compilerarg value="-Xlint:serial"/>
<compilerarg value="-Xlint:static"/>
<compilerarg value="-Xlint:unchecked"/>
<compilerarg value="-Xlint:varargs"/>
-->
<!-- <compilerarg value="-Xlint:all"/>
<compilerarg value="-Xmaxwarns"/>
<compilerarg value="10000"/> -->
</javac>
<copy todir="${build.path}/edu/stanford/nlp/pipeline/demo">
<fileset dir="${source.path}/edu/stanford/nlp/pipeline/demo">
<exclude name="**/*.java"/>
</fileset>
</copy>
<copy todir="${build.path}/edu/stanford/nlp/pipeline">
<fileset dir="${source.path}/edu/stanford/nlp/pipeline">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="test" depends="classpath,compile"
description="Run core unit tests">
<echo message="${ant.project.name}" />
<junit fork="true" maxmemory="1g" printsummary="off" outputtoformatters="false" forkmode="perBatch" haltonfailure="true">
<classpath refid="classpath"/>
<classpath path="${build.path}"/>
<classpath path="${data.path}"/>
<classpath path="${source.path}"/>
<formatter type="brief" usefile="false"/>
<batchtest fork="yes">
<fileset dir="${tests.path}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="itest" depends="classpath,compile"
description="Run core integration tests">
<echo message="${ant.project.name}" />
<junit fork="yes" maxmemory="8g" printsummary="off" outputtoformatters="false" forkmode="perTest" haltonfailure="true">
<classpath refid="classpath"/>
<classpath path="${build.path}"/>
<classpath path="${data.path}"/>
<classpath path="${source.path}"/>
<formatter type="brief" usefile="false"/>
<batchtest fork="yes">
<fileset dir="${itests.path}">
<include name="**/*ITest*.java"/>
<exclude name="**/*SlowITest*.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="slowitest" depends="classpath,compile"
description="Run really slow integration tests">
<echo message="${ant.project.name}" />
<junit fork="yes" maxmemory="12g" printsummary="off" outputtoformatters="false" forkmode="perTest" haltonfailure="true">
<classpath refid="classpath"/>
<classpath path="${build.path}"/>
<classpath path="${data.path}"/>
<classpath path="${source.path}"/>
<formatter type="brief" usefile="false"/>
<batchtest fork="yes">
<fileset dir="${itests.path}">
<include name="**/*SlowITest.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="compile-all" depends="compile,jsp"
description="Compile everything" />
<target name="all" depends="clean,compile-all"
description="Clean and re-compile." />
<!-- This file contains the .jsp build target -->
<import file="commonbuildjsp.xml" />
<!-- This runs the specified class, using a separate Java VM -->
<!-- Specify class to run via "run.class," arg, i.e., -->
<!-- ant run -Drun.class=edu.stanford.nlp.tagger.maxent.MaxentTaggerGUI -->
<!-- Use "jvmarg" to pass arguments to the VM, use "arg" to pass cmdline args to the class -->
<target name="run" depends="classpath">
<java classname="${run.class}" fork="true" jvm="java">
<jvmarg value="-Xmx2g"/>
<jvmarg value="-server"/>
<classpath>
<path refid="classpath"/>
<pathelement path="${build.path}"/>
</classpath>
</java>
</target>
<!-- Same as "run," except causes the VM to wait until debugger is attached -->
<!-- See http://nlp.stanford.edu/javanlp/did_you_know/eclipse_debug.html for example -->
<target name="run-debug" depends="classpath">
<java classname="${run.class}" fork="true" jvm="java">
<jvmarg value="-Xmx2g"/>
<!-- Following args should cause this to freeze and wait for debug attach -->
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=None"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9099"/>
<classpath>
<path refid="classpath"/>
<pathelement path="${build.path}"/>
</classpath>
</java>
</target>
<target name="jar" depends="compile">
<jar destfile="javanlp-core.jar">
<fileset dir="${project.core}/classes" />
</jar>
</target>
<!-- I wrote this for a side project, so if you one day see it in a
build file of mine, you can't sue me for taking it from
Stanford. -jab -->
<!-- This macro builds a .war for a jsp, configured by several
attributes which say which .jar file to use as a base library,
which other libraries are needed, which data files to grab,
etc. In order to verify that the .jsp will work, it
precompiles it before building the .war. -->
<macrodef name="buildjsp">
<attribute name="webapp.path"/> <!-- where to find the .jsp files -->
<attribute name="webapp.war"/> <!-- name of the .war to produce -->
<attribute name="webapp.jar"/> <!-- probably javanlp-core.jar -->
<element name="webapp.lib"/> <!-- libs to include -->
<element name="webapp.data"/> <!-- data files to include -->
<sequential>
<!-- This tool turns .jsp into .java -->
<taskdef classname="org.apache.jasper.JspC" name="jasper2" >
<classpath refid="webapp.classpath"/>
</taskdef>
<echo message="Building .jsp @{webapp.path}" />
<echo message="Building from ${source.path}/@{webapp.path}"/>
<!-- First, compile the .jsp into .java -->
<jasper2
validateXml="false"
uriroot="${source.path}/@{webapp.path}"
webXmlFragment="${source.path}/@{webapp.path}/WEB-INF/generated.xml"
addWebXmlMappings="true"
outputDir="${build.path}/@{webapp.path}/WEB-INF/src" />
<mkdir dir="${build.path}/@{webapp.path}/WEB-INF/classes"/>
<!-- Then compile the .java into .class -->
<javac destdir="${build.path}/@{webapp.path}/WEB-INF/classes"
optimize="${compile.optimize}"
encoding="${compile.encoding}"
debug="${compile.debug}"
srcdir="${build.path}/@{webapp.path}/WEB-INF/src"
includeantruntime="false"
excludes="**/*.smap">
<classpath refid="webapp.classpath"/>
<classpath refid="classpath"/>
<classpath path="${build.path}"/>
<include name="**" />
<exclude name="tags/**" />
</javac>
<!-- Now, build a .war out of the compiled java and all of the
specified libraries. -->
<war destfile="@{webapp.war}"
webxml="${source.path}/@{webapp.path}/WEB-INF/web.xml">
<classes dir="${build.path}/@{webapp.path}/WEB-INF/classes"/>
<webapp.lib/>
<lib dir=".">
<include name="@{webapp.jar}"/>
</lib>
<webapp.data/>
</war>
</sequential>
</macrodef>
<target name="sutime.war" depends="compile,jar"
description="build the sutime webapp">
<war destfile="sutime.war"
webxml="${source.path}/edu/stanford/nlp/time/suservlet/WEB-INF/web.xml">
<lib dir=".">
<include name="javanlp-core.jar"/>
</lib>
<lib dir="${basedir}/lib">
<include name="commons-lang3-3.1.jar"/>
<include name="xom-1.2.10.jar"/>
<include name="joda-time.jar"/>
<include name="jollyday-0.4.7.jar"/>
</lib>
<zipfileset prefix="WEB-INF/data"
file="/u/nlp/data/pos-tagger/distrib/english-left3words-distsim.tagger"/>
<zipfileset prefix="WEB-INF/data/rules"
file="${source.path}/edu/stanford/nlp/time/rules/*"/>
<zipfileset prefix="WEB-INF/data/holidays"
file="${source.path}/edu/stanford/nlp/time/holidays/*"/>
<zipfileset file="${data.path}/webapps/favicon.ico"/>
<zipfileset file="${source.path}/edu/stanford/nlp/time/suservlet/header.jsp"/>
<zipfileset file="${source.path}/edu/stanford/nlp/time/suservlet/footer.jsp"/>
<zipfileset file="${source.path}/edu/stanford/nlp/time/suservlet/sutime.css"/>
<zipfileset file="${source.path}/edu/stanford/nlp/time/suservlet/calendarview.css"/>
<zipfileset file="${source.path}/edu/stanford/nlp/time/suservlet/calendarview.js"/>
<zipfileset file="${source.path}/edu/stanford/nlp/time/suservlet/prototype.js"/>
</war>
</target>
<target name="openie.war" depends="compile,jar"
description="build the openie webapp">
<war destfile="openie.war"
webxml="${source.path}/edu/stanford/nlp/naturalli/demo/web.xml">
<lib dir=".">
<include name="javanlp-core.jar"/>
</lib>
<zipfileset prefix="WEB-INF/data"
file="/u/nlp/data/pos-tagger/distrib/english-left3words-distsim.tagger"/>
<zipfileset prefix="WEB-INF/data"
file="${source.path}/edu/stanford/nlp/time/rules/*"/>
<zipfileset prefix="WEB-INF/data"
file="${source.path}/edu/stanford/nlp/time/holidays/*"/>
<zipfileset prefix="WEB-INF/data"
file="/u/nlp/data/ner/goodClassifiers/english.all.3class.distsim.crf.ser.gz"/>
<zipfileset prefix="WEB-INF/data"
file="/u/nlp/data/ner/goodClassifiers/english.conll.4class.distsim.crf.ser.gz"/>
<zipfileset prefix="WEB-INF/data"
file="/u/nlp/data/ner/goodClassifiers/english.muc.7class.distsim.crf.ser.gz"/>
<zipfileset prefix="WEB-INF/data"
file="/u/nlp/data/depparser/nn/distrib/english_SD.gz"/>
<zipfileset prefix="WEB-INF/data"
file="/u/nlp/data/lexparser/englishPCFG.ser.gz"/>
<zipfileset prefix="WEB-INF/data"
file="/home/gabor/workspace/naturalli/etc/clauseSplitterModel.ser.gz"/>
<zipfileset prefix="WEB-INF/data"
file="/home/gabor/workspace/naturalli/etc/pp.tab.gz"/>
<zipfileset prefix="WEB-INF/data"
file="/home/gabor/workspace/naturalli/etc/obj.tab.gz"/>
<zipfileset prefix="WEB-INF/data"
file="/home/gabor/workspace/naturalli/etc/privative.tab.gz"/>
<zipfileset prefix="WEB-INF/data"
file="/home/gabor/workspace/naturalli/etc/subj_obj_pp.tab.gz"/>
<zipfileset prefix="WEB-INF/data"
file="/home/gabor/workspace/naturalli/etc/subj_pp_obj.tab.gz"/>
<zipfileset prefix="WEB-INF/data"
file="/home/gabor/workspace/naturalli/etc/subj_pp_pp.tab.gz"/>
<zipfileset prefix="WEB-INF/data"
file="/home/gabor/workspace/naturalli/etc/subj_pp.tab.gz"/>
</war>
</target>
<target name="parser.war" depends="compile,jar"
description="build the parser webapp">
<buildjsp webapp.path="edu/stanford/nlp/parser/webapp"
webapp.war="parser.war"
webapp.jar="javanlp-core.jar">
<webapp.lib>
<lib dir="/u/nlp/data/StanfordCoreNLPModels">
<include name="stanford-spanish-corenlp-models-current.jar"/>
</lib>
</webapp.lib>
<webapp.data>
<zipfileset prefix="WEB-INF/data"
file="/u/nlp/data/lexparser/englishPCFG.ser.gz"/>
<zipfileset prefix="WEB-INF/data"
file="/u/nlp/data/lexparser/arabicFactored.ser.gz"/>
<zipfileset prefix="WEB-INF/data"
file="/u/nlp/data/lexparser/xinhuaFactored.ser.gz"/>
<zipfileset prefix="WEB-INF/data/chinesesegmenter"
file="/u/nlp/data/gale/segtool/stanford-seg/classifiers-2010/05202008-ctb6.processed-chris6.lex.gz"/>
<zipfileset prefix="WEB-INF/data/chinesesegmenter"
dir="/u/nlp/data/gale/segtool/stanford-seg/releasedata"/>
<zipfileset prefix="WEB-INF/data"
file="/u/nlp/data/lexparser/spanishPCFG.ser.gz"/>
<zipfileset file="${data.path}/webapps/favicon.ico"/>
</webapp.data>
</buildjsp>
</target>
<target name="ner.war" depends="compile,jar"
description="build the ner webapp">
<!-- This is built from a java servlet, not a jsp. -->
<!-- The class needed for the results page will already be in
javanlp-core.jar -->
<war destfile="ner.war"
webxml="${source.path}/edu/stanford/nlp/ie/ner/webapp/WEB-INF/web.xml">
<lib dir=".">
<include name="javanlp-core.jar"/>
</lib>
<lib dir="${basedir}/lib">
<include name="commons-lang3-3.1.jar"/>
</lib>
<zipfileset file="${source.path}/edu/stanford/nlp/ie/ner/webapp/ner.jsp"/>
<zipfileset file="${source.path}/edu/stanford/nlp/ie/ner/webapp/header.jsp"/>
<zipfileset file="${source.path}/edu/stanford/nlp/ie/ner/webapp/footer.jsp"/>
<zipfileset prefix="WEB-INF/data/models"
file="/u/nlp/data/ner/goodClassifiers/english.all.3class.distsim.crf.ser.gz"/>
<zipfileset prefix="WEB-INF/data/models"
file="/u/nlp/data/ner/goodClassifiers/english.conll.4class.distsim.crf.ser.gz"/>
<zipfileset prefix="WEB-INF/data/models"
file="/u/nlp/data/ner/goodClassifiers/english.muc.7class.distsim.crf.ser.gz"/>
<zipfileset prefix="WEB-INF/data/models"
file="/u/nlp/data/ner/goodClassifiers/german.hgc_175m_600.crf.ser.gz"/>
<zipfileset prefix="WEB-INF/data/models"
file="/u/nlp/data/ner/goodClassifiers/chinese.misc.distsim.crf.ser.gz"/>
<zipfileset file="${data.path}/webapps/favicon.ico"/>
</war>
</target>
<target name="corenlp.war" depends="compile,jar"
description="build the corenlp webapp">
<!-- This is built from a java servlet, not a jsp. -->
<!-- The class needed for the results page will already be in
javanlp-core.jar -->
<war destfile="corenlp.war"
webxml="${source.path}/edu/stanford/nlp/pipeline/webapp/WEB-INF/web.xml">
<lib dir=".">
<include name="javanlp-core.jar"/>
</lib>
<lib dir="${basedir}/lib">
<include name="commons-lang3-3.1.jar"/>
<include name="xom-1.2.10.jar"/>
<include name="xml-apis.jar"/>
<include name="joda-time.jar"/>
<include name="jollyday-0.4.7.jar"/>
</lib>
<!-- note for John: c:/Users/John Bauer/nlp/stanford-releases -->
<lib dir="/u/nlp/data/StanfordCoreNLPModels">
<include name="stanford-corenlp-models-current.jar"/>
<include name="stanford-chinese-corenlp-models-current.jar"/>
</lib>
<classes dir="${source.path}/edu/stanford/nlp/pipeline">
<include name="StanfordCoreNLP.properties"/>
</classes>
<zipfileset file="${source.path}/edu/stanford/nlp/pipeline/webapp/header.jsp"/>
<zipfileset file="${source.path}/edu/stanford/nlp/pipeline/webapp/footer.jsp"/>
<zipfileset file="${source.path}/edu/stanford/nlp/pipeline/webapp/brat.js"/>
<zipfileset file="${data.path}/webapps/favicon.ico"/>
<zipfileset prefix="WEB-INF/data"
file="${doc.path}/corenlp/CoreNLP-to-HTML.xsl"/>
</war>
</target>
<property environment="env" />
<condition property="version1.7">
<equals arg1="${ant.java.version}" arg2="1.7" />
</condition>
<target name="tregex-osx" if="version1.7" depends="jar"
description="Build an OS X app for TregexGUI">
<fail unless="env.JAVA_HOME"
message="Environment variable JAVA_HOME not set." />
<taskdef name="bundleapp"
classname="com.oracle.appbundler.AppBundlerTask"
classpath="lib/appbundler-1.0.jar" />
<bundleapp outputdirectory="."
name="Stanford Tregex"
displayname="Stanford Tregex"
icon="doc/tregex/nlp-logo-6x6.icns"
identifier="edu.stanford.nlp.trees.tregex.gui.TregexGUI"
mainclassname="edu.stanford.nlp.trees.tregex.gui.TregexGUI">
<runtime dir="${env.JAVA_HOME}" />
<classpath file="javanlp-core.jar" />
</bundleapp>
</target>
</project>