forked from lintool/Mr.LDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
195 lines (167 loc) · 7.75 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
<project name="Mr.LDA" default="scripts"
xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:artifact="antlib:org.apache.maven.artifact.ant" basedir=".">
<description>LDA in MapReduce</description>
<property name="lib.dir" value="lib" />
<property name="build.dir" value="build"/>
<property name="src.dir" value="src"/>
<property name="dist.dir" value="dist"/>
<property name="test.dir" location="test" />
<property name="javadoc.dir" location="docs/api/" />
<property name="bin.dir" location="bin" />
<property name="version" value="0.0.1"/>
<!-- paths used for compilation and run -->
<path id="lib.path.id">
<fileset dir="${lib.dir}" />
</path>
<path id="run.path.id">
<path refid="lib.path.id" />
<path location="${build.dir}" />
</path>
<property name="ivy.install.version" value="2.2.0"/>
<property name="ivy.jar.dir" value="${basedir}/ivy"/>
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
<property name="ivy.settings.file" value="${basedir}/ivy/ivysettings.xml" />
<property name="ivy.dep.file" value="${basedir}/ivy/ivy.xml" />
<target name="init">
<tstamp />
<condition property="platform" value="unix">
<os family="unix" />
</condition>
<condition property="platform" value="unix">
<os family="mac" />
</condition>
<condition property="platform" value="windows">
<os family="windows" />
</condition>
<mkdir dir="${build.dir}" />
<mkdir dir="${lib.dir}" />
<mkdir dir="${dist.dir}" />
<mkdir dir="${bin.dir}" />
</target>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<target name="download-ivy" unless="skip.download">
<echo message="installing ivy..."/>
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<!-- try to load ivy here from local ivy dir, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
<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"/>
</target>
<target name="resolve" depends="install-ivy" description="--> retreive dependencies with ivy">
<ivy:retrieve/>
</target>
<target name="report" depends="resolve" description="--> generates a report of dependencies">
<ivy:report todir="${build.dir}"/>
</target>
<target name="compile" depends="init,resolve" description="compile the source ">
<javac classpathref="lib.path.id" srcdir="${src.dir}/main/java" destdir="${build.dir}" optimize="on" debug="on">
<compilerarg value="-Xlint:unchecked" />
</javac>
<javac classpathref="lib.path.id" srcdir="${src.dir}/test/java" destdir="${build.dir}" optimize="on" debug="on">
<compilerarg value="-Xlint:unchecked" />
</javac>
<copy todir="${build.dir}">
<fileset dir="${src.dir}/main/java" excludes="**/*.java" />
<fileset dir="${src.dir}/test/java" excludes="**/*.java" />
</copy>
</target>
<target name="jar" depends="compile" description="generate the distribution">
<jar jarfile="${dist.dir}/mrlda-${version}.jar" basedir="${build.dir}" />
</target>
<target name="export" depends="compile" description="generate Jar with all libs">
<jar jarfile="${bin.dir}/Mr.LDA-${version}.jar" basedir="${build.dir}">
<zipgroupfileset dir="${lib.dir}" includes="*.jar"/>
</jar>
</target>
<target name="dist" depends="jar,javadoc" description="generate the distribution">
<jar jarfile="${dist.dir}/mrlda-${version}-sources.jar" basedir="${src.dir}" />
<jar jarfile="${dist.dir}/mrlda-${version}-javadoc.jar" basedir="${javadoc.dir}" />
</target>
<target name="clean" description="clean up">
<delete dir="${test.dir}" />
<delete dir="${build.dir}" />
<delete dir="${lib.dir}" />
<delete dir="${dist.dir}" />
<delete dir="${javadoc.dir}" />
<delete dir="${bin.dir}" />
</target>
<target name="test" depends="jar" description="Execute Unit Tests">
<mkdir dir="${test.dir}" />
<junit printsummary="yes" fork="yes" maxmemory="1024m">
<sysproperty key="java.library.path" path="${lib.dir}" />
<sysproperty key="org.xml.sax.driver" value="org.apache.xerces.parsers.SAXParser" />
<classpath refid="run.path.id" />
<formatter type="xml" />
<batchtest todir="${test.dir}">
<fileset dir="${build.dir}">
<include name="**/*Test.class" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${test.dir}">
<fileset dir="${test.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="noframes" styledir="etc/" todir="${test.dir}" />
</junitreport>
</target>
<target name="javadoc">
<javadoc destdir="${javadoc.dir}" access="public" use="true" notree="false" nonavbar="false" noindex="false" splitindex="no" author="true" version="true" nodeprecatedlist="false" nodeprecated="false" classpathref="lib.path.id">
<fileset dir="src/main/java">
<include name="**/*.java" />
</fileset>
<link href="http://java.sun.com/javase/6/docs/api/" />
</javadoc>
<copy todir="${javadoc.dir}">
<fileset dir="${src.dir}/main/java">
</fileset>
</copy>
</target>
<target name="scripts" depends="jar">
<pathconvert property="run.path.id" refid="run.path.id" targetos="${platform}" />
<condition property="suffix" value="sh">
<equals arg1="${platform}" arg2="unix" />
</condition>
<condition property="suffix" value="bat">
<equals arg1="${platform}" arg2="windows" />
</condition>
<condition property="param_prefix" value="$">
<equals arg1="${platform}" arg2="unix" />
</condition>
<condition property="param_prefix" value="%">
<equals arg1="${platform}" arg2="windows" />
</condition>
<condition property="java" value="java">
<equals arg1="${platform}" arg2="unix" />
</condition>
<condition property="java" value="java">
<equals arg1="${platform}" arg2="windows" />
</condition>
<condition property="cp_sep" value=":">
<equals arg1="${platform}" arg2="unix" />
</condition>
<condition property="cp_sep" value=";">
<equals arg1="${platform}" arg2="windows" />
</condition>
<property name="java_command" value="${java} -Xmx2g -classpath "${run.path.id}"" />
<condition property="script_prefix" value="#!/bin/sh${line.separator}if test -s ~/.bashrc${line.separator}then${line.separator}source ~/.bashrc${line.separator}fi${line.separator}">
<equals arg1="${platform}" arg2="unix" />
</condition>
<condition property="script_prefix" value="">
<equals arg1="${platform}" arg2="windows" />
</condition>
<echo file="./etc/junit.${suffix}" message="${script_prefix}" />
<echo file="./etc/junit.${suffix}" message="${java_command} org.junit.runner.JUnitCore " append="true" />
<echo file="./etc/junit.${suffix}" message="${param_prefix}1" append="true" />
<echo file="./etc/run.${suffix}" message="${script_prefix}" />
<echo file="./etc/run.${suffix}" message="${java_command} " append="true" />
<echo file="./etc/run.${suffix}" message="${param_prefix}1 ${param_prefix}2 ${param_prefix}3 ${param_prefix}4 ${param_prefix}5 ${param_prefix}6 ${param_prefix}7 ${param_prefix}8 ${param_prefix}9" append="true" />
</target>
</project>