-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathbuild.xml
More file actions
961 lines (875 loc) · 39.7 KB
/
Copy pathbuild.xml
File metadata and controls
961 lines (875 loc) · 39.7 KB
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
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
<project xmlns:ivy="antlib:org.apache.ivy.ant"
name="SigmaKEE" default="all" basedir=".">
<description>
This build file is meant to be invoked only from the command line. It's
purpose is for building/testing in a CI/CD environment
</description>
<!--
===
IVY
===
-->
<property name="ivy.install.version" value="2.5.1"/>
<property name="ivy.home" value="${basedir}/.ivy"/>
<property name="ivy.jar.dir" value="${ivy.home}/lib"/>
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
<target name="check.for.ivy.jar">
<available file="${ivy.jar.file}" property="ivy.present"/>
</target>
<target name="download-ivy" depends="check.for.ivy.jar" unless="ivy.present">
<mkdir dir="${ivy.jar.dir}"/>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="init-ivy" depends="download-ivy">
<!-- try to load Ivy here from Ivy home, 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. -->
<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"/>
<ivy:retrieve/>
<path id="compile.classpath">
<fileset dir="${basedir}/lib">
<include name="*.jar"/>
<exclude name="junit*"/>
<exclude name="hamcrest*"/>
</fileset>
</path>
<path id="compile.test.classpath">
<path refid="compile.classpath"/>
<pathelement location="${build.classes}"/>
<pathelement path="lib/hamcrest-core-1.3.jar:lib/junit-4.13.2.jar"/>
<fileset dir="${env.CATALINA_HOME}/lib">
<include name="*.jar"/>
</fileset>
<pathelement location="${env.CATALINA_HOME}/bin/tomcat-juli.jar"/>
<pathelement location="${ant.home}/lib/ant.jar"/>
</path>
<path id="run.test.classpath">
<path refid="compile.test.classpath"/>
<pathelement location="${build.test.classes}"/>
</path>
</target>
<!--
====
INIT
====
-->
<property name="impl.title" value="${ant.project.name}"/>
<property name="product.Name" value="Sigma Knowledge Engineering Environment (${impl.title})"/>
<property name="product.version.major" value="3"/>
<property name="product.version.minor" value="0"/>
<property name="product.version.patch" value="0"/>
<property name="product.Version" value="${product.version.major}.${product.version.minor}.${product.version.patch}"/>
<property name="spec.vendor" value="Adam Pease"/>
<property name="nps" value="Naval Postgraduate School (NPS), Monterey, CA"/>
<property name="cs.dept" value="Computer Science (CS) DEPT"/>
<property name="sumo.url" value="http://www.ontologyportal.org"/>
<property name="manifest.mf" value="MANIFEST.MF"/>
<property name="main.class" value="com.articulate.sigma.KB"/>
<property name="impl.vendor.id" value="edu.nps.cs"/>
<property name="src.dir" value="src/java"/>
<property name="test.corpus.dir" value="test/corpus/java"/>
<property name="test.integration.dir" value="test/integration/java"/>
<property name="test.unit.dir" value="test/unit/java"/>
<property name="app.name" value="sigma"/>
<property name="web.app.name" value="${app.name}kee"/>
<property name="build.home" value="build"/>
<property name="build.classes" value="${build.home}/classes"/>
<property name="build.test.classes" value="${build.home}/test/classes"/>
<property name="dist.javadoc.dir" value="doc"/>
<property name="web.dir" value="web"/>
<property name="reports.dir" value="${build.home}/test/results"/>
<property name="unit.test.suite" value="com.articulate.sigma.UnitTestSuite"/>
<property name="integration.test.suite" value="com.articulate.sigma.IntegrationTestSuite"/>
<property name="report.html" value="file:${basedir}/${reports.dir}/html/index.html"/>
<property environment="env"/>
<!-- External ATP tests:
- default ON locally
- default OFF on GitHub Actions
- allow manual override via env RUN_EXTERNAL_ATP_TESTS -->
<condition property="external.atp.tests.enabled" value="${env.RUN_EXTERNAL_ATP_TESTS}">
<isset property="env.RUN_EXTERNAL_ATP_TESTS"/>
</condition>
<condition property="external.atp.tests.enabled" value="true" else="false">
<not>
<isset property="env.GITHUB_ACTIONS"/>
</not>
</condition>
<property name="tomcat.home" value="${env.CATALINA_HOME}"/>
<property name="dist.home" value="${tomcat.home}/webapps"/>
<property name="dist.war" value="${dist.home}/${app.name}.war"/>
<property name="deploy.home" value="${dist.home}/${app.name}"/>
<property name="git.home" value="${env.ONTOLOGYPORTAL_GIT}"/>
<property name="sigma.src" value="${git.home}/${web.app.name}"/>
<property name="basedir" value="${sigma.src}"/>
<property name="sigma.home" value="${env.SIGMA_HOME}"/>
<property name="tptp.home" value="../TPTP-ANTLR"/>
<property name="sigma.install.downloads" value="${sigma.home}/downloads"/>
<property name="sigma.utils.home" value="../SigmaUtils"/>
<property name="sigma.antlr.home" value="../sigmaAntlr"/>
<property name="kbs.home" value="${git.home}/sumo"/>
<property name="javac.release" value="21"/>
<property name="run.jvmargs" value="-Xmx10g -Xss1m"/>
<property name="tomcat.version" value="9.0.107"/>
<!-- Define the sigma installation space -->
<property name="install.home" value="${user.home}"/>
<!-- The above property can be overriden on the command line with:
-Dinstall.home=/data/fsg, or any other path the user deems necessary
-->
<property name="programs.dir" value="${install.home}${file.separator}Programs"/>
<condition property="isUnixNotMac">
<and>
<os family="unix"/>
<not>
<os family="mac"/>
</not>
</and>
</condition>
<!--
=========================
External ATP configuration
=========================
-->
<!-- OS flags -->
<condition property="is.windows">
<os family="windows"/>
</condition>
<condition property="is.mac">
<os family="mac"/>
</condition>
<condition property="is.unix">
<os family="unix"/>
</condition>
<!-- Vampire ATP -->
<property name="vampire.version" value="v5.0.1"/>
<!-- LEO-III (Higher-Order ATP) -->
<property name="leo.version" value="1.7.18"/>
<!-- Leo-III ZIP on Zenodo for v1.7.18 -->
<property name="leo.zip.url"
value="https://zenodo.org/records/15149454/files/leoprover/Leo-III-v1.7.18.zip?download=1"/>
<!-- Fallback: GitHub release asset (zip) -->
<property name="leo.zip.url.fallback"
value="https://github.com/leoprover/Leo-III/releases/download/v${leo.version}/Leo-III-v${leo.version}.zip"/>
<!-- Where we download the ZIP before extracting -->
<property name="leo.zip.file"
value="${install.home}${file.separator}downloads${file.separator}Leo-III-v${leo.version}.zip"/>
<property name="leo.install.dir" value="${programs.dir}${file.separator}Leo-III"/>
<property name="leo.bin.dir" value="${leo.install.dir}${file.separator}bin"/>
<property name="leo.jar.file" value="${leo.bin.dir}${file.separator}leo3.jar"/>
<property name="leo.exec.unix" value="${leo.bin.dir}${file.separator}leo3"/>
<property name="leo.exec.win" value="${leo.bin.dir}${file.separator}leo3.bat"/>
<condition property="leo.exec.path" value="${leo.exec.win}" else="${leo.exec.unix}">
<os family="windows"/>
</condition>
<path id="core.sourcepath">
<pathelement path="${src.dir}/com/articulate/sigma"/>
<pathelement path="${src.dir}/com/articulate/delphi"/>
</path>
<path id="test.sourcepath">
<pathelement path="${test.corpus.dir}/com/articulate/sigma"/>
<pathelement path="${test.unit.dir}/com/articulate/sigma"/>
<pathelement path="${test.integration.dir}/com/articulate/sigma"/>
</path>
<target name="init" depends="init-ivy">
<condition property="jdk21+">
<javaversion atleast="21"/>
</condition>
<fail message="Unsupported JDK version: ${ant.java.version}. Please use a Java Development Kit (JDK) version 21 or greater."
unless="jdk21+">
</fail>
<condition property="nojdk">
<contains string="${java.home}" substring="jdk"/>
</condition>
<fail message="Please install a Java Development Kit (JDK) version 21 or greater."
unless="nojdk">
</fail>
<echo message="Welcome to the ${product.Name} v${product.Version}"/>
<echo message="Specification Vendor: ${spec.vendor}"/>
<echo message=""/>
<echo message="CATALINA_HOME is set to: ${tomcat.home}"/>
<echo message="SIGMA_HOME is set to: ${sigma.home}"/>
<echo message="SIGMA_SRC is set to: ${sigma.src}"/>
<echo message="KBs_HOME is set to: ${kbs.home}"/>
<echo message="Git dir is set to: ${git.home}"/>
<echo message="basedir is set to: ${basedir}"/>
<echo message="classpath: ${env.SIGMA_CP}"/>
<echo message="Java Version via Ant: ${ant.java.version}"/>
<echo message="Java Version System Prop: ${java.version}"/>
<echo message="JDK HOME: is set to: ${java.home}"/>
<tstamp>
<format property="TODAY_US" pattern="EEE, d MMM yyyy HHmm Z" locale="en,US"/>
</tstamp>
</target>
<!--
============
TEST CONFIGS
============
-->
<!-- Replace placeholders in test config XMLs with portable paths for the current machine -->
<target name="prepare.test.configs" depends="init"
description="Update test config XML files with the current user name and home directory.">
<echo message="Updating test config XML files for user ${user.name} (home: ${user.home})"/>
<!-- 1) Make home path portable (macOS: /Users/..., Linux: /home/...) -->
<replace token="/home/theuser" value="${user.home}">
<fileset dir="${basedir}">
<!-- Integration test configs -->
<include name="test/integration/java/resources/config_all.xml"/>
<include name="test/integration/java/resources/config_topAndMid.xml"/>
<include name="test/integration/java/resources/config_topOnly.xml"/>
<!-- Unit test configs -->
<include name="test/unit/java/resources/config_all.xml"/>
<include name="test/unit/java/resources/config_topAndMid.xml"/>
<include name="test/unit/java/resources/config_topOnly.xml"/>
</fileset>
</replace>
<!-- 2) Replace remaining username placeholder -->
<replace token="theuser" value="${user.name}">
<fileset dir="${basedir}">
<!-- Integration test configs -->
<include name="test/integration/java/resources/config_all.xml"/>
<include name="test/integration/java/resources/config_topAndMid.xml"/>
<include name="test/integration/java/resources/config_topOnly.xml"/>
<!-- Unit test configs -->
<include name="test/unit/java/resources/config_all.xml"/>
<include name="test/unit/java/resources/config_topAndMid.xml"/>
<include name="test/unit/java/resources/config_topOnly.xml"/>
</fileset>
</replace>
</target>
<!--
============
BUILD / DIST
============
-->
<target name="build.antlr" depends="init">
<echo message="SIGMA_HOME is set to: ${sigma.home}"/>
<echo message="TPTP is set to: ${tptp.home}"/>
<ant antfile="${tptp.home}/build.xml" inheritAll="false" target="all"/>
<copy todir="${basedir}/lib" file="${tptp.home}/tptp.jar"/>
<copy todir="${basedir}/lib" file="${sigma.utils.home}/sigmaUtils.jar"/>
<ant antfile="${sigma.antlr.home}/build.xml" inheritAll="false" target="all"/>
<copy todir="${basedir}/lib" file="${sigma.antlr.home}/sigmaAntlr.jar"/>
</target>
<target name="compile" depends="build.antlr" description="Compile the project and place in ${build.classes}.">
<mkdir dir="${build.classes}"/>
<javac destdir="${build.classes}"
debug="on"
optimize="on"
deprecation="off"
includeantruntime="false"
release="${javac.release}">
<src refid="core.sourcepath"/>
<classpath>
<path refid="compile.classpath"/>
<pathelement location="${tptp.home}/build/classes"/>
<pathelement location="${tptp.home}/tptp.jar"/>
</classpath>
</javac>
</target>
<target name="compile.test" depends="compile" description="Compile the project's test classes.">
<mkdir dir="${build.test.classes}"/>
<javac destdir="${build.test.classes}"
debug="on"
optimize="on"
deprecation="on"
includeantruntime="false"
classpathref="compile.test.classpath"
release="${javac.release}">
<src refid="test.sourcepath"/>
</javac>
<mkdir dir="${reports.dir}"/>
</target>
<target name="generate-version" description="Write version.properties to build/classes">
<mkdir dir="${build.classes}"/>
<!-- If build.commit was not passed on the command line, try to get it from git -->
<exec executable="git" outputproperty="git.commit.sha" failifexecutionfails="false" errorproperty="">
<arg value="rev-parse"/>
<arg value="--short"/>
<arg value="HEAD"/>
</exec>
<!-- Use git SHA if available -->
<condition property="build.commit" value="${git.commit.sha}">
<and>
<isset property="git.commit.sha"/>
<not><equals arg1="${git.commit.sha}" arg2=""/></not>
</and>
</condition>
<!-- Fallback to "dev" if git was unavailable or build.commit not set by caller -->
<property name="build.commit" value="dev"/>
<!-- Get the date of the current commit (not the build date) -->
<exec executable="git" outputproperty="git.commit.date" failifexecutionfails="false" errorproperty="">
<arg value="log"/>
<arg value="-1"/>
<arg value="--format=%cs"/>
</exec>
<property name="git.commit.date" value=""/>
<echo file="${build.classes}/version.properties" append="false">build.version=${product.Version}-${build.commit}
build.commit=${build.commit}
build.date=${git.commit.date}
</echo>
</target>
<target name="dist" depends="compile.test,generate-version" description="Create the *.war file and place in $CATALINA_HOME/webapps/sigma, create sigmakee.jar.">
<manifest file="${manifest.mf}">
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Title"
value="${product.Name}"/>
<attribute name="Specification-Version"
value="${product.version.major}.${product.version.minor}"/>
<attribute name="Specification-Vendor"
value="${spec.vendor}"/>
<attribute name="Implementation-Title"
value="${impl.title}"/>
<attribute name="Implementation-Version"
value="${product.Version} built on ${TODAY_US}"/>
<attribute name="Implementation-Vendor"
value="${nps}, ${cs.dept}"/>
<attribute name="Implementation-URL"
value="${sumo.url}"/>
<attribute name="Implementation-Vendor-Id"
value="${impl.vendor.id}"/>
<attribute name="Main-Class"
value="${main.class}"/>
</manifest>
<war destfile="${dist.war}"
webxml="${web.dir}/web.xml"
manifest="${manifest.mf}">
<metainf file="LICENSE"/>
<metainf file="${web.dir}/context.xml"/>
<zipfileset dir="${web.dir}/jsp"/>
<zipfileset file="${web.dir}/simple.css"/>
<zipfileset dir="${web.dir}/pixmaps" prefix="pixmaps"/>
<zipfileset dir="${web.dir}/javascript" prefix="javascript"/>
<lib dir="${basedir}/lib">
<exclude name="junit*"/>
<exclude name="hamcrest-core*"/>
<exclude name="tomcat-servlet-api*"/>
</lib>
<classes dir="${build.classes}"/>
</war>
<jar destfile="${build.home}/${web.app.name}.jar"
manifest="${manifest.mf}"
basedir="${build.classes}">
<metainf file="LICENSE"/>
</jar>
</target>
<!--
==========
UNIT TESTS
==========
-->
<target name="test" depends="test.unit,test.integration"/>
<target name="test.unit" depends="prepare.test.configs,compile.test" description="Runs the UnitTestSuite">
<junit printsummary="yes"
showoutput="yes"
fork="yes">
<jvmarg line="${run.jvmargs}"/>
<!-- Make LeoExecutableConfigTest run locally, skip on GitHub Actions -->
<env key="RUN_EXTERNAL_ATP_TESTS" value="${external.atp.tests.enabled}"/>
<formatter type="plain" usefile="false"/>
<classpath>
<path refid="run.test.classpath"/>
</classpath>
<test name="${unit.test.suite}" haltonfailure="no" todir="${reports.dir}">
<formatter type="xml"/>
</test>
</junit>
<antcall target="junit.report"/>
</target>
<target name="test.integration" depends="prepare.test.configs,compile.test" description="Runs the IntegrationTestSuite">
<junit printsummary="yes"
showoutput="yes"
fork="yes">
<jvmarg line="${run.jvmargs}"/>
<formatter type="plain" usefile="false"/>
<classpath>
<path refid="run.test.classpath"/>
</classpath>
<test name="${integration.test.suite}" haltonfailure="no" todir="${reports.dir}">
<formatter type="xml"/>
</test>
</junit>
<antcall target="junit.report"/>
</target>
<target name="junit.report" >
<junitreport todir="${reports.dir}">
<fileset dir="${reports.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${reports.dir}/html"/>
</junitreport>
<antcall target="open.junit.report"/>
</target>
<target name="open.junit.report" depends="report.mac,report.unix"/>
<target name="report.mac" unless="isUnixNotMac">
<exec executable="sh" osfamily="mac">
<arg value="-c"/>
<arg value="open -u ${report.html}"/>
</exec>
</target>
<target name="report.unix" if="isUnixNotMac">
<exec executable="sh" osfamily="unix">
<arg value="-c"/>
<arg value="xdg-open ${report.html}"/>
</exec>
</target>
<!--
=====
ADMIN
=====
-->
<!-- target name="all" depends="dist, api_doc" -->
<target name="all" depends="clean,dist">
<echo>System date/time is: ${TODAY_US}</echo>
</target>
<!-- Works only from the CLI -->
<target name="clean" description="Delete old build, lib, dist and deployed web aritifacts">
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${build.home}"/> <!-- avoid problems with package name changes by deleting everything -->
<!-- Delete the old web code -->
<fileset dir="${deploy.home}"/>
<fileset dir="${tomcat.home}/work/Catalina/localhost/${app.name}"/>
<!-- Prune out of date dependencies -->
<fileset dir="${basedir}/lib"> <!-- keep ./lib -->
<include name="*.jar"/>
</fileset>
</delete>
<delete file="${dist.war}"/>
</target>
<!-- At this point we will assume you have already complied with the
README.md under the heading "System preparation on Linux." This task
will take over from the heading "Linux Installation." -->
<target name="install" depends="init" description="Clones Sigma tools, installs WordNetMappings and SUMO to ${sigma.home}/KBs and builds the E and Vampire Theorem provers">
<!-- ${git.home} should already have been made -->
<mkdir dir="${programs.dir}"/>
<mkdir dir="${sigma.home}"/>
<mkdir dir="${sigma.home}/KBs"/>
<!-- Clone the supporting sigma tools -->
<antcall target="clone.sigmautils"/>
<antcall target="clone.tptpantlr"/>
<antcall target="clone.sigmaantlr"/>
<antcall target="clone.sumo"/>
<!-- Install Tomcat -->
<antcall target="install.tomcat"/>
<!-- Retrieve WordNet -->
<antcall target="retrieve.wordnet"/>
<!-- Install LEO-III (Higher-Order ATP) -->
<antcall target="install.Leo"/>
<!-- Copy config.xml, sumo and WordNet files to ${sigma.home}/KBs -->
<antcall target="setup.sigma.home"/>
<!-- Retrieve E prover -->
<antcall target="retrieve.E"/>
<!--<antcall target="clone.E"/>-->
<!-- Build E theorem prover -->
<antcall target="build.E"/>
<!-- Clone and build Vampire theorem prover w/ Z3 -->
<antcall target="clone.vampire"/>
<antcall target="clone.z3"/>
<antcall target="build.z3"/>
<antcall target="build.vampire"/>
<!-- perms -->
<chmod dir="${git.home}" perm="ugo+rw" includes="**/*"/>
<chmod dir="${programs.dir}" perm="ugo+rw" includes="**/*"/>
<chmod dir="${programs.dir}" perm="ugo+x" includes="**/*.sh"/>
<chmod dir="${sigma.home}" perm="ugo+rw" includes="**/*"/>
</target>
<target name="clone.sigmautils">
<mkdir dir="${git.home}/SigmaUtils"/>
<git command="clone" dir="${git.home}/SigmaUtils">
<args>
<arg value="--progress"/>
<arg value="--verbose"/>
<arg value="https://github.com/ontologyportal/SigmaUtils"/>
<arg value="${git.home}/SigmaUtils"/>
</args>
</git>
</target>
<target name="clone.tptpantlr">
<mkdir dir="${git.home}/TPTP-ANTLR"/>
<git command="clone" dir="${git.home}/TPTP-ANTLR">
<args>
<arg value="--progress"/>
<arg value="--verbose"/>
<arg value="https://github.com/ontologyportal/TPTP-ANTLR"/>
<arg value="${git.home}/TPTP-ANTLR"/>
</args>
</git>
</target>
<target name="clone.sigmaantlr">
<mkdir dir="${git.home}/sigmaAntlr"/>
<git command="clone" dir="${git.home}/sigmaAntlr">
<args>
<arg value="--progress"/>
<arg value="--verbose"/>
<arg value="https://github.com/ontologyportal/sigmaAntlr"/>
<arg value="${git.home}/sigmaAntlr"/>
</args>
</git>
</target>
<target name="clone.sumo">
<mkdir dir="${kbs.home}"/>
<git command="clone" dir="${kbs.home}">
<args>
<arg value="--progress"/>
<arg value="--verbose"/>
<arg value="https://github.com/ontologyportal/sumo"/>
<arg value="${kbs.home}"/>
</args>
</git>
</target>
<!-- If on macOS, can also install tomcat w/ Homebrew -->
<target name="install.tomcat">
<get src="https://archive.apache.org/dist/tomcat/tomcat-9/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip" dest="${programs.dir}" tryGzipEncoding="true"/>
<unzip src="${programs.dir}/apache-tomcat-${tomcat.version}.zip" dest="${programs.dir}"/>
<chmod dir="${programs.dir}/apache-tomcat-${tomcat.version}/bin" perm="ugo+rx" includes="**/*.sh"/>
<chmod dir="${programs.dir}/apache-tomcat-${tomcat.version}/webapps" perm="ugo+rx" includes="**/*.sh"/>
<delete file="${programs.dir}/apache-tomcat-${tomcat.version}.zip"/>
</target>
<target name="retrieve.wordnet">
<get src="https://wordnetcode.princeton.edu/3.0/WordNet-3.0.tar.gz" dest="${programs.dir}" tryGzipEncoding="true"/>
<untar src="${programs.dir}/WordNet-3.0.tar.gz" dest="${programs.dir}" compression="gzip"/>
<delete file="${programs.dir}/WordNet-3.0.tar.gz"/>
</target>
<target name="setup.sigma.home" description="Copy WordNetMappings, sumo kbs and config.xml to ~/.sigmakee/KBs -> ($SIGMA_HOME)/KBs">
<antcall target="refresh.kbs"/>
<copy todir="${sigma.home}/KBs/WordNetMappings">
<fileset dir="${programs.dir}/WordNet-3.0/dict"/>
</copy>
<antcall target="sigma.config"/>
</target>
<!-- When online SUMO KB files get comitted do this frequently -->
<target name="refresh.kbs" depends="update.sumo" description="Copy refreshed KBs from SUMO to ~/.sigmakee -> ($SIGMA_HOME)">
<copy todir="${sigma.home}/KBs">
<fileset dir="${kbs.home}">
<exclude name=".github/**"/>
<exclude name="SimpleFacts/**"/>
<exclude name="mappings/**"/>
<exclude name="tests/**"/>
</fileset>
</copy>
</target>
<target name="sigma.config">
<available file="${sigma.home}/KBs/config.xml" property="sigma.config.exists"/>
<antcall target="sigma.config.copy.template"/>
<replace file="${sigma.home}/KBs/config.xml" token="/home/theuser/workspace/sumo" value="${kbs.home}"/>
<replace file="${sigma.home}/KBs/config.xml" token="/home/theuser" value="${user.home}"/>
<!-- External ATP executables -->
<replace file="${sigma.home}/KBs/config.xml" token="${user.home}/leo" value="${leo.exec.path}"/>
<replace file="${sigma.home}/KBs/config.xml" token="${user.home}/E/bin/e_ltb_runner" value="${programs.dir}${file.separator}E${file.separator}PROVER${file.separator}e_ltb_runner"/>
<replace file="${sigma.home}/KBs/config.xml" token="/usr/local/tomcat/apache-tomcat-${tomcat.version}/webapps/sigma/tests" value="${programs.dir}${file.separator}tomcat${file.separator}apache-tomcat-${tomcat.version}${file.separator}webapps${file.separator}sigma${file.separator}tests"/>
<replace file="${sigma.home}/KBs/config.xml" token="${user.home}/Programs/vampire/build/vampire" value="${programs.dir}${file.separator}vampire${file.separator}build${file.separator}vampire"/>
</target>
<target name="sigma.config.copy.template" unless="sigma.config.exists">
<copy tofile="${sigma.home}/KBs/config.xml"
file="${sigma.src}/test/unit/java/resources/config_topAndMid.xml"
overwrite="false"/>
</target>
<!--
=======================
LEO-III install (leo3)
=======================
-->
<target name="download.Leo.zip">
<mkdir dir="${sigma.install.downloads}"/>
<!-- Try Zenodo first (do NOT fail the build if Zenodo is down) -->
<get src="${leo.zip.url}"
dest="${leo.zip.file}"
usetimestamp="true"
ignoreerrors="true"/>
<!-- Did Zenodo succeed? -->
<available file="${leo.zip.file}" property="leo.zip.present"/>
<!-- If Zenodo failed, try GitHub fallback (also non-fatal) -->
<get src="${leo.zip.url.fallback}"
dest="${leo.zip.file}"
usetimestamp="true"
ignoreerrors="true"
verbose="true"/>
<!-- Final check -->
<available file="${leo.zip.file}" property="leo.zip.present.final"/>
<!-- If still missing, we skip Leo installation (but do NOT fail install) -->
<condition property="leo.skip.install">
<not>
<isset property="leo.zip.present.final"/>
</not>
</condition>
<echo message="Leo-III ZIP present? ${leo.zip.present.final}"/>
<echo message="Leo-III install will be skipped? ${leo.skip.install}"/>
</target>
<target name="install.Leo" depends="install.Leo.common,install.Leo.unix-perms"
unless="leo.skip.install"
description="Installs Leo-III (leo3.jar + launcher) into ${leo.install.dir}"/>
<target name="install.Leo.common" depends="download.Leo.zip" unless="leo.skip.install">
<mkdir dir="${leo.bin.dir}"/>
<!-- Unzip into Leo-III install dir -->
<unzip src="${leo.zip.file}" dest="${leo.install.dir}"/>
<!-- Copy leo3.jar from wherever it lands inside the zip into bin/leo3.jar -->
<copy tofile="${leo.jar.file}" overwrite="true" flatten="true">
<fileset dir="${leo.install.dir}">
<include name="**/leo3.jar"/>
</fileset>
</copy>
<!-- Create leo3 launcher for Unix-like systems -->
<echo file="${leo.exec.unix}" append="false"><![CDATA[#!/usr/bin/env sh
DIR="$(cd "$(dirname "$0")" && pwd)"
exec java -jar "$DIR/leo3.jar" "$@"
]]></echo>
<!-- Create leo3 launcher for Windows -->
<echo file="${leo.exec.win}" append="false"><![CDATA[@echo off
set DIR=%~dp0
java -jar "%DIR%leo3.jar" %*
]]></echo>
</target>
<target name="install.Leo.unix-perms" if="is.unix" unless="leo.skip.install">
<mkdir dir="${leo.bin.dir}"/>
<chmod file="${leo.exec.unix}" perm="ugo+rx"/>
</target>
<target name="retrieve.E">
<get src="http://wwwlehre.dhbw-stuttgart.de/~sschulz/WORK/E_DOWNLOAD/V_2.6/E.tgz" dest="${programs.dir}" tryGzipEncoding="true"/>
<untar src="${programs.dir}/E.tgz" dest="${programs.dir}" compression="gzip"/>
<delete file="${programs.dir}/E.tgz"/>
</target>
<target name="clone.E">
<mkdir dir="${programs.dir}/E"/>
<git command="clone" dir="${programs.dir}/E">
<args>
<arg value="--progress"/>
<arg value="--verbose"/>
<arg value="https://github.com/eprover/eprover.git"/>
<arg value="${programs.dir}/E"/>
</args>
</git>
</target>
<target name="build.E">
<chmod perm="ugo+rx">
<fileset dir="${programs.dir}/E">
<include name="**/*.sh"/>
<include name="**/configure*"/>
</fileset>
</chmod>
<exec executable="sh" dir="${programs.dir}/E">
<arg value="-c"/>
<arg value="./configure"/>
</exec>
<exec executable="sh" dir="${programs.dir}/E">
<arg value="-c"/>
<arg value="make"/>
</exec>
</target>
<target name="clone.vampire">
<mkdir dir="${programs.dir}/vampire"/>
<git command="clone" dir="${programs.dir}/vampire">
<args>
<arg value="--progress"/>
<arg value="--verbose"/>
<arg value="--branch"/>
<arg value="${vampire.version}"/>
<arg value="--depth"/>
<arg value="1"/>
<arg value="https://github.com/vprover/vampire.git"/>
<arg value="${programs.dir}/vampire"/>
</args>
</git>
</target>
<target name="clone.z3">
<git command="submodule" dir="${programs.dir}/vampire">
<args>
<arg value="update"/>
<arg value="--init"/>
</args>
</git>
</target>
<target name="build.z3">
<mkdir dir="${programs.dir}/vampire/z3/build"/>
<exec executable="cmake" dir="${programs.dir}/vampire/z3/build">
<arg value=".."/>
<arg value="-DZ3_SINGLE_THREADED=1 -DCMAKE_BUILD_TYPE=Release"/>
</exec>
<exec executable="sh" dir="${programs.dir}/vampire/z3/build">
<arg value="-c"/>
<arg value="make"/>
</exec>
</target>
<target name="build.vampire">
<echo message="=== Building Vampire ==="/>
<exec executable="git" dir="${programs.dir}/vampire">
<arg value="checkout"/>
<arg value="${vampire.version}"/>
</exec>
<!-- Normal Vampire build -->
<mkdir dir="${programs.dir}/vampire/build"/>
<exec executable="cmake" dir="${programs.dir}/vampire/build">
<arg value=".."/>
</exec>
<exec executable="sh" dir="${programs.dir}/vampire/build">
<arg value="-c"/>
<arg value="make"/>
</exec>
</target>
<!-- If Vampire fails to build on Hamming, here is an alternate source of the binary, but may not work due to sys arch type differences -->
<target name="alternate.vampire">
<get src="https://github.com/vprover/vampire/releases/download/v4.9casc2024/vampire" dest="${programs.dir}/vampire/build" tryGzipEncoding="true"/>
<chmod dir="${programs.dir}/${programs.dir}/vampire/build" perm="ugo+rx" includes="vampire"/>
</target>
<!--
=====
UTILS
=====
-->
<!-- git macro utils setup from: https://tonyyan.wordpress.com/2017/03/10/integrate-git-into-ant-targets/-->
<macrodef name="git">
<attribute name="command"/>
<attribute name="dir" default="${git.home}"/>
<element name="args" optional="true"/>
<sequential>
<echo message="git @{command}"/>
<exec executable="git" dir="@{dir}">
<arg value="@{command}"/>
<args/>
</exec>
</sequential>
</macrodef>
<target name="stop.tomcat" description="stop web application in tomcat">
<exec executable="sh">
<arg value="-c"/>
<arg value="'${tomcat.home}/bin/shutdown.sh'"/>
</exec>
</target>
<target name="start.tomcat" description="start web application in tomcat">
<exec executable="sh">
<arg value="-c"/>
<arg value="'${tomcat.home}/bin/startup.sh'"/>
</exec>
<!--<antcall target="monitor.catalina.out"/>-->
</target>
<target name="refresh.sigma"
depends="clean,clear.kbs,clear.tomcat.logs,refresh.kbs,update.sigmautils,update.tptpantlr,update.sigmaantlr,update.sigmakee,update.sigmanlp,update.sumojedit,update.sigmarest"
description="Refreshes (updates) the entire Simga Enterprise Suite (SES)"/>
<target name="clear.kbs" description="Clears out all of the serialized KBs and translations">
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${sigma.home}/KBs">
<include name="*.fof"/>
<include name="*.tff"/>
<include name="*.tptp"/>
<include name="*.ser"/>
</fileset>
<fileset dir="${sigma.home}/KBs/WordNetMappings">
<include name="*.ser"/>
</fileset>
</delete>
</target>
<target name="clear.tomcat.logs" description="Clears out all of Tomcat's logs">
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${tomcat.home}/logs">
<include name="*.*"/>
</fileset>
</delete>
</target>
<target name="update.sumo">
<git command="pull" dir="${kbs.home}">
<args>
<arg value="--progress"/>
<arg value="--verbose"/>
</args>
</git>
</target>
<target name="update.sigmautils">
<git command="pull" dir="${git.home}/SigmaUtils">
<args>
<arg value="--progress"/>
<arg value="--verbose"/>
</args>
</git>
</target>
<target name="update.tptpantlr">
<git command="pull" dir="${git.home}/TPTP-ANTLR">
<args>
<arg value="--progress"/>
<arg value="--verbose"/>
</args>
</git>
</target>
<available file="${git.home}/sigmaAntlr/build.xml" property="sigmaantlr.present"/>
<target name="update.sigmaantlr" if="sigmaantlr.present">
<git command="pull" dir="${git.home}/sigmaAntlr">
<args>
<arg value="--progress"/>
<arg value="--verbose"/>
</args>
</git>
</target>
<target name="update.sigmakee">
<git command="pull" dir="${user.dir}">
<args>
<arg value="--progress"/>
<arg value="--verbose"/>
</args>
</git>
</target>
<available file="${git.home}/sigmanlp/build.xml" property="sigmanlp.present"/>
<target name="update.sigmanlp" if="sigmanlp.present">
<git command="pull" dir="${git.home}/sigmanlp">
<args>
<arg value="--progress"/>
<arg value="--verbose"/>
</args>
</git>
</target>
<available file="${git.home}/SUMOjEdit/build.xml" property="sumojedit.present"/>
<target name="update.sumojedit" if="sumojedit.present">
<git command="pull" dir="${git.home}/SUMOjEdit">
<args>
<arg value="--progress"/>
<arg value="--verbose"/>
</args>
</git>
</target>
<available file="${git.home}/SigmaRest/build.xml" property="sigmarest.present"/>
<target name="update.sigmarest" if="sigmarest.present">
<git command="pull" dir="${git.home}/SigmaRest">
<args>
<arg value="--progress"/>
<arg value="--verbose"/>
</args>
</git>
</target>
<target name="append.bashrc" if="isUnixNotMac">
<echo file="${user.home}/.bashrc" append="true">
# For SIGMA
export SIGMA_HOME=$HOME/.${web.app.name}
export ONTOLOGYPORTAL_GIT=$HOME/workspace
export SIGMA_SRC=$ONTOLOGYPORTAL_GIT/${web.app.name}
export CATALINA_OPTS="${run.jvmargs}"
export CATALINA_HOME=${programs.dir}/apache-tomcat-${tomcat.version}
export PATH=$CATALINA_HOME/bin:$PATH
export SIGMA_CP=$SIGMA_SRC/build/${web.app.name}.jar:$SIGMA_SRC/lib/*
</echo>
</target>
<target name="append.zshrc" unless="isUnixNotMac">
<echo file="${user.home}/.zshrc" append="true">
# For SIGMA
export SIGMA_HOME=$HOME/.${web.app.name}
export ONTOLOGYPORTAL_GIT=$HOME/workspace
export SIGMA_SRC=$ONTOLOGYPORTAL_GIT/${web.app.name}
export CATALINA_OPTS="${run.jvmargs}"
export CATALINA_HOME=${programs.dir}/apache-tomcat-${tomcat.version}
export PATH=$CATALINA_HOME/bin:$PATH
export SIGMA_CP=$SIGMA_SRC/build/${web.app.name}.jar:$SIGMA_SRC/lib/*
</echo>
</target>
<target name="api_doc" depends="init" description="Build the JavaDocs and place in ${dist.javadoc.dir}.">
<javadoc sourcepath="${src.dir}" destdir="${dist.javadoc.dir}" author="true" version="true" use="true"
windowtitle="Sigma API Specification" splitindex="true" packagenames="com.articulate.sigma.*">
<classpath refid="compile.classpath"/>
<doctitle>Sigma API Specification</doctitle>
<header><![CDATA[<b>Sigma API Specification</b>]]></header>
<group title="Sigma" packages="com.articulate.sigma.*"/>
<group title="Sigma TPTPWorld" packages="TPTPWorld.*"/>
<group title="Sigma TPTP Parser" packages="tptp_parser.*"/>
</javadoc>
</target>
</project>