-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
394 lines (301 loc) · 11.5 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
<project name="JYices" default="instructions" basedir=".">
<description>
yices java bindings
</description>
<!-- most build properties are in build.properties -->
<property file="build.properties"/>
<!-- except version property -->
<property file="version.properties"/>
<!--
customization comes from the environment variables YICES_JNI and YICES_CLASSPATH
YICES_JNI should be the path to where you want the library installed
YICES_CLASSPATH should be where you want the classes installed.
-->
<property environment="env"/>
<property name="pwd" value="${env.PWD}"/>
<condition property="yices_jni" value="${env.YICES_JNI}" else="${pwd}${local_yices_jni}">
<isset property="env.YICES_JNI" />
</condition>
<condition property="yices_classpath" value="${env.YICES_CLASSPATH}" else="${pwd}${local_yices_classpath}">
<isset property="env.YICES_CLASSPATH" />
</condition>
<property name="yices_classpath" value="${env.YICES_CLASSPATH}"/>
<target name="instructions" description="Build instructions">
<echo>
YICES_JNI = ${yices_jni}
YICES_CLASSPATH= ${yices_classpath}
To build the yices jar (dist/lib/yices.jar):
> ant dist
To install the dynamic library libyices2java:
> ant install
To run the junit tests (located in src/test/java/com/sri/yices):
> ant test
To run the examples (located in examples):
> ant examples
To clean up:
> ant clean
To develop (clean then recompile and install):
> ant develop
</echo>
</target>
<!-- set global properties for this build -->
<property name="src" location="src/main/java"/>
<property name="code" location="${src}/com/sri/yices"/>
<property name="test" location="src/test/java/"/>
<property name="test_code" location="${test}/com/sri/yices"/>
<property name="build" location="build"/>
<property name="classes" location="${build}/classes"/>
<property name="test_classes" location="${build}/test_classes"/>
<property name="dist" location="dist"/>
<property name="junit" location="${test}"/>
<property name="examples" location="examples"/>
<property name="jnilib" value="${yices_jni}"/>
<!-- determine the build environment -->
<condition property="isWindows">
<os family="windows" />
</condition>
<condition property="isUnix">
<and>
<os family="unix" />
<not> <os family="mac" /> </not>
</and>
</condition>
<condition property="isDarwin">
<os family="mac" />
</condition>
<target name="forUnix" if="isUnix">
<property name="OS" value="linux"/>
<property name="libraryext" value=".so"/>
</target>
<target name="forWindows" if="isWindows">
<property name="OS" value="windows"/>
<property name="libraryext" value=".dll"/>
</target>
<target name="forDarwin" if="isDarwin">
<property name="OS" value="darwin"/>
<property name="libraryext" value=".dylib"/>
</target>
<target name="sanity-check" depends="forUnix, forWindows, forDarwin">
<property name="library" value="libyices2java${libraryext}"/>
<property environment="env"/>
<echo>
Library extention: ${libraryext}
Operating system: ${OS}
JAVA_HOME: ${JAVA_HOME}
GLOBAL_LIB_DIR: ${GLOBAL_LIB_DIR}
CPPFLAGS: ${CPPFLAGS}
CXXFLAGS: ${CXXFLAGS}
CXX: ${CXX}
LIBS: ${LIBS}
Library: ${library}
JNI Library: ${jnilib}
</echo>
<fail unless="env.JAVA_HOME" message="Please set JAVA_HOME: $$JAVA_HOME/include/jni.h needs to exist."/>
</target>
<target name="init">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
<mkdir dir="${classes}"/>
<mkdir dir="${test_classes}"/>
</target>
<target name="compile" depends="sanity-check,init"
description="compile the source and generate the headers with new 1.8 magic">
<tstamp/>
<echo message="Using version number: ${YICES_JAVA_BINDINGS_VERSION} and date: ${TODAY}"/>
<!-- copy templates and update version numbers -->
<copy overwrite="true" todir="${src}" >
<filterset>
<filter token="VERSION_STRING" value="${YICES_JAVA_BINDINGS_VERSION}"/>
<filter token="BUILD_DATE" value="${TODAY}"/>
</filterset>
<fileset dir="${src}">
<include name="**/*.template"/>
</fileset>
<mapper type="glob" from="*.template" to="*.java"/>
</copy>
<!-- Compile the java code from ${src} into ${build} -->
<echo message="javac: ${code} ==> ${classes}"/>
<javac srcdir="${code}"
destdir="${classes}"
debug="${DEBUG}"
deprecation="${DEPRECATION}"
includeantruntime="false"
nativeheaderdir="${code}">
</javac>
</target>
<target name="dist" depends="compile"
description="generate the distribution">
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file
<jar jarfile="${dist}/lib/yices.jar" basedir="${build}"/>
-->
<tstamp>
<format property="TODAY" pattern="yyyy-MM-dd" />
</tstamp>
<jar compress="false"
manifestencoding="UTF8"
jarfile="${dist}/lib/yices.jar">
<fileset dir="${classes}">
<include name="**"/>
</fileset>
<!-- customize manifest -->
<manifest>
<attribute name="Main-Class" value="com.sri.yices.Version"/>
<section name="yices">
<attribute name="Specification-Title" value="Yices Java Bindings"/>
<attribute name="Specification-Version" value="1.0"/>
<attribute name="Specification-Vendor" value="SRI International"/>
<attribute name="Implementation-Title" value="jyices"/>
<attribute name="Implementation-Version" value="${TODAY}"/>
<attribute name="Implementation-Vendor" value="SRI International"/>
<attribute name="Built-By" value="${user.name}"/>
</section>
</manifest>
</jar>
<echo> Executing "make ${library}" in ${code} </echo>
<exec executable="make"
dir="${code}"
failifexecutionfails="true">
<arg line="${library}"/>
</exec>
</target>
<target name="install" description="install the jni library" depends="dist">
<exec executable="make"
dir="${code}"
failifexecutionfails="true">
<arg line="install"/>
</exec>
</target>
<target name="clean"
description="clean up">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
<delete>
<fileset dir="${examples}" includes="*.class"/>
</delete>
<exec executable="make"
dir="${code}"
failifexecutionfails="true">
<arg line="clean"/>
</exec>
</target>
<path id="classpath.test">
<pathelement location="${dist}/lib/yices.jar"/>
<pathelement location="lib/junit-4.12.jar"/>
<pathelement location="lib/hamcrest-core-1.3.jar"/>
</path>
<target name="test-compile">
<javac srcdir="${junit}" destdir="${test_classes}" includeantruntime="false">
<classpath refid="classpath.test"/>
</javac>
</target>
<target name="test" depends="dist,test-compile,install">
<echo> Running tests </echo>
<echo> test_classes: ${test_classes} </echo>
<echo> java.library.path: ${java.library.path} </echo>
<junit printsummary="on" haltonfailure="yes" fork="true">
<sysproperty key="java.library.path" path="${jnilib}"/>
<classpath>
<path refid="classpath.test"/>
<pathelement location="${test_classes}"/>
</classpath>
<formatter type="brief" usefile="false" />
<test name="com.sri.yices.TestBigRationals"/>
<test name="com.sri.yices.TestConstructor"/>
<test name="com.sri.yices.TestContext"/>
<test name="com.sri.yices.TestStatus"/>
<test name="com.sri.yices.TestTypes"/>
<test name="com.sri.yices.TestYices"/>
<test name="com.sri.yices.TestModels"/>
<!-- <test name="com.sri.yices.TestDelegates"/> -->
<!-- <test name="com.sri.yices.TestDimacs"/> -->
<test name="com.sri.yices.TestThreads"/>
</junit>
</target>
<path id="classpath.examples">
<pathelement location="${dist}/lib/yices.jar"/>
<pathelement location="examples"/>
</path>
<target name="examples" depends="dist">
<javac srcdir="${examples}"
destdir="${examples}"
classpathref="classpath.examples"
debug="${DEBUG}"
deprecation="${DEPRECATION}"
includeantruntime="false">
</javac>
<antcall target="example"> <param name = "class" value="LoadYices"/> </antcall>
<antcall target="example"> <param name = "class" value="MCSat"/> </antcall>
<antcall target="example"> <param name = "class" value="CEx2"/> </antcall>
</target>
<target name="example" depends="dist">
<!-- run the ${class} -->
<echo> Running ${class} </echo>
<java classname="${class}"
dir="${examples}"
fork="true"
classpathref="classpath.examples">
<jvmarg value="-Djava.library.path=${jnilib}"/>
</java>
</target>
<target name="develop" depends="clean, install">
<echo message="Clean rebuild: ${YICES_JAVA_BINDINGS_VERSION} and date: ${TODAY}"/>
</target>
<target name="versiontest" depends="dist,test-compile,install">
<echo> Verion test </echo>
<echo> test_classes: ${test_classes} </echo>
<echo> java.library.path: ${java.library.path} </echo>
<junit printsummary="on" haltonfailure="yes" fork="true">
<sysproperty key="java.library.path" path="${jnilib}"/>
<classpath>
<path refid="classpath.test"/>
<pathelement location="${test_classes}"/>
</classpath>
<formatter type="brief" usefile="false" />
<test name="com.sri.yices.TestVersion"/>
</junit>
</target>
<target name="dimacs" depends="dist,test-compile,install">
<echo> Running new stuff </echo>
<echo> test_classes: ${test_classes} </echo>
<echo> java.library.path: ${java.library.path} </echo>
<junit printsummary="on" haltonfailure="yes" fork="true">
<sysproperty key="java.library.path" path="${jnilib}"/>
<classpath>
<path refid="classpath.test"/>
<pathelement location="${test_classes}"/>
</classpath>
<formatter type="brief" usefile="false" />
<test name="com.sri.yices.TestDimacs"/>
</junit>
</target>
<target name="delegates" depends="dist,test-compile,install">
<echo> Running new stuff </echo>
<echo> test_classes: ${test_classes} </echo>
<echo> java.library.path: ${java.library.path} </echo>
<junit printsummary="on" haltonfailure="yes" fork="true">
<sysproperty key="java.library.path" path="${jnilib}"/>
<classpath>
<path refid="classpath.test"/>
<pathelement location="${test_classes}"/>
</classpath>
<test name="com.sri.yices.TestDelegates"/>
</junit>
</target>
<target name="threads" depends="dist,test-compile,install">
<echo> Running new stuff </echo>
<echo> test_classes: ${test_classes} </echo>
<echo> java.library.path: ${java.library.path} </echo>
<junit printsummary="on" haltonfailure="yes" fork="true">
<sysproperty key="java.library.path" path="${jnilib}"/>
<classpath>
<path refid="classpath.test"/>
<pathelement location="${test_classes}"/>
</classpath>
<formatter type="brief" usefile="false" />
<test name="com.sri.yices.TestThreads"/>
</junit>
</target>
</project>