forked from tlaplus/CommunityModules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
178 lines (161 loc) · 7.16 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
<project name="CommunityModules" default="test" basedir=".">
<property name="src" location="modules/"/>
<property name="src-test" location="tests/java"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<property name="lib" location="lib"/>
<property name="tests" location="tests"/>
<property name="tlc" location="tlc"/>
<tstamp>
<format property="timestamp"
pattern="yyyyMMdHHmm"
locale="en,UK"/>
</tstamp>
<target name="init" description="Create the build and dist directory structure">
<mkdir dir="${build}/modules"/>
<mkdir dir="${build}/tests"/>
<mkdir dir="${dist}"/>
<mkdir dir="${tlc}"/>
</target>
<target name="download" depends="init" description="downloads tla2tools.jar" unless="skip.download">
<!--<get src="https://github.com/tlaplus/tlaplus/releases/download/v1.7.0/tla2tools.jar" dest="${tlc}"/>-->
<!-- <get src="https://nightly.tlapl.us/dist/tla2tools.jar" dest="${tlc}"/> -->
<get src="https://github.com/tlaplus/tlaplus/releases/download/v1.8.0/tla2tools.jar" dest="${tlc}"/>
</target>
<target name="compile" depends="download" description="compile the java module overwrites">
<javac srcdir="${src}" destdir="${build}/modules" classpath="${tlc}/tla2tools.jar:${lib}/gson-2.8.6.jar:${lib}/jgrapht-core-1.5.1.jar:${lib}/jungrapht-layout-1.4-SNAPSHOT.jar:${lib}/slf4j-api-1.7.30.jar:${lib}/slf4j-nop-1.7.30.jar:${lib}/commons-lang3-3.12.0.jar:${lib}/commons-math3-3.6.1.jar"
source="1.8"
target="1.8"
includeantruntime="false"/>
</target>
<target name="dist" depends="compile" description="Combine the module overwrites and the TLA+ definitions into a distribution">
<tstamp/>
<jar jarfile="${dist}/CommunityModules-${timestamp}.jar">
<fileset dir="${build}/modules/"
includes="**/*.class"/>
<fileset dir="${src}/"
includes="*.tla,*.java"/>
<fileset dir="."
includes="LICENSE,README.md"/>
</jar>
<copy file="${dist}/CommunityModules-${timestamp}.jar" tofile="${dist}/CommunityModules.jar"/>
<!-- Extract gson xml into class directory to be packaged into CommunityModules-deps.jar. -->
<unzip src="lib/gson-2.8.6.jar" dest="${build}/deps">
<patternset>
<include name="**/*.class"/>
</patternset>
</unzip>
<unzip src="lib/jgrapht-core-1.5.1.jar" dest="${build}/deps">
<patternset>
<!-- https://github.com/jgrapht/jgrapht/issues/1112 -->
<exclude name="**/*rensenIndexLinkPrediction.class"/>
<include name="**/*.class"/>
</patternset>
</unzip>
<unzip src="lib/jungrapht-layout-1.4-SNAPSHOT.jar" dest="${build}/deps">
<patternset>
<include name="**/*.class"/>
</patternset>
</unzip>
<unzip src="lib/slf4j-api-1.7.30.jar" dest="${build}/deps">
<patternset>
<include name="**/*.class"/>
</patternset>
</unzip>
<unzip src="lib/slf4j-nop-1.7.30.jar" dest="${build}/deps">
<patternset>
<include name="**/*.class"/>
</patternset>
</unzip>
<unzip src="lib/commons-lang3-3.12.0.jar" dest="${build}/deps">
<patternset>
<include name="**/*.class"/>
</patternset>
</unzip>
<unzip src="lib/commons-math3-3.6.1.jar" dest="${build}/deps">
<patternset>
<include name="**/*.class"/>
</patternset>
</unzip>
<jar jarfile="${dist}/CommunityModules-deps-${timestamp}.jar">
<fileset dir="${build}/modules/"
includes="**/*.class"/>
<fileset dir="${build}/deps"
includes="**/*.class"/>
<fileset dir="${lib}"
includes="**/NOTICE*"/>
<fileset dir="${lib}"
includes="**/LICENSE*"/>
<fileset dir="${src}/"
includes="*.tla,*.java"/>
<fileset dir="."
includes="LICENSE,README.md"/>
</jar>
<copy file="${dist}/CommunityModules-deps-${timestamp}.jar" tofile="${dist}/CommunityModules-deps.jar"/>
</target>
<target name="test" depends="dist" description="Run the modules in tests/ on the TLA+ modules in dist/">
<!-- If an assert fails, TLC will return a non-zero exit value which is makes the ant target fail. -->
<java classname="tlc2.TLC" fork="true" failonerror="true">
<!-- Tell Java to use a garbage collector which makes TLC happy. -->
<jvmarg value="-XX:+UseParallelGC"/>
<env key="SOME_TEST_ENV_VAR" value="TLCFTW"/>
<env key="SOME-TEST-ENV-VAR" value="TLCFTW"/>
<env key="SOME_TEST_ENV_VAR_N23" value="23"/>
<!-- Report execution statistics as azure-pipelien -->
<sysproperty key="tlc2.TLC.ide" value="azure-pipeline"/>
<sysproperty key="util.ExecutionStatisticsCollector.id" value="01ed03e40ba44f278a934849dd2b1038"/>
<arg value="-metadir"/>
<arg value="${basedir}/build/states"/>
<arg value="-cleanup"/>
<arg value="${basedir}/tests/AllTests"/>
<classpath>
<pathelement location="${tlc}/tla2tools.jar" />
<pathelement location="${lib}/gson-2.8.6.jar" />
<pathelement location="${lib}/jgrapht-core-1.5.1.jar" />
<pathelement location="${lib}/jungrapht-layout-1.4-SNAPSHOT.jar" />
<pathelement location="${lib}/slf4j-api-1.7.30.jar" />
<pathelement location="${lib}/slf4j-nop-1.7.30.jar" />
<pathelement location="${lib}/commons-lang3-3.12.0.jar" />
<pathelement location="${lib}/commons-math3-3.6.1.jar" />
<!-- The jar that has just been built by the dist target. -->
<pathelement location="${dist}/CommunityModules-${timestamp}.jar" />
</classpath>
</java>
<!-- Test if trace expressions involving the ShiViz module work correctly. -->
<!-- This test expects TLC to report a liveness violation, which is why -->
<!-- failonerror is off. Instead, the ant records TLC's return value in -->
<!-- shiviz.return.value, which is cheked in the conditional below. -->
<java classname="tlc2.TLC" fork="true" failonerror="false" resultproperty="shiviz.return.value">
<!-- Tell Java to use a garbage collector which makes TLC happy. -->
<jvmarg value="-XX:+UseParallelGC"/>
<!-- Report execution statistics as azure-pipeline -->
<sysproperty key="tlc2.TLC.ide" value="azure-pipeline"/>
<sysproperty key="util.ExecutionStatisticsCollector.id" value="01ed03e40ba44f278a934849dd2b1038"/>
<sysproperty key="TLA-Library" value="${src}"/>
<arg value="-metadir"/>
<arg value="${basedir}/build/states"/>
<arg value="-cleanup"/>
<arg value="-deadlock"/>
<arg value="-noGenerateSpecTE"/>
<arg value="${basedir}/tests/GH037/ShiVizTests"/>
<classpath>
<pathelement location="${tlc}/tla2tools.jar" />
<!-- The jar that has just been built by the dist target. -->
<pathelement location="${dist}/CommunityModules-${timestamp}-deps.jar" />
</classpath>
</java>
<fail message="ERROR: ShiViz test failed">
<condition>
<not>
<!-- Assert that TLC's error code is 13, which is the code corresponding to a liveness violation. -->
<equals arg1="${shiviz.return.value}" arg2="13"/>
</not>
</condition>
</fail>
</target>
<target name="clean" description="Delete the ${build}, ${tlc} and ${dist} directory trees">
<delete dir="${build}"/>
<delete dir="${dist}"/>
<delete dir="${tlc}"/>
</target>
</project>