-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
273 lines (238 loc) · 11 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
<project name="black-diamonds" basedir="." default="compile"
xmlns:if="ant:if"
xmlns:jacoco="antlib:org.jacoco.ant">
<property name="src.dir" location="src"/>
<property name="src_gen.dir" location="src_gen"/>
<property name="test.dir" value="tests"/>
<property name="lib.dir" value="libs"/>
<property name="sdk.dir" value="graal/sdk" />
<property name="sdk.build" value="${sdk.dir}/mxbuild/dists" />
<property name="truffle.dir" value="graal/truffle" />
<property name="truffle.build" value="${truffle.dir}/mxbuild/dists" />
<property name="junit.version" value="4.12" />
<property name="jacoco.version" value="0.8.0" />
<property name="checkstyle.version" value="8.28" />
<property name="mvn.url" value="https://maven-central.storage.googleapis.com/repos/central/data" /> <!-- https://repo1.maven.org/maven2 gives 403 on Travis CI -->
<property environment="env"/>
<property name="mx.cmd" value="${basedir}/mx/mx" />
<property name="build.dir" location="build"/>
<property name="classes.dir" location="${build.dir}/classes"/>
<path id="project.classpath">
<pathelement location="${classes.dir}" />
<pathelement location="${test.dir}" />
<pathelement location="${sdk.build}/graal-sdk.jar" />
<pathelement location="${sdk.build}/word-api.jar" />
<pathelement location="${lib.dir}/junit-${junit.version}.jar" />
<pathelement location="${lib.dir}/hamcrest-core-1.3.jar" />
<pathelement location="${truffle.build}/truffle-api.jar" />
<pathelement location="${truffle.build}/truffle-dsl-processor.jar" />
</path>
<target name="clean" description="Remove build directories and generated code">
<delete dir="${build.dir}"/>
<delete dir="${src_gen.dir}"/>
</target>
<target name="clobber" description="Do clean, and also clean truffle build" depends="clean">
<exec executable="${mx.cmd}" dir="${truffle.dir}">
<arg value="clean"/>
</exec>
<exec executable="${mx.cmd}" dir="${sdk.dir}">
<arg value="clean"/>
</exec>
</target>
<target name="eclipseformat">
<pathconvert pathsep=" " property="javafiles">
<fileset dir="${src.dir}">
<include name="**/*.java"/>
</fileset>
<fileset dir="${test.dir}">
<include name="**/*.java"/>
</fileset>
</pathconvert>
<exec executable="${env.ECLIPSE_EXE}" dir="${basedir}">
<arg value="-nosplash"/>
<arg value="-application"/>
<arg value="-consolelog"/>
<arg value="-data"/>
<arg value="${basedir}"/>
<arg value="-vm"/>
<arg value="${env.JAVA_HOME}/bin/java"/>
<arg value="org.eclipse.jdt.core.JavaCodeFormatter"/>
<arg value="-config"/>
<arg value="${basedir}/.settings/org.eclipse.jdt.core.prefs"/>
<arg line="${javafiles}"/>
</exec>
<exec executable="git" dir="${basedir}" failonerror="true">
<arg value="status" />
<arg value="*.java" />
</exec>
<exec executable="git" dir="${basedir}">
<arg value="diff" />
<arg value="*.java" />
</exec>
<exec executable="git" dir="${basedir}" failonerror="true">
<arg value="diff-index" />
<arg value="--quiet" />
<arg value="HEAD" />
</exec>
</target>
<target name="check-graal-available">
<available file="graal/.git" property="graal.present"/>
</target>
<target name="graal-repo" depends="check-graal-available"
unless="graal.present">
<exec executable="${basedir}/.graal-git-repo">
<arg value="checkout" />
</exec>
</target>
<target name="graal" depends="graal-repo">
<exec executable="${mx.cmd}" dir="${truffle.dir}" failonerror="true">
<arg value="build"/>
<arg value="--no-native"/>
</exec>
</target>
<target name="libs-junit">
<mkdir dir="${lib.dir}" />
<get src="${mvn.url}/junit/junit/${junit.version}/junit-${junit.version}.jar"
usetimestamp="true"
dest="${lib.dir}/junit-${junit.version}.jar" />
<get src="${mvn.url}/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"
usetimestamp="true"
dest="${lib.dir}/hamcrest-core-1.3.jar" />
</target>
<target name="libs" depends="graal,libs-junit">
</target>
<target name="coverage-jars">
<mkdir dir="${lib.dir}" />
<get src="${mvn.url}/org/jacoco/org.jacoco.ant/${jacoco.version}/org.jacoco.ant-${jacoco.version}-nodeps.jar"
usetimestamp="true"
dest="${lib.dir}/org.jacoco.ant-${jacoco.version}.jar" />
<get src="https://oss.sonatype.org/service/local/repositories/releases/content/com/codacy/codacy-coverage-reporter/2.0.2/codacy-coverage-reporter-2.0.2-assembly.jar"
usetimestamp="true"
dest="${lib.dir}/codacy-coverage-reporter-assembly.jar" />
</target>
<target name="checkstyle-jar">
<mkdir dir="${lib.dir}" />
<get src="https://github.com/checkstyle/checkstyle/releases/download/checkstyle-${checkstyle.version}/checkstyle-${checkstyle.version}-all.jar"
usetimestamp="true"
dest="${lib.dir}/checkstyle-${checkstyle.version}-all.jar" />
</target>
<target name="checkstyle" depends="checkstyle-jar" description="Check Code with Checkstyle">
<taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties" classpath="${lib.dir}/checkstyle-${checkstyle.version}-all.jar" />
<checkstyle config=".checkstyle_checks.xml">
<fileset dir="${src.dir}" includes="**/*.java"/>
<fileset dir="${test.dir}" includes="**/*.java"/>
<formatter type="plain"/>
</checkstyle>
</target>
<target name="compile-nodeps" description="Compile but assume dependencies to be resolved">
<mkdir dir="${build.dir}"/>
<mkdir dir="${classes.dir}" />
<mkdir dir="${src_gen.dir}" />
<pathconvert property="classpathProp" refid="project.classpath"/>
<echo>Classpath is ${classpathProp}</echo>
<javac includeantruntime="false" srcdir="${src.dir}" destdir="${classes.dir}" debug="true">
<classpath refid="project.classpath" />
<compilerarg line="-s ${src_gen.dir}" />
<compilerarg line="-XDignore.symbol.file" />
<compilerarg line="-Xlint:all" />
</javac>
<javac includeantruntime="false" srcdir="${src_gen.dir}" destdir="${classes.dir}" debug="true">
<classpath refid="project.classpath" />
<compilerarg line="-s ${src_gen.dir}" />
<compilerarg line="-Xlint:all" />
</javac>
<javac includeantruntime="false" srcdir="${test.dir}" destdir="${classes.dir}" debug="true">
<classpath refid="project.classpath" />
</javac>
</target>
<target name="compile" depends="libs,compile-nodeps" description="Compile Black Diamonds">
</target>
<target name="jar" depends="compile" description="Package as JAR">
<jar destfile="${build.dir}/black-diamonds.jar" basedir="${classes.dir}"></jar>
</target>
<macrodef name="junit-bd">
<sequential>
<junit haltonerror="false" haltonfailure="false" failureproperty="test.failed"
outputtoformatters="true">
<jvmarg value="-ea" />
<jvmarg value="-esa" />
<classpath refid="project.classpath" />
<batchtest fork="yes" filtertrace="false">
<fileset dir="tests">
<include name="**/*Test*.java"/>
</fileset>
</batchtest>
<formatter type="brief" usefile="false"/>
</junit>
</sequential>
</macrodef>
<target name="test" depends="compile" description="Execute tests">
<junit-bd />
</target>
<target name="tests" depends="test" />
<target name="coverage">
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="${lib.dir}/org.jacoco.ant-${jacoco.version}.jar"/>
</taskdef>
<jacoco:coverage destfile="jacoco.exec">
<junit fork="true" haltonerror="false" haltonfailure="false" failureproperty="test.failed"
outputtoformatters="true">
<jvmarg value="-ea" />
<jvmarg value="-esa" />
<classpath refid="project.classpath" />
<batchtest fork="yes" filtertrace="false">
<fileset dir="tests">
<include name="**/*Test*.java"/>
</fileset>
</batchtest>
<formatter type="brief" usefile="false"/>
</junit>
</jacoco:coverage>
</target>
<target name="coverage-report" depends="coverage">
<jacoco:report>
<executiondata>
<file file="jacoco.exec" />
</executiondata>
<!-- the class files and optional source files ... -->
<structure name="BD Code">
<classfiles>
<fileset dir="${classes.dir}" />
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${src.dir}" />
</sourcefiles>
</structure>
<!-- to produce reports in different formats. -->
<!-- <html destdir="${result.report.dir}" />
<csv destfile="${result.report.dir}/report.csv" /> -->
<xml destfile="jacoco.xml" />
</jacoco:report>
<java classname="com.codacy.CodacyCoverageReporter" fork="true" failonerror="true" classpath="libs/codacy-coverage-reporter-assembly.jar">
<arg line="-l Java -r jacoco.xml" />
</java>
</target>
<target name="docs">
<javadoc
destdir="docs" author="true" version="true" use="true"
windowtitle="Black Diamonds JavaDoc"
sourcepath="src"
packagenames="bd.*"
defaultexcludes="yes"
excludepackagenames="com.oracle.*"
public="true"
classpathref="project.classpath">
<!-- <fileset dir="src" defaultexcludes="yes">
<include name="src/**"/> -->
<!-- <exclude name="com/dummy/test/doc-files/**"/> -->
<!-- </fileset> -->
<!-- <doctitle><![CDATA[<h1>Test</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright © 2000 Dummy Corp. All Rights Reserved.</i>]]></bottom>
<tag name="todo" scope="all" description="To do:"/>
<group title="Group 1 Packages" packages="com.dummy.test.a*"/>
<group title="Group 2 Packages" packages="com.dummy.test.b*:com.dummy.test.c*"/>
<link offline="true" href="http://docs.oracle.com/javase/7/docs/api/" packagelistLoc="C:\tmp"/>
<link href="http://docs.oracle.com/javase/7/docs/api/"/> -->
</javadoc>
</target>
</project>