-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
163 lines (149 loc) · 6.31 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
<project name="array-bounds-checker" default="jar" basedir=".">
<description>
Builds the Array Safety Checker, a pluggable checker for the Checker Framework.
</description>
<property name="build.version" value="0.0.1"/>
<property environment="env"/>
<property name="jsr308.langtools" value="${env.JSR308}"/> <!-- jsr308/jsr308-langtools -->
<property name="jsr308.langtools.dist" value="${jsr308.langtools}/dist"/>
<property name="javac.lib" value="${jsr308.langtools.dist}/lib/javac.jar"/>
<property name="framework.loc" value="${env.CHECKERFRAMEWORK}"/> <!-- jsr308/checker-framework/framework -->
<property name="framework.lib" value="${framework.loc}/dist/framework.jar"/>
<property name="checker.loc" value="${framework.loc}/../checker"/>
<property name="checker.lib" value="${checker.loc}/dist/checker.jar"/>
<property name="junit.lib" value="${framework.loc}/tests/junit.jar"/>
<property name="src" location="arraysafety/"/>
<property name="build" location="build/"/>
<property name="build.reports" location="${build}/reports"/>
<property name="dist" location="dist/"/>
<property name="tests" location="tests/"/>
<property name="tests.build" value="${tests}/build"/>
<tstamp>
<format property="timestamp" pattern="yy-MM-dd-hh-mm-ss-SS" />
</tstamp>
<!-- Prevent printing a literal ${env.BUILD_NUMBER} if it's not in env-->
<property name="env.EXECUTOR_NUMBER" value="" />
<property name="tmpdir"
value="${java.io.tmpdir}/${user.name}/${timestamp}${env.EXECUTOR_NUMBER}/${ant.project.name}" />
<target name="prep" description="Create required directories">
<mkdir dir="${build}"/>
<mkdir dir="${tests.build}"/>
<mkdir dir="${tests.build}/testclasses"/>
</target>
<target name="clean" description="Remove generated files">
<delete dir="${build}"/>
<delete dir="${dist}"/>
<delete failonerror="false">
<fileset dir="${tests.build}" includes="**/*.class"/>
</delete>
</target>
<target name="build" depends="prep" description="Compile main files">
<pathconvert pathsep=" " property="qual.src.files.spaceseparated">
<path>
<fileset dir="${src}">
<include name="**/qual/*.java"/>
</fileset>
</path>
</pathconvert>
<pathconvert pathsep=" " property="src.files.spaceseparated">
<path>
<fileset dir="${src}">
<include name="**/*.java"/>
</fileset>
</path>
</pathconvert>
<echo message="Compiling qualifiers."/>
<echo message="${qual.src.files.spaceseparated}" file="${tmpdir}/srcfiles-checker.txt"/>
<java fork="true" failonerror="true" classpath="${javac.lib}:${framework.lib}:${junit.lib}" classname="com.sun.tools.javac.Main">
<jvmarg line="-Xbootclasspath/p:${javac.lib}"/>
<arg value="-g"/>
<arg value="-source"/> <arg value="8"/> <arg value="-target"/> <arg value="8"/>
<arg value="-Xlint:-options"/>
<arg line="-sourcepath ${src}"/>
<arg line="-d ${build}"/>
<arg line="@${tmpdir}/srcfiles-checker.txt"/>
<arg line="-version"/>
<arg line="-XDTA:noannotationsincomments"/>
<arg line="-Xlint"/>
<arg line="-Werror"/>
</java>
<echo message="Compiling all source files."/>
<echo message="${src.files.spaceseparated}" file="${tmpdir}/srcfiles-checker.txt"/>
<java fork="true" failonerror="true" classpath="${javac.lib}:${framework.lib}:${junit.lib}" classname="com.sun.tools.javac.Main">
<jvmarg line="-Xbootclasspath/p:${javac.lib}"/>
<arg value="-g"/>
<arg value="-source"/> <arg value="8"/> <arg value="-target"/> <arg value="8"/>
<arg value="-Xlint:-options"/>
<arg line="-sourcepath ${src}"/>
<arg line="-d ${build}"/>
<arg line="@${tmpdir}/srcfiles-checker.txt"/>
<arg line="-version"/>
<arg line="-Xlint"/>
<arg line="-Werror"/>
</java>
<delete file="${tmpdir}/srcfiles-checker.txt"/>
</target>
<!-- creates arrayboundschecker.jar -->
<target name="jar" depends="build,qual-jar" description="Create arrayboundschecker.jar">
<delete dir="${build.reports}"/>
<mkdir dir="dist" />
<jar destfile="dist/arrayboundschecker.jar" basedir="${build}" excludes="tests/">
<manifest>
<attribute name="Implementation-Version" value="${build.version}"/>
<attribute name="Implementation-URL" value="https://github.com/mtrberzi/array-bounds-checker"/>
</manifest>
</jar>
</target>
<target name="qual-jar" depends="build" description="Create arrayboundschecker-qual.jar for annotations">
<mkdir dir="dist"/>
<jar destfile="dist/arrayboundschecker-qual.jar" basedir="${build}">
<include name="**/qual/*"/>
<manifest>
<attribute name="Implementation-Version" value="${build.version}"/>
<attribute name="Implementation-URL" value="https://github.com/mtrberzi/array-bounds-checker"/>
</manifest>
</jar>
</target>
<target name="build-tests" depends="prep" description="Compile tests">
<pathconvert pathsep=" " property="src.tests">
<path>
<fileset dir="${tests}">
<include name="src/tests/**/*.java"/>
</fileset>
</path>
</pathconvert>
<java fork="true" failonerror="true" classpath="${build}:${javac.lib}:${junit.lib}:${framework.lib}" classname="com.sun.tools.javac.Main">
<jvmarg line="-Xbootclasspath/p:${javac.lib}"/>
<arg value="-g"/>
<arg value="-source"/>
<arg value="8"/>
<arg value="-target"/>
<arg value="8"/>
<!-- 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="test" depends="jar,build-tests"
description="Run tests for the Array Safety Checker">
<mkdir dir="${build.reports}"/>
<junit fork="true" haltonfailure="true">
<jvmarg line="-Xbootclasspath/p:${javac.lib}"/>
<!-- JDK_JAR? -->
<jvmarg line="-ea"/>
<classpath>
<pathelement path="${build}"/>
<pathelement path="${tests.build}"/>
<pathelement path="${javac.lib}"/>
<pathelement path="${junit.lib}"/>
<pathelement path="${framework.lib}"/>
<pathelement path="${checker.lib}"/>
</classpath>
<formatter type="xml"/>
<formatter type="brief" usefile="false"/>
<test name="tests.ArraySafetyTest" todir="${build.reports}"/>
</junit>
</target>
</project>