-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.xml
187 lines (162 loc) · 6.02 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
<?xml version="1.0"?>
<project name="jklol" default="jar">
<property name="src-dir" location="src" />
<property name="lib-dir" location="lib" />
<property name="tst-dir" location="test" />
<property name="perf-dir" location="performance" />
<property name="doc-dir" location="javadoc" />
<property name="java-build-dir" location="build" />
<!-- locations for natively compiled files -->
<property name="object-dir" location="obj" />
<property name="bin-dir" location="bin" />
<uptodate property="jklol.o.noBuild" targetfile="${object-dir}/jklol.o">
<srcfiles file="jklol.jar" />
</uptodate>
<uptodate property="libraries.o.noBuild" targetfile="${object-dir}/libraries.o">
<srcfiles dir="lib/" file="*.jar" />
</uptodate>
<path id="classpath.base">
<pathelement location="lib/guava-17.0.jar" />
<pathelement location="lib/jopt-simple-4.9.jar" />
<pathelement location="lib/jackson-annotations-2.2.3.jar" />
<pathelement location="lib/jackson-core-2.2.3.jar" />
<pathelement location="lib/jackson-databind-2.2.3.jar" />
</path>
<path id="classpath.test">
<pathelement location="/usr/share/java/junit.jar" />
<pathelement location="build/" />
<path refid="classpath.base" />
</path>
<path id="classpath.gcj">
<pathelement location="/usr/share/java/junit.jar" />
<pathelement location="lib/gnu-crypto.jar" />
<path refid="classpath.base" />
</path>
<!-- delete all output from compilation -->
<target name="clean">
<delete dir="${java-build-dir}" />
<delete dir="${object-dir}" />
<delete dir="${bin-dir}" />
<delete file="jklol.jar" />
<delete dir="war/WEB-INF/classes" failonerror="false" />
<delete dir="war/jklol" failonerror="false" />
</target>
<!-- compilation targets -->
<target name="compile">
<mkdir dir="${java-build-dir}" />
<javac sourcepath="" srcdir="${src-dir}" destdir="${java-build-dir}" debug="on">
<classpath refid="classpath.base"/>
</javac>
</target>
<target name="compile-test" depends="compile">
<mkdir dir="${java-build-dir}" />
<javac srcdir="${tst-dir}" destdir="${java-build-dir}" debug="on">
<classpath refid="classpath.test"/>
</javac>
<javac srcdir="${perf-dir}" destdir="${java-build-dir}" debug="on">
<classpath refid="classpath.test"/>
</javac>
</target>
<!-- testing targets -->
<target name="test" depends="compile-test">
<junit fork="no" outputtoformatters="false">
<classpath refid="classpath.test" />
<formatter type="brief" usefile="false"/>
<batchtest>
<fileset dir="${tst-dir}" includes="**/*.java">
<include name="**/*.java" />
<!-- Tests inherit from these classes, but they are not tests -->
<exclude name="**/TensorTest.java" />
<exclude name="**/TensorBuilderTest.java" />
<exclude name="**/MarginalTestCase.java" />
<exclude name="**/MaxMarginalTestCase.java" />
<exclude name="**/InferenceTestCases.java" />
</fileset>
</batchtest>
</junit>
</target>
<target name="test-small" depends="compile-test">
<junit fork="no">
<classpath refid="classpath.test" />
<formatter type="brief" usefile="false"/>
<batchtest>
<fileset dir="${tst-dir}" includes="com/jayantkrish/jklol/tensor/*.java">
<include name="com/jayantkrish/jklol/ccg/CachedSparseTensorTest.java" />
</fileset>
</batchtest>
</junit>
</target>
<target name="perf" depends="compile-test">
<java classname="com.jayantkrish.jklol.util.DenseTensorPerformanceTest" >
<classpath refid="classpath.test" />
</java>
</target>
<!-- documentation -->
<target name="javadoc">
<mkdir dir="${doc-dir}" />
<javadoc destdir="${doc-dir}" classpathref="classpath.base">
<fileset dir="${src-dir}" includes="**/*.java" />
</javadoc>
</target>
<!-- create a jar file -->
<target name="jar" depends="compile">
<jar destfile="jklol.jar" basedir="${java-build-dir}" />
</target>
<!-- targets for compiling jklol to a native application using gcj -->
<target name="gcj-jklol" depends="jar" unless="jklol.o.noBuild">
<mkdir dir="${object-dir}" />
<echo message="Building library jklol.o" />
<exec executable="gcj">
<arg value="--classpath" />
<arg value="${toString:classpath.gcj}" />
<arg value="-c" />
<arg value="-g" />
<arg value="-O" />
<arg value="-o" />
<arg value="${object-dir}/jklol.o" />
<arg value="jklol.jar" />
</exec>
</target>
<target name="gcj-libraries" depends="jar" unless="libraries.o.noBuild">
<pathconvert property="classpath-space" pathsep=" ">
<path refid="classpath.gcj" />
</pathconvert>
<echo message="Building libraries from: ${classpath-space}" />
<exec executable="gcj">
<arg value="-c" />
<arg value="-g" />
<arg value="-O" />
<arg value="-o" />
<arg value="${object-dir}/libraries.o" />
<arg line="${classpath-space}" />
</exec>
</target>
<target name="gcj-base" depends="gcj-jklol,gcj-libraries">
<!-- set up objectfiles.path with the compiled .o files -->
<path id="objectfiles.classpath">
<fileset dir="${object-dir}" includes="*.o" />
</path>
<pathconvert property="objectfiles.path" pathsep=" ">
<path refid="objectfiles.classpath" />
</pathconvert>
</target>
<target name="train_ccg" depends="gcj-base">
<mkdir dir="${bin-dir}" />
<exec executable="gcj">
<arg value="--main=com.jayantkrish.jklol.cli.TrainCcg" />
<arg value="-o" />
<arg value="${bin-dir}/train_ccg" />
<arg line="${objectfiles.path}" />
</exec>
</target>
<target name="parse_ccg" depends="gcj-base">
<mkdir dir="${bin-dir}" />
<exec executable="gcj">
<arg value="--main=com.jayantkrish.jklol.cli.ParseCcg" />
<arg value="-o" />
<arg value="${bin-dir}/parse_ccg" />
<arg line="${objectfiles.path}" />
</exec>
</target>
<target name="gcj" depends="train_ccg,parse_ccg"/>
</project>