forked from kframework/k-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
250 lines (224 loc) · 9.69 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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Copyright (c) 2012-2014 K Team. All Rights Reserved. -->
<project basedir="." default="build" name="KTool Build file">
<property location="src/javasources" name="javasources" />
<property name="version" value="nightly" />
<property name="config" value="./tests/config.xml" />
<property name="base" value="master" />
<target name="java">
<ant antfile="${javasources}/KTool/buildjava.xml" dir="${javasources}/KTool" />
</target>
<target name="jar">
<ant antfile="${javasources}/KTool/buildjar.xml" dir="${javasources}/KTool" />
</target>
<target name="build">
<ant antfile="${javasources}/KTool/build.xml" dir="${javasources}/KTool" />
<antcall target="makeversion" />
</target>
<target name="test-build" depends="build">
<ant antfile="${javasources}/KTool/buildjava.xml" target="test-build" dir="${javasources}/KTool" />
</target>
<target name="clean">
<delete>
<fileset dir="${javasources}/KTool/src/org/kframework/parser/concrete/lib">
<include name="*.java" />
<include name="*.tbl" />
<exclude name="string_trim_last_one_0_0.java" />
<exclude name="string_unescape_sort_0_0.java" />
<exclude name="annolocation_0_0.java" />
<exclude name="annolocationremove_0_0.java" />
<exclude name="clear_console_0_0.java" />
<exclude name="mergeamb_0_0.java" />
<exclude name="xml_string_escape_from_string_0_0.java" />
</fileset>
</delete>
<delete file="${javasources}/parsers/Concrete/trans/ConcreteMain.rtree" />
<delete file="${javasources}/parsers/Concrete/trans/ConcreteMain.dep" />
<delete dir="${javasources}/parsers/Concrete/trans/ConcreteMain" />
<delete dir="${javasources}/parsers/Concrete/include" />
<delete dir="${javasources}/KTool/lib/resources/sdf" />
<antcall target="clean-java" />
</target>
<target name="clean-java">
<delete dir="${javasources}/KTool/bin" />
<delete file="${javasources}/../../lib/java/k3.jar" />
<delete file="${javasources}/../../lib/version.txt" />
<delete dir="./k/" />
<!-- Next task is removable once everybody updates -->
<delete failonerror="false">
<fileset dir="${javasources}/KTool/src/org/kframework/backend/pdmc/pda/buchi/parser" includes="*.java" />
</delete>
<delete>
<fileset dir="${javasources}/KTool/src/org/kframework/parser/outer" includes="*.java" />
<fileset dir="${javasources}/KTool/src/org/kframework/utils/kastparser" includes="*.java" />
</delete>
<!-- TODO: Remove after September 2014.
Keeping it in order to remove a package that was renamed. -->
<delete dir="${javasources}/KTool/src/org/kframework/parser/basic" />
</target>
<target name="makeversion">
<property name="version.file" value="./lib/version.txt" />
<exec executable="git" outputproperty="version.out" failifexecutionfails="false">
<arg value="rev-parse" />
<arg value="--short" />
<arg value="HEAD^" />
</exec>
<condition property="version.out" value="Failed to execute Git in command line.">
<isset property="version.out" />
</condition>
<tstamp>
<format property="date" pattern="EEE MMM d HH:mm:ss z yyyy" />
</tstamp>
<condition property="k-version" value="nightly build">
<equals arg1="${version}" arg2="nightly" />
</condition>
<condition property="k-version" value="version ${version}">
<not>
<equals arg1="${version}" arg2="nightly" />
</not>
</condition>
<echo message="${version.file}" />
<echo message="K-framework ${k-version}.${line.separator}" />
<echo message="Git Revision: ${version.out}${line.separator}" />
<echo message="Build date: ${date}${line.separator}" />
<echo message="K-framework ${k-version}.${line.separator}" file="${version.file}" />
<echo message="Git Revision: ${version.out}${line.separator}" file="${version.file}" append="true" />
<echo message="Build date: ${date}${line.separator}" file="${version.file}" append="true" />
</target>
<target name="release" depends="test">
<antcall target="pack" />
</target>
<target name="pack">
<delete dir="./release" />
<delete file="k-${version}.zip" />
<delete file="k-${version}.tgz" />
<copy todir="release/k">
<fileset dir=".">
<include name="INSTALL.md" />
<include name="CHANGELOG.md" />
<include name="LICENSE.md" />
<include name="README.md" />
<include name="bin/**" />
<include name="documentation/**" />
<include name="include/**" />
<include name="lib/**" />
<include name="samples/**" />
<include name="tutorial/**" />
<include name="editor-support/**" />
<exclude name="**/.*/**" />
<exclude name="**/*-kompiled/**" />
<exclude name="**/*-kompiled-symbolic/**" />
<exclude name="bin/native/linux/implodePT" />
<exclude name="bin/native/macosx/implodePT" />
<exclude name="bin/native/cygwin/implodePT.exe" />
</fileset>
</copy>
<zip destfile="k-${version}.zip" basedir="release" />
<tar destfile="k-${version}.tgz" compression="gzip">
<tarfileset filemode="755" dir="./release">
<include name="k/bin/kast" />
<include name="k/bin/kompile" />
<include name="k/bin/krun" />
<include name="k/bin/kpp" />
<include name="k/bin/ktest" />
<include name="k/bin/kcheck" />
<include name="k/lib/maude/binaries/maude.intelDarwin" />
<include name="k/lib/maude/binaries/maude.linux" />
<include name="k/lib/maude/binaries/maude.linux64" />
<include name="k/lib/native/linux/sdf2table" />
<include name="k/lib/native/macosx/sdf2table" />
<include name="k/lib/native/linux/gappa" />
<include name="k/lib/native/macosx/gappa" />
<include name="k/lib/scripts/checkJava" />
</tarfileset>
<tarfileset dir="./release">
<include name="**" />
<exclude name="k/bin/kast" />
<exclude name="k/bin/kompile" />
<exclude name="k/bin/krun" />
<exclude name="k/bin/kpp" />
<exclude name="k/bin/ktest" />
<exclude name="k/bin/kcheck" />
<exclude name="k/bin/maude/binaries/maude.intelDarwin" />
<exclude name="k/bin/maude/binaries/maude.linux" />
<exclude name="k/bin/maude/binaries/maude.linux64" />
<exclude name="k/bin/native/linux/sdf2table" />
<exclude name="k/bin/native/macosx/sdf2table" />
<exclude name="k/bin/native/linux/gappa" />
<exclude name="k/bin/native/macosx/gappa" />
<exclude name="k/lib/scripts/checkJava" />
</tarfileset>
</tar>
</target>
<target name="test" depends="build,junit,checkstyle">
<java jar="${javasources}/../../lib/java/k3.jar" fork="true" failonerror="true">
<arg value="-ktest"/>
<arg value="${config}"/>
<arg value="--programs"/>
<arg value="."/>
<arg value="--results"/>
<arg value="."/>
</java>
</target>
<target name="junit" depends="test-build">
<junit fork="true" dir="${javasources}/KTool" forkmode="once" failureproperty="junit.failed">
<formatter type="plain" usefile="false" />
<classpath>
<pathelement location="${javasources}/KTool/bin/" />
<fileset dir="${javasources}/KTool/lib">
<include name="*.jar" />
</fileset>
<fileset dir="lib/java/">
<include name="*.jar" />
</fileset>
</classpath>
<batchtest>
<fileset dir="${javasources}/KTool/test">
<include name="**/*Test.java" />
<include name="**/Test*.java" />
<exclude name="org/kframework/utils/BaseTestCase.java" />
</fileset>
</batchtest>
<jvmarg value="-ea" />
</junit>
<fail message="JUnit tests failed!" if="junit.failed" />
</target>
<taskdef resource="checkstyletask.properties"
classpath="${javasources}/KTool/lib/checkstyle-all.jar"/>
<property name="checkstyle.suppress.file" location="${javasources}/KTool/checkstyle-suppress.xml" />
<target name="checkstyle">
<checkstyle config="${javasources}/KTool/checkstyle-java.xml">
<fileset dir="${javasources}/KTool">
<include name="**/*.java"/>
<exclude name="src/org/kframework/parser/concrete/lib/**" />
<exclude name="src/org/kframework/utils/kastparser/*.java" />
<exclude name="src/org/kframework/parser/outer/*.java" />
</fileset>
</checkstyle>
<checkstyle config="${javasources}/KTool/checkstyle-k.xml">
<fileset dir=".">
<include name="**/*.k"/>
</fileset>
</checkstyle>
</target>
<target name="checkstyle-copyright">
<exec executable="git" outputproperty="git.diff.out" failifexecutionfails="false">
<arg value="diff" />
<arg value="${base}" />
<arg value="--name-only" />
</exec>
<condition property="git.diff.out" value="">
<isset property="git.diff.out" />
</condition>
<filelist id="git.diff.filelist" dir="." files="${git.diff.out}" />
<pathconvert property="checkstyle.files" pathsep="," refid="git.diff.filelist" dirsep="/">
<map from="/" to="" />
</pathconvert>
<checkstyle config="${javasources}/KTool/checkstyle-copyright.xml">
<fileset dir="/" includes="${checkstyle.files}">
<!-- TODO: exclude files here which should not be given copyright notices -->
<exclude name="**/src/com/davekoelle/**" />
</fileset>
</checkstyle>
</target>
</project>