-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.xml
201 lines (168 loc) · 6.58 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
<?xml version="1.0" ?>
<!-- Configuration of the Ant build system to generate a Jar file -->
<project name="Glacier" default="CreateJar" basedir=".">
<property environment="env."/>
<property name="checker-framework.loc" value="${env.JSR308}/checker-framework/"/>
<fail unless="env.JSR308">JSR308 environment variable must be set to the to the path containing checker-framework.</fail>
<fail message="Checker framework does not exist at given path: ${checker-framework.loc}">
<condition>
<not>
<available file="${checker-framework.loc}" type="dir"/>
</not>
</condition>
</fail>
<property name="glacier.lib" value="${basedir}/Glacier.jar"/>
<property name="checker.lib" value="${checker-framework.loc}/checker/dist/checker.jar"/>
<property name="javac.lib" value="${checker-framework.loc}/checker/dist/javac.jar"/>
<property name="tests" value="tests"/>
<property name="tests.build" value="${tests}/build"/>
<property name="build.reports" value="${tests}/build/reports/"/>
<property name="tests-framework.loc" value="${checker-framework.loc}/framework/tests/"/>
<property name="junit.lib" value="${tests-framework.loc}/junit-4.12.jar"/>
<property name="hamcrest.lib" value="${tests-framework.loc}/hamcrest-core-1.3.jar"/>
<property name="tmpdir"
value="${java.io.tmpdir}/${user.name}/${timestamp}${env.EXECUTOR_NUMBER}/${ant.project.name}" />
<property name="build" value="bin"/>
<target name="build" depends="prep"
description="Compile files. Does not update any jars">
<fileset id="astub.files" dir="src">
<include name="**/*.astub"/>
</fileset>
<fileset id="properties.files" dir="src">
<include name="**/*.properties"/>
</fileset>
<echo message="stub files=${astub.files}"/>
<copy todir="${build}" preservelastmodified="true">
<fileset refid="astub.files"/>
<fileset refid="properties.files"/>
</copy>
<pathconvert pathsep=" " property="src.files.spaceseparated">
<path>
<fileset dir="src">
<include name="**/*.java"/>
</fileset>
</path>
</pathconvert>
<echo message="${src.files.spaceseparated}" file="${tmpdir}/srcfiles-framework.txt"/>
<java fork="true"
failonerror="true"
classpath="${javac.lib}:${stubparser.lib}:${javacutil.lib}:${dataflow.lib}:${junit.lib}:${hamcrest.lib}:${checker.lib}"
classname="com.sun.tools.javac.Main">
<jvmarg line="-Xbootclasspath/p:${javac.lib}"/>
<arg value="-g"/>
<!-- Make sure we only have Java 7 source code and generate Java 7 bytecode. -->
<arg value="-source"/>
<arg value="7"/>
<arg value="-target"/>
<arg value="7"/>
<!-- To not get a warning about bootstrap classpath -->
<arg value="-Xlint:-options"/>
<arg line="-sourcepath src"/>
<arg line="-d bin"/>
<arg line="@${tmpdir}/srcfiles-framework.txt"/>
<arg line="-version"/>
<arg line="-XDTA:noannotationsincomments"/>
<arg line="-Xlint"/>
<arg line="-Werror"/>
</java>
<delete file="${tmpdir}/srcfiles-framework.txt"/>
<!--
Touch doesn't work on a directory, so can't do:
<touch file="${build}"/>
Instead, create and remove a file, which modifies the directory.
-->
<touch file="${build}/.timestamp"/>
<delete file="${build}/.timestamp"/>
</target>
<target name="CreateJar" description="Create Jar file" depends="build">
<jar jarfile="Glacier.jar" basedir="bin" />
</target>
<target name="prep">
<mkdir dir="${build}"/>
<mkdir dir="${tests.build}"/>
<!-- TODO -->
</target>
<target name="build-tests" depends="prep,CreateJar" description="Compile tests">
<echo message="tests = ${tests}"/>
<pathconvert pathsep=" " property="src.tests">
<path>
<fileset dir="${tests}">
<include name="src/tests/**/*.java"/>
</fileset>
</path>
</pathconvert>
<echo message="Testing in: ${src.tests}"/>
<java fork="true"
failonerror="true"
classpath="${build}:${javac.lib}:${junit.lib}:${hamcrest.lib}:${checker.lib}:${glacier.lib}"
classname="com.sun.tools.javac.Main">
<jvmarg line="-Xbootclasspath/p:${javac.lib}"/>
<arg value="-g"/>
<!-- Make sure we only have Java 7 source code and generate Java 7 bytecode. -->
<arg value="-source"/>
<arg value="7"/>
<arg value="-target"/>
<arg value="7"/>
<!-- To not get a warning about bootstrap classpath -->
<arg value="-Xlint:-options"/>
<arg line="-sourcepath ${tests}"/>
<arg line="-d ${tests.build}"/>
<arg line="${src.tests}"/>
</java>
</target>
<target name="glacier-tests" depends="build-tests">
<antcall target="-run-tests">
<param name="testclass" value="tests.GlacierTest$GlacierCheckerTests"/>
</antcall>
</target>
<target name="-run-tests" depends="build-tests">
<echo message="junit: ${junit.lib}"/>
<echo message="Running tests: ${testclass}"/>
<property name="emit.test.debug" value="true"/>
<condition property="should.emit.debug.str" value="true" else="false">
<isset property="emit.test.debug"/>
</condition>
<condition property="debugger.str" value="-Xnoagent -Djava.compiler=NONE -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" else="">
<isset property="debugger.on"/>
</condition>
<mkdir dir="${build.reports}"/>
<!-- non-debugging version: -->
<!--
<junit fork="${run.tests.should.fork}"
dir="${basedir}"
printsummary="false"
haltonfailure="${halt.on.test.failure}"
maxmemory="2500M"
>
<formatter type="xml"/>
-->
<!-- end of non-debugging version. -->
<!-- debugging version: -->
<junit fork="true"
dir="${basedir}"
haltonfailure="true"
maxmemory="2500M"
showoutput="true"
printsummary="withOutAndErr"
>
<formatter type="plain" usefile="false"/>
<jvmarg line="-Demit.test.debug=true"/>
<!-- end of debugging version. -->
<!-- plain output for debugging -->
<jvmarg line="-Xbootclasspath/p:${javac.lib}"/>
<jvmarg line="${debugger.str}"/>
<sysproperty key="JDK_JAR" value="${checker-framework.loc}/dist/jdk8.jar"/>
<sysproperty key="emit.test.debug" value="${should.emit.debug.str}"/>
<jvmarg line="-ea"/>
<classpath>
<pathelement path="${build}"/>
<pathelement path="${tests.build}"/>
<pathelement path="${javac.lib}"/>
<pathelement path="${checker.lib}"/>
<pathelement path="${junit.lib}"/>
<pathelement path="${hamcrest.lib}"/>
</classpath>
<test name="${testclass}" todir="${build.reports}"/>
</junit>
</target>
</project>