-
Notifications
You must be signed in to change notification settings - Fork 31
/
build.xml
238 lines (213 loc) · 10.1 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2014 RONDHUIT Co.,Ltd.
Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="rondhuit.w2vl" default="w2vl-jar" basedir=".">
<dirname property="mybase.dir" file="${ant.file.rondhuit.w2vl}"/>
<property file="${mybase.dir}/version.properties"/>
<property file="${mybase.dir}/build.properties"/>
<path id="common.path.lib">
<fileset dir="${lib.dir}" includes="*.jar"/>
</path>
<target name="w2vl-jar" depends="w2vl-compile" description="make w2vl jar file">
<jar destfile="${product.jar}" basedir="${cls.dir}"/>
</target>
<target name="w2vl-compile" description="compile w2vl">
<mkdir dir="${cls.dir}"/>
<javac srcdir="${src.dir}/java"
destdir="${cls.dir}"
encoding="${compile.encoding}"
deprecation="${compile.deprecation}"
source="${compile.source}"
target="${compile.target}"
debug="${compile.debug}">
<classpath refid="common.path.lib"/>
</javac>
</target>
<target name="w2vl-javadoc" description="build w2vl javadoc">
<property name="javadoc.link.java" value="http://docs.oracle.com/javase/jp/6/api/"/>
<delete dir="${javadoc.dir}"/>
<mkdir dir="${javadoc.dir}"/>
<copy todir="${javadoc.dir}/prettify">
<fileset dir="${prettify.dir}"/>
</copy>
<javadoc
overview="src/java/overview.html"
sourcepath="${src.dir}/java"
packagenames="com.rondhuit.w2v.*"
failonerror="true"
destdir="${javadoc.dir}"
access="protected"
encoding="${compile.encoding}"
docencoding="${compile.encoding}"
charset="${compile.encoding}"
additionalparam="-J-Dfile.encoding=${compile.encoding}"
author="true"
version="true"
use="true"
locale="ja_JP"
source="${compile.source}"
windowtitle="${PRODUCT_NAME} ${PRODUCT_VERSION} API"
doctitle="${PRODUCT_NAME} ${PRODUCT_VERSION} API"
stylesheetfile="${javadoc.dir}/prettify/stylesheet+prettify.css"
bottom="Copyright &copy; 2014 <a href="http://www.rondhuit.com/">RONDHUIT Co.,Ltd.</a> All Rights Reserved.">
<classpath refid="common.path.lib"/>
<link href="${javadoc.link.java}"/>
<tag name="rh.warning" description="WARNING"/>
<header><![CDATA[
<a href="http://www.rondhuit.com/">word2vec-java Copyright (c) 2014 RONDHUIT Co.,Ltd.</a>
<script src="{@docRoot}/prettify/prettify.js" type="text/javascript"></script>
<script src="{@docRoot}/d3.v2.min.js" type="text/javascript"></script>
<script language="JavaScript">window.onload=function(){windowTitle();prettyPrint();}</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ["\\(","\\)"]] } });
</script>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<meta http-equiv="X-UA-Compatible" CONTENT="IE=EmulateIE7" />
]]></header>
</javadoc>
</target>
<!-- ================================================================== -->
<!-- = TEST W2VL = -->
<!-- ================================================================== -->
<target name="test" depends="w2vl-compile,test-compile" description="test w2vl.">
<mkdir dir="${test.result.dir}"/>
<junit printsummary="on"
haltonfailure="no"
errorProperty="tests.failed"
failureProperty="tests.failed"
dir="${src.dir}/test">
<jvmarg line="-Xmx512m -Dfile.encoding=UTF-8"/>
<classpath refid="common.path.lib"/>
<classpath path="${cls.dir}"/>
<classpath path="${test.cls.dir}"/>
<classpath path="${src.dir}/test"/>
<formatter type="brief" usefile="false" if="junit.details"/>
<formatter type="plain"/>
<batchtest fork="yes" todir="${test.result.dir}" unless="testcase">
<fileset dir="${src.dir}/test" includes="**/*Test.java"/>
</batchtest>
<batchtest fork="yes" todir="${test.result.dir}" if="testcase">
<fileset dir="${src.dir}/test" includes="**/${testcase}.java"/>
</batchtest>
</junit>
<fail if="tests.failed">***** Tests failed! *****</fail>
</target>
<target name="test-compile" description="compile w2vl tests">
<mkdir dir="${test.cls.dir}"/>
<javac srcdir="${src.dir}/test"
destdir="${test.cls.dir}"
encoding="${compile.encoding}"
deprecation="${compile.deprecation}"
source="${compile.source}"
target="${compile.target}"
debug="${compile.debug}">
<classpath refid="common.path.lib"/>
<classpath path="${cls.dir}"/>
</javac>
</target>
<!-- ================================================================== -->
<!-- = PREPARE TEXT8 = -->
<!-- ================================================================== -->
<target name="t8-solr" unless="t8xml.exists" depends="t8xml-check"
description="provide text8.xml so that the text8 can be indexed easily">
<concat destfile="text8.xml">
<string>
<add>
<doc>
<field name="body">
</string>
<fileset dir="." includes="text8.txt"/>
<string>
</field>
</doc>
</add>
</string>
</concat>
</target>
<target name="t8xml-check" depends="t8-splitter">
<available file="text8.xml" property="t8xml.exists"/>
</target>
<target name="t8-splitter" unless="t8txt.exists" depends="t8txt-check, w2vl-compile"
description="split text8 into multi-lines file so that Word2vec can process the file correctly">
<java classname="com.rondhuit.w2v.Text8Splitter" fork="true">
<jvmarg line="-Dfile.encoding=UTF-8"/>
<arg line="text8 text8.txt"/>
<classpath refid="common.path.lib"/>
<classpath path="${cls.dir}"/>
</java>
</target>
<target name="t8txt-check" depends="t8-unzip">
<available file="text8.txt" property="t8txt.exists"/>
</target>
<target name="t8-unzip" unless="t8.exists" depends="t8-check">
<unzip src="text8.zip" dest="."/>
</target>
<target name="t8-check" depends="t8-download">
<available file="text8" property="t8.exists"/>
</target>
<target name="t8-download" unless="t8zip.exists" depends="t8zip-check"
description="download text8.zip file if it doesn't exist">
<get src="http://mattmahoney.net/dc/text8.zip" dest="text8.zip"/>
</target>
<target name="t8zip-check">
<available file="text8.zip" property="t8zip.exists"/>
</target>
<target name="t8-delete" description="delete the downloaded text8.zip and its derivations">
<delete file="text8.zip"/>
<delete file="text8"/>
<delete file="text8.txt"/>
</target>
<!-- ================================================================== -->
<!-- = PACKAGE = -->
<!-- ================================================================== -->
<target name="package" depends="w2vl-jar, w2vl-javadoc" description="make a package for delivery">
<mkdir dir="${dist.dir}"/>
<tar destfile="${dist.dir}/${product.tgz}" compression="gzip" longfile="gnu">
<tarfileset dir="." prefix="${productfull}" includes="CHANGES.txt"/>
<tarfileset dir="." prefix="${productfull}" includes="${product.jar}"/>
<tarfileset dir="." prefix="${productfull}" includes="api/**"/>
<tarfileset dir="${lib.dir}" prefix="${productfull}/lib" includes="**/*.jar, **/*.txt"/>
<tarfileset dir="${tools.dir}" prefix="${productfull}/tools" includes="**/*.js, **/*.css"/>
<tarfileset dir="projects" prefix="${productfull}/projects" includes="**/*.sample, **/*.html.template, **/*.sh, **/*.xml, **/*.txt" followsymlinks="false"/>
</tar>
<tar destfile="${dist.dir}/${productjavadoc.tgz}" compression="gzip" longfile="gnu">
<tarfileset dir="." prefix="${PRODUCT_VERSION}" includes="api/**"/>
</tar>
</target>
<!-- ================================================================== -->
<!-- = CLEANING = -->
<!-- ================================================================== -->
<target name="clean" description="clean all, except downloaded Solr">
<delete dir="${cls.dir}"/>
<delete dir="${test.cls.dir}"/>
<delete dir="${javadoc.dir}"/>
<delete dir="${test.result.dir}"/>
<delete dir="${dist.dir}"/>
<delete>
<fileset dir="." includes="**/*~" defaultexcludes="no"/>
<fileset dir="." includes="*.jar"/>
</delete>
</target>
<target name="clean-index" description="delete all index directories under solrhome directory">
<delete dir="solrhome/collection1/data/index"/>
<delete dir="solrhome/ldcc/data/index"/>
</target>
<target name="clean-eclipse" description="delete Eclipse files, .project, .classpath and bin/">
<delete dir="bin"/>
<delete>
<fileset dir="." includes=".project,.classpath"/>
</delete>
</target>
</project>