forked from facebook/buck
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
269 lines (245 loc) · 9.92 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
<project name="buck" default="default">
<property name="src.dir" value="${basedir}/src" />
<property name="aosp.src.dir" value="third-party/java/aosp/src" />
<property name="test.dir" value="${basedir}/test" />
<property name="plugin.dir" value="${basedir}/plugin" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="third-party.dir" value="${basedir}/third-party" />
<property name="build.dir" value="${basedir}/build" />
<property name="testrunner.src.dir" value="${src.dir}/com/facebook/buck/junit/" />
<property name="testrunner.classes.dir" value="${build.dir}/testrunner/classes" />
<property name="abi_processor.src.dir" value="${src.dir}/com/facebook/buck/java/abi/" />
<property name="abi_processor.classes.dir" value="${build.dir}/abi_processor/classes" />
<property name="buck.path_to_buck_py" value="${basedir}/src/com/facebook/buck/parser/buck.py" />
<property name="buck.path_to_emma_jar"
value="${basedir}/third-party/java/emma-2.0.5312/out/emma-2.0.5312.jar"
/>
<property name="classes.dir" value="${build.dir}/classes" />
<property name="testclasses.dir" value="${build.dir}/testclasses" />
<property name="javadoc.dir" value="${build.dir}/javadoc" />
<property name="client.dir" value="third-party/nailgun" />
<fileset dir="${lib.dir}" id="buck.jars">
<include name="args4j.jar" />
<include name="ddmlib-r21.jar" />
<include name="guava-15.0.jar" />
<include name="ini4j-0.5.2.jar" />
<include name="jackson-annotations-2.0.5.jar" />
<include name="jackson-core-2.0.5.jar" />
<include name="jackson-databind-2.0.5.jar" />
<include name="jsr305.jar" />
<include name="sdklib.jar" />
</fileset>
<fileset dir="${third-party.dir}" id="third-party.jars">
<include name="java/asm/asm-debug-all-4.1.jar" />
<include name="java/astyanax/astyanax-cassandra-1.56.38.jar" />
<include name="java/astyanax/astyanax-cassandra-1.56.38-javadoc.jar" />
<include name="java/astyanax/astyanax-cassandra-1.56.38-sources.jar" />
<include name="java/astyanax/astyanax-core-1.56.38.jar" />
<include name="java/astyanax/astyanax-thrift-1.56.38.jar" />
<include name="java/astyanax/cassandra-1.2.3.jar" />
<include name="java/astyanax/cassandra-thrift-1.2.3.jar" />
<include name="java/astyanax/commons-cli-1.1.jar" />
<include name="java/astyanax/commons-codec-1.2.jar" />
<include name="java/astyanax/commons-lang-2.6.jar" />
<include name="java/astyanax/high-scale-lib-1.1.2.jar" />
<include name="java/astyanax/joda-time-2.2.jar" />
<include name="java/astyanax/libthrift-0.7.0.jar" />
<include name="java/astyanax/log4j-1.2.16.jar" />
<include name="java/astyanax/slf4j-api-1.7.2.jar" />
<include name="java/astyanax/slf4j-log4j12-1.7.2.jar" />
<include name="java/jetty/jetty-all-9.0.4.v20130625.jar" />
<include name="java/jetty/servlet-api.jar" />
<include name="java/xz-java-1.3/xz-1.3.jar" />
</fileset>
<path id="classpath">
<fileset refid="buck.jars" />
<fileset refid="third-party.jars" />
<pathelement location="${classes.dir}" />
<pathelement location="${src.dir}" />
</path>
<path id="junit">
<pathelement location="${lib.dir}/junit-4.11.jar" />
<pathelement location="${lib.dir}/hamcrest-core-1.3.jar" />
<pathelement location="${lib.dir}/hamcrest-library-1.3.jar" />
</path>
<target name="clean" description="remove all generated files">
<ant inheritAll="false" antfile="third-party/java/emma-2.0.5312/build.xml" target="clean" />
<delete dir="${build.dir}" />
</target>
<!-- Default target so that a command line build can
do more than one thing. -->
<target name="default" depends="jar, client" />
<target name="checkversion">
<!-- The nio Files class was only introduced in Java 7. -->
<available property="jdk7" classname="java.nio.file.Files"/>
<fail message="Require JDK 7 or higher" unless="jdk7"/>
</target>
<target name="compile-testrunner" depends="checkversion">
<mkdir dir="${testrunner.classes.dir}" />
<javac srcdir="${testrunner.src.dir}"
destdir="${testrunner.classes.dir}"
classpathref="junit"
debug="on"
includeAntRuntime="no"
>
<compilerarg value="-Xlint:rawtypes" />
<compilerarg value="-Xlint:unchecked" />
</javac>
</target>
<target name="compile-abi-processor" depends="checkversion">
<mkdir dir="${abi_processor.classes.dir}" />
<javac srcdir="${abi_processor.src.dir}"
destdir="${abi_processor.classes.dir}"
debug="on"
includeAntRuntime="no"
>
<compilerarg value="-Xlint:rawtypes" />
<compilerarg value="-Xlint:unchecked" />
</javac>
</target>
<target name="compile"
depends="compile-testrunner, compile-abi-processor"
description="compile Java source code">
<ant inheritAll="false" antfile="third-party/java/emma-2.0.5312/build.xml" target="core.package" />
<mkdir dir="${classes.dir}" />
<javac destdir="${classes.dir}"
classpathref="classpath"
debug="on"
deprecation="on"
includeAntRuntime="no"
>
<src path="${src.dir}" />
<src path="${aosp.src.dir}" />
<exclude name="com/facebook/buck/junit/**" />
<exclude name="com/facebook/buck/java/abi/**" />
<compilerarg value="-Xlint:rawtypes" />
<compilerarg value="-Xlint:unchecked" />
</javac>
</target>
<target name="jar"
depends="compile"
description="build buck.jar"
>
<jar destfile="${build.dir}/buck.jar" update="true">
<zipfileset refid="buck.jars" />
<zipfileset refid="third-party.jars" />
<fileset dir="${src.dir}"
excludes="**/*.java, **/BUCK"
/>
<fileset dir="${classes.dir}" />
<manifest>
<attribute name="Main-Class" value="com.facebook.buck.cli.Main" />
</manifest>
</jar>
</target>
<path id="tests.classpath">
<path refid="classpath" />
<fileset dir="${lib.dir}" >
<include name="cglib-nodep-2.2.jar" />
<include name="easymock-3.0.jar" />
<include name="junit-4.11.jar" />
<include name="hamcrest-core-1.3.jar" />
<include name="hamcrest-library-1.3.jar" />
<include name="objenesis-1.2.jar" />
</fileset>
<pathelement location="${testclasses.dir}" />
<pathelement location="${test.dir}" />
<pathelement location="${abi_processor.classes.dir}" />
<pathelement location="${testrunner.classes.dir}" />
</path>
<target name="compile-tests"
depends="compile"
>
<mkdir dir="${testclasses.dir}" />
<javac srcdir="${test.dir}"
excludes="**/testdata/**"
destdir="${testclasses.dir}"
classpathref="tests.classpath"
debug="on"
deprecation="on"
includeAntRuntime="no"
>
<compilerarg value="-Xlint:rawtypes" />
<compilerarg value="-Xlint:unchecked" />
</javac>
</target>
<target name="java-test"
depends="compile-tests"
description="runs the Java tests"
>
<junit failureproperty="hasFailingTests"
showoutput="true"
forkmode="perBatch">
<sysproperty key="buck.path_to_emma_jar" value="${buck.path_to_emma_jar}" />
<sysproperty key="buck.path_to_buck_py" value="${buck.path_to_buck_py}" />
<formatter type="plain" usefile="false" />
<batchtest fork="yes">
<fileset dir="${test.dir}">
<!--
Do not exclude tests that start with "Abstract", as there are some tests for abstract
classes.
-->
<include name="**/*Test.java" />
<exclude name="**/testdata/**" />
</fileset>
</batchtest>
<classpath refid="tests.classpath" />
</junit>
<fail if="hasFailingTests" />
</target>
<target name="py-test" description="runs the Python tests">
<exec executable="python" failonerror="true">
<arg value="src/com/facebook/buck/parser/buck_test.py" />
</exec>
</target>
<path id="pmd-classpath">
<fileset dir="${basedir}/pmd" includes="*.jar" />
</path>
<target name="lint">
<taskdef name="pmd"
classpathref="pmd-classpath"
classname="net.sourceforge.pmd.ant.PMDTask"
/>
<pmd failOnRuleViolation="true" rulesetfiles="pmd/rules.xml">
<ruleset>buck</ruleset>
<fileset dir="${src.dir}">
<include name="**/*.java"/>
</fileset>
<fileset dir="${test.dir}">
<include name="**/*.java"/>
</fileset>
<fileset dir="${plugin.dir}">
<include name="**/*.java"/>
</fileset>
</pmd>
</target>
<target name="test" depends="java-test, py-test, lint" description="runs the unit tests" />
<target name="javadoc" description="generates HTML documentation for Java code"
depends="compile">
<mkdir dir="${javadoc.dir}" />
<javadoc destdir="${javadoc.dir}"
protected="true"
classpathref="tests.classpath"
windowtitle="Buck"
failonerror="true"
>
<fileset dir="${src.dir}"/>
<fileset dir="${test.dir}">
<exclude name="**/testdata/**" />
<exclude name="**/BUCK" />
<exclude name="**/*.properties"/>
</fileset>
<link href="http://docs.oracle.com/javase/7/docs/api/" />
<link href="http://docs.guava-libraries.googlecode.com/git-history/v15.0/javadoc/" />
<!-- The latest version of the javadocs is only for 4.10 -->
<link href="http://junit-team.github.io/junit/javadoc/latest/" />
</javadoc>
</target>
<target name="client" description="install nailgun buckd c client">
<mkdir dir="${build.dir}" />
<exec dir="${basedir}" executable="gcc">
<arg line="-Wall -pedantic -O3 -o ${build.dir}/ng ${client.dir}/nailgun-client/ng.c" />
</exec>
</target>
<target name="all" depends="jar, test, javadoc, client" />
</project>