forked from typetools/checker-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-common.xml
139 lines (111 loc) · 4.74 KB
/
build-common.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
<!--
This is a configuration file for use by Ant when building the
Checker Framework.
This file is shared between all subprojects.
-->
<project name="imports">
<!--
Properties that are likely to need adaptation by developers should
instead go into build-common.properties.
-->
<property name="src" value="src"/>
<property name="build" value="build"/>
<property name="build.reports" value="${build}/reports"/>
<property name="build.jtreg.dir" value="${build}/jtreg"/>
<property name="tests" value="tests"/>
<property name="tests.build" value="${tests}/build"/>
<property name="api.doc" value="api"/>
<property environment="env"/>
<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}" />
<property name="compiler.version.goal.jsr308"
value="javac 1.8.0-jsr308-${build.version}"/>
<property name="compiler.version.goal.java8"
value="javac 1.8.0"/>
<property name="compiler.version.goal.java9"
value="javac 1.9.0"/>
<condition property="jdkName" value="jdk8.jar">
<contains string="${java.version}" substring="1.8"/>
</condition>
<!-- TODO: raise an error if no supported version found. -->
<condition property="jdkName" value="jdk9.jar" else="UNSUPPORTED">
<contains string="${java.version}" substring="1.9"/>
</condition>
<target name="prep-all"
description="Perform preparation useful for all projects">
<java fork="true"
outputproperty="compiler.version"
classpath="${javac.lib}"
classname="com.sun.tools.javac.Main">
<arg value="-version"/>
</java>
<condition property="compiler.exists.jsr308">
<equals
arg1="${compiler.version}"
arg2="${compiler.version.goal.jsr308}"/>
</condition>
<condition property="compiler.exists.java8">
<contains
string="${compiler.version}"
substring="${compiler.version.goal.java8}"/>
</condition>
<condition property="compiler.exists.java9">
<contains
string="${compiler.version}"
substring="${compiler.version.goal.java9}"/>
</condition>
<!-- This file is looked for by Javadoc, this will ensure it always shows up in the api directory
regardless of which subproject javadoc you call. -->
<property name="dejavuDir" value="${api.doc}/resources/fonts/"/>
<mkdir dir="${dejavuDir}"/>
<touch file="${dejavuDir}/dejavu.css"/>
<condition property="compiler.exists">
<or>
<istrue value="${compiler.exists.jsr308}"/>
<istrue value="${compiler.exists.java8}"/>
<istrue value="${compiler.exists.java9}"/>
</or>
</condition>
<fail unless="compiler.exists"
message="
Needed version '${compiler.version.goal.jsr308}' of the JSR 308 compiler,
but found version '${compiler.version}' on your classpath.
${line.separator}
${line.separator}Check that the 'javac.lib' property
in 'build-common.properties'
points to version ${build.version} of the 'javac.jar' library."/>
</target>
<target name="prep-ManualTaglet" depends="prep">
<java fork="true"
failonerror="true"
classpath="${javac.lib}:${javadoc.lib}"
classname="com.sun.tools.javac.Main">
<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 missing bootstrap
classpath for Java 7. -->
<arg value="-Xlint:-options"/>
<arg value="-encoding"/>
<arg value="utf-8"/>
<arg value="-d"/>
<arg value="${build}"/>
<arg value="${javacutil.loc}/src/org/checkerframework/javacutil/dist/ManualTaglet.java"/>
<arg value="-version"/>
</java>
</target>
<target name="tags" depends="prep" description="Create Emacs TAGS table">
<exec executable="/bin/sh" failonerror="true">
<arg value="-c"/>
<arg value="ctags -e -f TAGS `find . \( -name jdk \) -prune -o -name '*.java' -print | sort-directory-order`"/>
</exec>
</target>
</project>