forked from typetools/checker-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
302 lines (273 loc) · 11.3 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
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
<!--
This is a configuration file for use by Ant when building the
Checker Framework.
This top-level build file simply delegates to the subprojects.
It assumes that the "checker" project is aware of all dependencies
and that it is sufficient to run targets from there.
Each subproject builds its own Javadoc including the documentation
of all projects it in turn depends on. This would allow us to
easily ship each subproject independently. Subprojects that
already ship independently also build a Javadoc JAR file
containing all its documentation.
-->
<project name="checkerframework" default="dist"
basedir=".">
<property file="${basedir}/local.properties"/>
<target name="dist"
description="Compile and jar all subprojects">
<ant dir="checker">
<target name="dist"/>
</ant>
</target>
<target name="dist-nobuildjdk"
description="Rebuild the framework. Rebuild checker on top of framework without rebuilding the JDK">
<ant dir="framework">
<target name="clean"/>
<target name="dist"/>
</ant>
<ant dir="checker">
<target name="dist-nobuildjdk"/>
</ant>
</target>
<target name="build"
description="Compile all subprojects">
<ant dir="checker">
<target name="build"/>
</ant>
</target>
<target name="clean"
description="Clean all subprojects">
<ant dir="checker">
<target name="clean"/>
</ant>
</target>
<target name="tests" depends="dist"
description="Run test cases for all subprojects">
<ant dir="checker">
<target name="all-tests"/>
</ant>
</target>
<target name="tests-nojtreg" depends="dist"
description="Run test cases for all subprojects, except jtreg tests">
<ant dir="checker">
<target name="all-tests-nojtreg"/>
</ant>
</target>
<target name="tests-nobuildjdk" depends="dist-nobuildjdk"
description="Run test cases for all subprojects (without rebuilding the JDK)">
<ant dir="checker">
<target name="all-tests-nobuildjdk"/>
</ant>
</target>
<target name="tests-nojtreg-nobuildjdk" depends="dist-nobuildjdk"
description="Run test cases for all subprojects, except jtreg tests (without rebuilding the JDK)">
<ant dir="checker">
<target name="all-tests-nojtreg-nobuildjdk"/>
</ant>
</target>
<target name="javadoc"
description="Generate javadoc for all subprojects">
<ant dir="checker">
<target name="javadoc"/>
</ant>
<ant dir="dataflow">
<target name="javadoc"/>
</ant>
<ant dir="framework">
<target name="javadoc"/>
</ant>
<ant dir="javacutil">
<target name="javadoc"/>
</ant>
<ant dir="stubparser">
<target name="javadoc"/>
</ant>
</target>
<target name="javadoc-private"
description="Generate javadoc, inculding private classes/members, for all subprojects">
<ant dir=".">
<property name="javadoc.private" value="true"/>
<target name="javadoc"/>
</ant>
</target>
<target name="dist-release">
<ant dir="checker">
<target name="dist-release"/>
</ant>
<ant dir="javacutil">
<target name="sources-jar"/>
</ant>
<ant dir="javacutil">
<target name="javadoc-jar" />
</ant>
<ant dir="dataflow">
<target name="sources-jar"/>
</ant>
<ant dir="dataflow">
<target name="javadoc-jar" />
</ant>
</target>
<target name="html-validate"
description="Validate that HTML files are well-formed; only works with JDK 8">
<exec executable="html5validator">
<arg value="--ignore"/>
<arg value="/api/"/>
<arg value="/build/"/>
<arg value="/checker/manual/manual.html"/>
<arg value="/checker/jdk/nullness/src/java/lang/ref/package.html"/>
</exec>
</target>
<property name="style.grep.args" value="-r -n -e"/>
<!-- keep these two lists in sync -->
<property name="style.grep.files" value="--exclude-dir=.git --exclude-dir=api --exclude-dir=bootstrap --exclude-dir=build --exclude-dir=jdk --exclude-dir=maven-plugin --exclude-dir=stubparser --exclude='*.aux' --exclude='*.bib' --exclude='*.class' --exclude='*.dvi' --exclude='*.expected' --exclude='*.gif' --exclude='*.jar' --exclude='*.jtr' --exclude='*.log' --exclude='*.out' --exclude='*.patch' --exclude='*.pdf' --exclude='*.png' --exclude='*.sty' --exclude='*~' --exclude='#*#' --exclude='CFLogo.ai' --exclude='logfile.log.rec.index' --exclude='manual.html' --exclude='manual.html-e' --exclude='junit*.properties' ."/>
<property name="style.find.files" value=". -not ( -name .git -prune ) -not ( -name api -prune ) -not ( -name bootstrap -prune ) -not ( -name build -prune ) -not ( -name jdk -prune ) -not ( -path maven-plugin -prune ) -not ( -path stubparser -prune ) -not ( -name '*.aux' ) -not ( -name '*.bib' ) -not ( -name '*.class' ) -not ( -name '*.dvi' ) -not ( -name '*.expected' ) -not ( -name '*.gif' ) -not ( -name '*.jar' ) -not ( -name '*.log' ) -not ( -name '*.out' ) -not ( -name '*.patch' ) -not ( -name '*.pdf' ) -not ( -name '*.png' ) -not ( -name 'junit*.properties' ) -not ( -name '*~' ) -not ( -name '#*#' ) -not ( -name 'manual.html' ) -not ( -name 'manual.html-e' ) -not ( -empty ) -type f"/>
<loadresource property="style.find.files.quoted">
<propertyresource name="style.find.files"/>
<filterchain>
<tokenfilter>
<replacestring from="(" to="\("/>
<replacestring from=")" to="\)"/>
</tokenfilter>
</filterchain>
</loadresource>
<target name="check-style" depends="check-format"
description="Check basic style guidelines">
<!-- There should be a way to templatize the following. -->
<exec executable="grep" outputproperty="trailingwhitespace" failonerror="false">
<arg line="${style.grep.args}"/>
<arg value=" $"/>
<arg line="${style.grep.files}"/>
</exec>
<fail message="Trailing whitespace:${line.separator}${trailingwhitespace}">
<condition>
<not>
<equals arg1="${trailingwhitespace}" arg2=""/>
</not>
</condition>
</fail>
<exec executable="grep" outputproperty="missingspace" failonerror="false">
<arg line="${style.grep.args}"/>
<arg value="[^\\]\b\(else\|finally\|try\){\|}\(catch\|else\|finally\)\b\|){\($\|[^0-9]\)\|\b\(catch\|for\|if\|while\)("/>
<arg line="${style.grep.files}"/>
<arg line="--exclude=build.xml --exclude=Makefile"/>
</exec>
<fail message="Missing space:${line.separator}${missingspace}">
<condition>
<not>
<equals arg1="${missingspace}" arg2=""/>
</not>
</condition>
</fail>
<!-- To remove trailing whitespace:
find . -name '*.java' | xargs sed -i ':a;/^[ \n]*$/{$d;N;ba}'
-->
<exec executable="find" outputproperty="blankline" failonerror="false">
<arg line="${style.find.files}"/>
<arg value="-exec"/>
<arg value="sh"/>
<arg value="+v"/>
<arg value="+x"/>
<arg value="-c"/>
<arg value="[ -z "$(sed -n "\$p" "$1")" ]"/>
<arg value="_"/>
<arg value="{}"/>
<arg value=";"/>
<arg value="-print"/>
</exec>
<fail message="Blank line at end of file:${line.separator}${blankline}">
<condition>
<not>
<equals arg1="${blankline}" arg2=""/>
</not>
</condition>
</fail>
<!-- To add final newline:
find -type f -name '*.java' | xargs sed -i -e '$a\'
-->
<exec executable="sh" outputproperty="notrailingnewline" failonerror="false">
<arg value="+v"/>
<arg value="+x"/>
<arg value="-c"/>
<arg value="find ${style.find.files.quoted} -print0 | xargs -0 -L1 sh +v +x -c 'test "$(tail -c 1 "$0")" && echo "No newline at end of $0"'"/>
<!-- <arg value="find ${style.find.files.quoted} -print0 | xargs -0 -L1 bash -c 'echo "$0"'"/> -->
</exec>
<fail message="Missing newline at end of files:${line.separator}${notrailingnewline}">
<condition>
<not>
<equals arg1="${notrailingnewline}" arg2=""/>
</not>
</condition>
</fail>
</target>
<fileset id="formatted.java.files" dir="." includes="**/*.java" excludes="**/checker/jdk/,**/stubparser/,**/eclipse/,**/nullness-javac-errors/"/>
<!-- Allow 30 seconds for either formatting task to complete. -->
<!-- I can add back quiet="true" to the get invocations, when all
installations have a modern enough Ant that recognizes that attribute. -->
<!-- Uncomment the first definition for debugging -->
<!-- <property name="run-gjf-website-dir" value="http://homes.cs.washington.edu/~mernst"/> -->
<property name="run-gjf-website-dir" value="https://raw.githubusercontent.com/mernst/plume-lib/master/bin"/>
<!-- Used as the value to maxparallel for Ant task that used it.
Limits the number of source files passed. -1 means unlimited.
If "Argument list too long" is issued, set this property in local.properties
to some postive value. Start with 4096, and try smaller numbers
until the "Argument list too long" error disappears. (We don't
always set maxparallel to, say, 1000 because setting maxparallel
slows down formatting.)
-->
<property name="maxparallel" value="-1"/>
<target name="reformat"
description="Reformat Java code">
<get src="${run-gjf-website-dir}/run-google-java-format.py" dest="checker/bin-devel/" usetimestamp="true" ignoreerrors="true"/>
<chmod file="checker/bin-devel/run-google-java-format.py" perm="+x"/>
<apply executable="python" parallel="true" maxparallel="${maxparallel}" failonerror="true">
<arg value="./checker/bin-devel/run-google-java-format.py"/>
<arg value="--aosp"/> <!-- 4-space indentation -->
<fileset refid="formatted.java.files"/>
</apply>
</target>
<target name="check-format"
description="Check Java code formatting">
<get src="${run-gjf-website-dir}/check-google-java-format.py" dest="checker/bin-devel/" usetimestamp="true" ignoreerrors="true"/>
<chmod file="checker/bin-devel/check-google-java-format.py" perm="+x"/>
<apply executable="python" parallel="true" maxparallel="${maxparallel}" failonerror="true">
<arg value="./checker/bin-devel/check-google-java-format.py"/>
<arg value="--aosp"/> <!-- 4-space indentation -->
<fileset refid="formatted.java.files"/>
</apply>
</target>
<target name="tags"
description="Generate TAGS file">
<ant dir="checker">
<target name="tags"/>
</ant>
<ant dir="dataflow">
<target name="tags"/>
</ant>
<ant dir="framework">
<target name="tags"/>
</ant>
<ant dir="javacutil">
<target name="tags"/>
</ant>
<ant dir="stubparser">
<target name="tags"/>
</ant>
<exec executable="make" dir="checker/manual" failonerror="true">
<arg value="tags"/>
</exec>
<exec executable="etags" failonerror="true">
<arg value="-i"/>
<arg value="checker/TAGS"/>
<arg value="-i"/>
<arg value="dataflow/TAGS"/>
<arg value="-i"/>
<arg value="framework/TAGS"/>
<arg value="-i"/>
<arg value="javacutil/TAGS"/>
<arg value="-i"/>
<arg value="stubparser/TAGS"/>
<arg value="-i"/>
<arg value="checker/manual/TAGS"/>
</exec>
</target>
</project>