Merge branch 'cassandra-3.0' into cassandra-3.11
[cassandra.git] / build.xml
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!--
3 ~ Licensed to the Apache Software Foundation (ASF) under one
4 ~ or more contributor license agreements. See the NOTICE file
5 ~ distributed with this work for additional information
6 ~ regarding copyright ownership. The ASF licenses this file
7 ~ to you under the Apache License, Version 2.0 (the
8 ~ "License"); you may not use this file except in compliance
9 ~ with the License. You may obtain a copy of the License at
10 ~
11 ~ http://www.apache.org/licenses/LICENSE-2.0
12 ~
13 ~ Unless required by applicable law or agreed to in writing,
14 ~ software distributed under the License is distributed on an
15 ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 ~ KIND, either express or implied. See the License for the
17 ~ specific language governing permissions and limitations
18 ~ under the License.
19 -->
20 <project basedir="." default="jar" name="apache-cassandra"
21 xmlns:artifact="antlib:org.apache.maven.artifact.ant">
22 <property environment="env"/>
23 <property file="build.properties" />
24 <property file="build.properties.default" />
25 <property name="debuglevel" value="source,lines,vars"/>
26
27 <!-- default version and SCM information -->
28 <property name="base.version" value="3.11.3"/>
29 <property name="scm.connection" value="scm:git://git.apache.org/cassandra.git"/>
30 <property name="scm.developerConnection" value="scm:git://git.apache.org/cassandra.git"/>
31 <property name="scm.url" value="http://git-wip-us.apache.org/repos/asf?p=cassandra.git;a=tree"/>
32
33 <!-- directory details -->
34 <property name="basedir" value="."/>
35 <property name="build.src" value="${basedir}/src"/>
36 <property name="build.src.java" value="${basedir}/src/java"/>
37 <property name="build.src.antlr" value="${basedir}/src/antlr"/>
38 <property name="build.src.jdkoverride" value="${basedir}/src/jdkoverride" />
39 <property name="build.src.resources" value="${basedir}/src/resources"/>
40 <property name="build.src.gen-java" value="${basedir}/src/gen-java"/>
41 <property name="build.lib" value="${basedir}/lib"/>
42 <property name="build.dir" value="${basedir}/build"/>
43 <property name="build.dir.lib" value="${basedir}/build/lib"/>
44 <property name="build.test.dir" value="${build.dir}/test"/>
45 <property name="build.classes" value="${build.dir}/classes"/>
46 <property name="build.classes.main" value="${build.classes}/main" />
47 <property name="build.classes.thrift" value="${build.classes}/thrift" />
48 <property name="javadoc.dir" value="${build.dir}/javadoc"/>
49 <property name="javadoc.jars.dir" value="${build.dir}/javadocs"/>
50 <property name="interface.dir" value="${basedir}/interface"/>
51 <property name="interface.thrift.dir" value="${interface.dir}/thrift"/>
52 <property name="interface.thrift.gen-java" value="${interface.thrift.dir}/gen-java"/>
53 <property name="test.dir" value="${basedir}/test"/>
54 <property name="test.resources" value="${test.dir}/resources"/>
55 <property name="test.lib" value="${build.dir}/test/lib"/>
56 <property name="test.classes" value="${build.dir}/test/classes"/>
57 <property name="test.conf" value="${test.dir}/conf"/>
58 <property name="test.data" value="${test.dir}/data"/>
59 <property name="test.name" value="*Test"/>
60 <property name="test.classlistfile" value="testlist.txt"/>
61 <property name="benchmark.name" value=""/>
62 <property name="test.methods" value=""/>
63 <property name="test.unit.src" value="${test.dir}/unit"/>
64 <property name="test.long.src" value="${test.dir}/long"/>
65 <property name="test.burn.src" value="${test.dir}/burn"/>
66 <property name="test.microbench.src" value="${test.dir}/microbench"/>
67 <property name="dist.dir" value="${build.dir}/dist"/>
68 <property name="tmp.dir" value="${java.io.tmpdir}"/>
69
70 <property name="doc.dir" value="${basedir}/doc"/>
71
72 <property name="source.version" value="1.8"/>
73 <property name="target.version" value="1.8"/>
74
75 <condition property="version" value="${base.version}">
76 <isset property="release"/>
77 </condition>
78 <property name="version" value="${base.version}-SNAPSHOT"/>
79 <property name="version.properties.dir"
80 value="${build.src.resources}/org/apache/cassandra/config/" />
81 <property name="final.name" value="${ant.project.name}-${version}"/>
82
83 <!-- details of what version of Maven ANT Tasks to fetch -->
84 <property name="maven-ant-tasks.version" value="2.1.3" />
85 <property name="maven-ant-tasks.local" value="${user.home}/.m2/repository/org/apache/maven/maven-ant-tasks"/>
86 <property name="maven-ant-tasks.url"
87 value="http://repo2.maven.org/maven2/org/apache/maven/maven-ant-tasks" />
88 <!-- details of how and which Maven repository we publish to -->
89 <property name="maven.version" value="3.0.3" />
90 <condition property="maven-repository-url" value="https://repository.apache.org/service/local/staging/deploy/maven2">
91 <isset property="release"/>
92 </condition>
93 <condition property="maven-repository-id" value="apache.releases.https">
94 <isset property="release"/>
95 </condition>
96 <property name="maven-repository-url" value="https://repository.apache.org/content/repositories/snapshots"/>
97 <property name="maven-repository-id" value="apache.snapshots.https"/>
98
99 <property name="test.timeout" value="240000" />
100 <property name="test.long.timeout" value="600000" />
101 <property name="test.burn.timeout" value="600000" />
102
103 <!-- default for cql tests. Can be override by -Dcassandra.test.use_prepared=false -->
104 <property name="cassandra.test.use_prepared" value="true" />
105
106 <!-- skip flushing schema tables during tests -->
107 <property name="cassandra.test.flush_local_schema_changes" value="false" />
108
109 <!-- http://www.eclemma.org/jacoco/ -->
110 <property name="jacoco.export.dir" value="${build.dir}/jacoco/" />
111 <property name="jacoco.partials.dir" value="${jacoco.export.dir}/partials" />
112 <property name="jacoco.partialexecfile" value="${jacoco.partials.dir}/partial.exec" />
113 <property name="jacoco.finalexecfile" value="${jacoco.export.dir}/jacoco.exec" />
114 <property name="jacoco.version" value="0.7.5.201505241946"/>
115
116 <property name="byteman.version" value="3.0.3"/>
117
118 <property name="ecj.version" value="4.4.2"/>
119
120 <condition property="maven-ant-tasks.jar.exists">
121 <available file="${build.dir}/maven-ant-tasks-${maven-ant-tasks.version}.jar" />
122 </condition>
123
124 <condition property="maven-ant-tasks.jar.local">
125 <available file="${maven-ant-tasks.local}/${maven-ant-tasks.version}/maven-ant-tasks-${maven-ant-tasks.version}.jar" />
126 </condition>
127
128 <condition property="is.source.artifact">
129 <available file="${build.src.java}" type="dir" />
130 </condition>
131
132 <tstamp>
133 <format property="YEAR" pattern="yyyy"/>
134 </tstamp>
135
136 <!-- Check if all tests are being run or just one. If it's all tests don't spam the console with test output.
137 If it's an individual test print the output from the test under the assumption someone is debugging the test
138 and wants to know what is going on without having to context switch to the log file that is generated.
139 Debug level output still needs to be retrieved from the log file. -->
140 <script language="javascript">
141 if (project.getProperty("cassandra.keepBriefBrief") == null)
142 {
143 if (project.getProperty("test.name").equals("*Test"))
144 project.setProperty("cassandra.keepBriefBrief", "true");
145 else
146 project.setProperty("cassandra.keepBriefBrief", "false");
147 }
148 </script>
149
150 <!--
151 Add all the dependencies.
152 -->
153 <path id="maven-ant-tasks.classpath" path="${build.dir}/maven-ant-tasks-${maven-ant-tasks.version}.jar" />
154 <path id="cassandra.classpath">
155 <pathelement location="${build.classes.main}" />
156 <pathelement location="${build.classes.thrift}" />
157 <fileset dir="${build.lib}">
158 <include name="**/*.jar" />
159 <exclude name="**/*-sources.jar"/>
160 <exclude name="**/ant-*.jar"/>
161 </fileset>
162 <fileset dir="${build.dir.lib}">
163 <include name="**/*.jar" />
164 <exclude name="**/*-sources.jar"/>
165 <exclude name="**/ant-*.jar"/>
166 </fileset>
167 </path>
168
169 <macrodef name="create-javadoc">
170 <attribute name="destdir"/>
171 <element name="filesets"/>
172 <sequential>
173 <javadoc destdir="@{destdir}" author="true" version="true" use="true"
174 windowtitle="${ant.project.name} API" classpathref="cassandra.classpath"
175 bottom="Copyright &amp;copy; ${YEAR} The Apache Software Foundation"
176 useexternalfile="yes" encoding="UTF-8"
177 maxmemory="256m">
178 <filesets/>
179 </javadoc>
180 </sequential>
181 </macrodef>
182
183 <!--
184 Setup the output directories.
185 -->
186 <target name="init">
187 <fail unless="is.source.artifact"
188 message="Not a source artifact, stopping here." />
189 <mkdir dir="${build.classes.main}"/>
190 <mkdir dir="${build.classes.thrift}"/>
191 <mkdir dir="${test.lib}"/>
192 <mkdir dir="${test.classes}"/>
193 <mkdir dir="${stress.test.classes}"/>
194 <mkdir dir="${build.src.gen-java}"/>
195 <mkdir dir="${build.dir.lib}"/>
196 <mkdir dir="${jacoco.export.dir}"/>
197 <mkdir dir="${jacoco.partials.dir}"/>
198 </target>
199
200 <target name="clean" description="Remove all locally created artifacts">
201 <delete dir="${build.test.dir}" />
202 <delete dir="${build.classes}" />
203 <delete dir="${build.src.gen-java}" />
204 <delete dir="${version.properties.dir}" />
205 <delete dir="${jacoco.export.dir}" />
206 <delete dir="${jacoco.partials.dir}"/>
207 </target>
208 <target depends="clean" name="cleanall"/>
209
210 <target name="realclean" depends="clean" description="Remove the entire build directory and all downloaded artifacts">
211 <delete dir="${build.dir}" />
212 </target>
213
214 <!--
215 This generates the CQL grammar files from Cql.g
216 -->
217 <target name="check-gen-cql3-grammar">
218 <uptodate property="cql3current"
219 targetfile="${build.src.gen-java}/org/apache/cassandra/cql3/Cql.tokens">
220 <srcfiles dir="${build.src.antlr}">
221 <include name="*.g"/>
222 </srcfiles>
223 </uptodate>
224 </target>
225
226 <target name="gen-cql3-grammar" depends="check-gen-cql3-grammar" unless="cql3current">
227 <echo>Building Grammar ${build.src.antlr}/Cql.g ...</echo>
228 <java classname="org.antlr.Tool"
229 classpath="${build.dir.lib}/jars/antlr-3.5.2.jar;${build.lib}/antlr-runtime-3.5.2.jar;${build.lib}/ST4-4.0.8.jar"
230 fork="true"
231 failonerror="true">
232 <jvmarg value="-Xmx512M" />
233 <arg value="-Xconversiontimeout" />
234 <arg value="10000" />
235 <arg value="${build.src.antlr}/Cql.g" />
236 <arg value="-fo" />
237 <arg value="${build.src.gen-java}/org/apache/cassandra/cql3/" />
238 <arg value="-Xmaxinlinedfastates"/>
239 <arg value="10"/> <!-- default is 60 -->
240 </java>
241 </target>
242
243 <target name="generate-cql-html" depends="maven-ant-tasks-init" description="Generate HTML from textile source">
244 <artifact:dependencies pathId="wikitext.classpath">
245 <dependency groupId="com.datastax.wikitext" artifactId="wikitext-core-ant" version="1.3"/>
246 <dependency groupId="org.fusesource.wikitext" artifactId="textile-core" version="1.3"/>
247 <remoteRepository refid="central"/>
248 <remoteRepository refid="apache"/>
249 </artifact:dependencies>
250 <taskdef classpathref="wikitext.classpath" resource="wikitexttasks.properties" />
251 <wikitext-to-html markupLanguage="Textile">
252 <fileset dir="${basedir}">
253 <include name="doc/cql3/*.textile"/>
254 </fileset>
255 </wikitext-to-html>
256 </target>
257
258 <target name="gen-doc" depends="maven-ant-tasks-init" description="Generate documentation">
259 <exec executable="make" osfamily="unix" dir="${doc.dir}">
260 <arg value="html"/>
261 </exec>
262 <exec executable="cmd" osfamily="dos" dir="${doc.dir}">
263 <arg value="/c"/>
264 <arg value="make.bat"/>
265 <arg value="html"/>
266 </exec>
267 </target>
268
269 <!--
270 Generates Java sources for tokenization support from jflex
271 grammar files
272 -->
273 <target name="generate-jflex-java" description="Generate Java from jflex grammar">
274 <taskdef classname="jflex.anttask.JFlexTask" classpath="${build.lib}/jflex-1.6.0.jar" name="jflex" />
275 <jflex file="${build.src.java}/org/apache/cassandra/index/sasi/analyzer/StandardTokenizerImpl.jflex" destdir="${build.src.gen-java}/" />
276 </target>
277
278 <!--
279 Fetch Maven Ant Tasks and Cassandra's dependencies
280 These targets are intentionally free of dependencies so that they
281 can be run stand-alone from a binary release artifact.
282 -->
283 <target name="maven-ant-tasks-localrepo" unless="maven-ant-tasks.jar.exists" if="maven-ant-tasks.jar.local"
284 depends="init" description="Fetch Maven ANT Tasks from Maven Local Repository">
285 <copy file="${maven-ant-tasks.local}/${maven-ant-tasks.version}/maven-ant-tasks-${maven-ant-tasks.version}.jar"
286 tofile="${build.dir}/maven-ant-tasks-${maven-ant-tasks.version}.jar"/>
287 <property name="maven-ant-tasks.jar.exists" value="true"/>
288 </target>
289
290 <target name="maven-ant-tasks-download" depends="init,maven-ant-tasks-localrepo" unless="maven-ant-tasks.jar.exists"
291 description="Fetch Maven ANT Tasks from Maven Central Repositroy">
292 <echo>Downloading Maven ANT Tasks...</echo>
293 <get src="${maven-ant-tasks.url}/${maven-ant-tasks.version}/maven-ant-tasks-${maven-ant-tasks.version}.jar"
294 dest="${build.dir}/maven-ant-tasks-${maven-ant-tasks.version}.jar" usetimestamp="true" />
295 <copy file="${build.dir}/maven-ant-tasks-${maven-ant-tasks.version}.jar"
296 tofile="${maven-ant-tasks.local}/${maven-ant-tasks.version}/maven-ant-tasks-${maven-ant-tasks.version}.jar"/>
297 </target>
298
299 <target name="maven-ant-tasks-init" depends="init,maven-ant-tasks-download" unless="maven-ant-tasks.initialized"
300 description="Initialize Maven ANT Tasks">
301 <typedef uri="antlib:org.apache.maven.artifact.ant" classpathref="maven-ant-tasks.classpath" />
302
303 <!-- define the remote repositories we use -->
304 <artifact:remoteRepository id="central" url="${artifact.remoteRepository.central}"/>
305 <artifact:remoteRepository id="apache" url="${artifact.remoteRepository.apache}"/>
306
307 <macrodef name="install">
308 <attribute name="pomFile"/>
309 <attribute name="file"/>
310 <attribute name="classifier" default=""/>
311 <attribute name="packaging" default="jar"/>
312 <sequential>
313 <artifact:mvn mavenVersion="${maven.version}" fork="true" failonerror="true">
314 <arg value="org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file" />
315 <arg value="-DpomFile=@{pomFile}" />
316 <arg value="-Dfile=@{file}" />
317 <arg value="-Dclassifier=@{classifier}" />
318 <arg value="-Dpackaging=@{packaging}" />
319 </artifact:mvn>
320 </sequential>
321 </macrodef>
322
323 <macrodef name="deploy">
324 <attribute name="pomFile"/>
325 <attribute name="file"/>
326 <attribute name="classifier" default=""/>
327 <attribute name="packaging" default="jar"/>
328 <sequential>
329 <artifact:mvn mavenVersion="${maven.version}" fork="true" failonerror="true">
330 <jvmarg value="-Xmx512m"/>
331 <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.4:sign-and-deploy-file" />
332 <arg value="-DretryFailedDeploymentCount=5" />
333 <arg value="-Durl=${maven-repository-url}" />
334 <arg value="-DrepositoryId=${maven-repository-id}" />
335 <arg value="-DpomFile=@{pomFile}" />
336 <arg value="-Dfile=@{file}" />
337 <arg value="-Dclassifier=@{classifier}" />
338 <arg value="-Dpackaging=@{packaging}" />
339 <arg value="-Papache-release" />
340 </artifact:mvn>
341 </sequential>
342 </macrodef>
343
344 <property name="maven-ant-tasks.initialized" value="true"/>
345 </target>
346
347 <!-- this task defines the dependencies that will be fetched by Maven ANT Tasks
348 the dependencies are re-used for publishing artifacts to Maven Central
349 in order to keep everything consistent -->
350 <target name="maven-declare-dependencies" depends="maven-ant-tasks-init"
351 description="Define dependencies and dependency versions">
352 <!-- The parent pom defines the versions of all dependencies -->
353 <artifact:pom id="parent-pom"
354 groupId="org.apache.cassandra"
355 artifactId="cassandra-parent"
356 packaging="pom"
357 version="${version}"
358 url="http://cassandra.apache.org"
359 name="Apache Cassandra"
360 inceptionYear="2009"
361 description="The Apache Cassandra Project develops a highly scalable second-generation distributed database, bringing together Dynamo's fully distributed design and Bigtable's ColumnFamily-based data model.">
362 <license name="The Apache Software License, Version 2.0" url="http://www.apache.org/licenses/LICENSE-2.0.txt"/>
363 <scm connection="${scm.connection}" developerConnection="${scm.developerConnection}" url="${scm.url}"/>
364 <dependencyManagement>
365 <dependency groupId="org.xerial.snappy" artifactId="snappy-java" version="1.1.1.7"/>
366 <dependency groupId="net.jpountz.lz4" artifactId="lz4" version="1.3.0"/>
367 <dependency groupId="com.ning" artifactId="compress-lzf" version="0.8.4"/>
368 <dependency groupId="com.google.guava" artifactId="guava" version="18.0"/>
369 <dependency groupId="org.hdrhistogram" artifactId="HdrHistogram" version="2.1.9"/>
370 <dependency groupId="commons-cli" artifactId="commons-cli" version="1.1"/>
371 <dependency groupId="commons-codec" artifactId="commons-codec" version="1.9"/>
372 <dependency groupId="org.apache.commons" artifactId="commons-lang3" version="3.1"/>
373 <dependency groupId="org.apache.commons" artifactId="commons-math3" version="3.2"/>
374 <dependency groupId="com.googlecode.concurrentlinkedhashmap" artifactId="concurrentlinkedhashmap-lru" version="1.4"/>
375 <dependency groupId="org.antlr" artifactId="antlr" version="3.5.2">
376 <exclusion groupId="org.antlr" artifactId="stringtemplate"/>
377 </dependency>
378 <dependency groupId="org.antlr" artifactId="antlr-runtime" version="3.5.2">
379 <exclusion groupId="org.antlr" artifactId="stringtemplate"/>
380 </dependency>
381 <dependency groupId="org.slf4j" artifactId="slf4j-api" version="1.7.7"/>
382 <dependency groupId="org.slf4j" artifactId="log4j-over-slf4j" version="1.7.7"/>
383 <dependency groupId="org.slf4j" artifactId="jcl-over-slf4j" version="1.7.7" />
384 <dependency groupId="ch.qos.logback" artifactId="logback-core" version="1.1.3"/>
385 <dependency groupId="ch.qos.logback" artifactId="logback-classic" version="1.1.3"/>
386 <dependency groupId="org.codehaus.jackson" artifactId="jackson-core-asl" version="1.9.2"/>
387 <dependency groupId="org.codehaus.jackson" artifactId="jackson-mapper-asl" version="1.9.2"/>
388 <dependency groupId="com.googlecode.json-simple" artifactId="json-simple" version="1.1"/>
389 <dependency groupId="com.boundary" artifactId="high-scale-lib" version="1.0.6"/>
390 <dependency groupId="com.github.jbellis" artifactId="jamm" version="0.3.0"/>
391
392 <dependency groupId="com.thinkaurelius.thrift" artifactId="thrift-server" version="0.3.7">
393 <exclusion groupId="org.slf4j" artifactId="slf4j-log4j12"/>
394 <exclusion groupId="junit" artifactId="junit"/>
395 </dependency>
396 <dependency groupId="org.yaml" artifactId="snakeyaml" version="1.11"/>
397 <dependency groupId="org.apache.thrift" artifactId="libthrift" version="0.9.2">
398 <exclusion groupId="commons-logging" artifactId="commons-logging"/>
399 </dependency>
400 <dependency groupId="junit" artifactId="junit" version="4.6" />
401 <dependency groupId="org.apache.rat" artifactId="apache-rat" version="0.10">
402 <exclusion groupId="commons-lang" artifactId="commons-lang"/>
403 </dependency>
404 <dependency groupId="org.apache.hadoop" artifactId="hadoop-core" version="1.0.3">
405 <exclusion groupId="org.mortbay.jetty" artifactId="servlet-api"/>
406 <exclusion groupId="commons-logging" artifactId="commons-logging"/>
407 <exclusion groupId="org.eclipse.jdt" artifactId="core"/>
408 <exclusion groupId="ant" artifactId="ant"/>
409 <exclusion groupId="junit" artifactId="junit"/>
410 </dependency>
411 <dependency groupId="org.apache.hadoop" artifactId="hadoop-minicluster" version="1.0.3">
412 <exclusion groupId="asm" artifactId="asm"/> <!-- this is the outdated version 3.1 -->
413 </dependency>
414 <dependency groupId="net.java.dev.jna" artifactId="jna" version="4.2.2"/>
415
416 <dependency groupId="org.jacoco" artifactId="org.jacoco.agent" version="${jacoco.version}"/>
417 <dependency groupId="org.jacoco" artifactId="org.jacoco.ant" version="${jacoco.version}"/>
418
419 <dependency groupId="org.jboss.byteman" artifactId="byteman-install" version="${byteman.version}"/>
420 <dependency groupId="org.jboss.byteman" artifactId="byteman" version="${byteman.version}"/>
421 <dependency groupId="org.jboss.byteman" artifactId="byteman-submit" version="${byteman.version}"/>
422 <dependency groupId="org.jboss.byteman" artifactId="byteman-bmunit" version="${byteman.version}"/>
423
424
425 <dependency groupId="org.openjdk.jmh" artifactId="jmh-core" version="1.21"/>
426 <dependency groupId="org.openjdk.jmh" artifactId="jmh-generator-annprocess" version="1.21"/>
427
428 <dependency groupId="org.apache.cassandra" artifactId="cassandra-all" version="${version}" />
429 <dependency groupId="org.apache.cassandra" artifactId="cassandra-thrift" version="${version}" />
430 <dependency groupId="io.dropwizard.metrics" artifactId="metrics-core" version="3.1.5" />
431 <dependency groupId="io.dropwizard.metrics" artifactId="metrics-jvm" version="3.1.5" />
432 <dependency groupId="com.addthis.metrics" artifactId="reporter-config3" version="3.0.3" />
433 <dependency groupId="org.mindrot" artifactId="jbcrypt" version="0.3m" />
434 <dependency groupId="io.airlift" artifactId="airline" version="0.6" />
435 <dependency groupId="io.netty" artifactId="netty-all" version="4.0.44.Final" />
436 <dependency groupId="com.google.code.findbugs" artifactId="jsr305" version="2.0.2" />
437 <dependency groupId="com.clearspring.analytics" artifactId="stream" version="2.5.2" />
438 <dependency groupId="com.datastax.cassandra" artifactId="cassandra-driver-core" version="3.0.1" classifier="shaded">
439 <exclusion groupId="io.netty" artifactId="netty-buffer"/>
440 <exclusion groupId="io.netty" artifactId="netty-codec"/>
441 <exclusion groupId="io.netty" artifactId="netty-handler"/>
442 <exclusion groupId="io.netty" artifactId="netty-transport"/>
443 </dependency>
444 <dependency groupId="org.eclipse.jdt.core.compiler" artifactId="ecj" version="4.4.2" />
445 <dependency groupId="org.caffinitas.ohc" artifactId="ohc-core" version="0.4.4" />
446 <dependency groupId="org.caffinitas.ohc" artifactId="ohc-core-j8" version="0.4.4" />
447 <dependency groupId="net.ju-n.compile-command-annotations" artifactId="compile-command-annotations" version="1.2.0" />
448 <dependency groupId="org.fusesource" artifactId="sigar" version="1.6.4">
449 <exclusion groupId="log4j" artifactId="log4j"/>
450 </dependency>
451 <dependency groupId="joda-time" artifactId="joda-time" version="2.4" />
452 <dependency groupId="com.carrotsearch" artifactId="hppc" version="0.5.4" />
453 <dependency groupId="de.jflex" artifactId="jflex" version="1.6.0" />
454 <dependency groupId="com.github.rholder" artifactId="snowball-stemmer" version="1.3.0.581.1" />
455 <dependency groupId="com.googlecode.concurrent-trees" artifactId="concurrent-trees" version="2.4.0" />
456 <dependency groupId="com.github.ben-manes.caffeine" artifactId="caffeine" version="2.2.6" />
457 <dependency groupId="org.jctools" artifactId="jctools-core" version="1.2.1"/>
458 <dependency groupId="org.ow2.asm" artifactId="asm" version="5.0.4" />
459 </dependencyManagement>
460 <developer id="adelapena" name="Andres de la Peña"/>
461 <developer id="alakshman" name="Avinash Lakshman"/>
462 <developer id="aleksey" name="Aleksey Yeschenko"/>
463 <developer id="amorton" name="Aaron Morton"/>
464 <developer id="aweisberg" name="Ariel Weisberg"/>
465 <developer id="bdeggleston" name="Blake Eggleston"/>
466 <developer id="benedict" name="Benedict Elliott Smith"/>
467 <developer id="benjamin" name="Benjamin Lerer"/>
468 <developer id="blambov" name="Branimir Lambov"/>
469 <developer id="brandonwilliams" name="Brandon Williams"/>
470 <developer id="carl" name="Carl Yeksigian"/>
471 <developer id="dbrosius" name="David Brosiusd"/>
472 <developer id="dikang" name="Dikang Gu"/>
473 <developer id="eevans" name="Eric Evans"/>
474 <developer id="gdusbabek" name="Gary Dusbabek"/>
475 <developer id="goffinet" name="Chris Goffinet"/>
476 <developer id="ifesdjeen" name="Alex Petrov"/>
477 <developer id="jaakko" name="Laine Jaakko Olavi"/>
478 <developer id="jake" name="T Jake Luciani"/>
479 <developer id="jasonbrown" name="Jason Brown"/>
480 <developer id="jbellis" name="Jonathan Ellis"/>
481 <developer id="jfarrell" name="Jake Farrell"/>
482 <developer id="jjirsa" name="Jeff Jirsa"/>
483 <developer id="jkni" name="Joel Knighton"/>
484 <developer id="jmckenzie" name="Josh McKenzie"/>
485 <developer id="johan" name="Johan Oskarsson"/>
486 <developer id="junrao" name="Jun Rao"/>
487 <developer id="jzhuang" name="Jay Zhuang"/>
488 <developer id="kohlisankalp" name="Sankalp Kohli"/>
489 <developer id="marcuse" name="Marcus Eriksson"/>
490 <developer id="mck" name="Michael Semb Wever"/>
491 <developer id="mishail" name="Mikhail Stepura"/>
492 <developer id="mshuler" name="Michael Shuler"/>
493 <developer id="paulo" name="Paulo Motta"/>
494 <developer id="pmalik" name="Prashant Malik"/>
495 <developer id="rstupp" name="Robert Stupp"/>
496 <developer id="scode" name="Peter Schuller"/>
497 <developer id="beobal" name="Sam Tunnicliffe"/>
498 <developer id="slebresne" name="Sylvain Lebresne"/>
499 <developer id="stefania" name="Stefania Alborghetti"/>
500 <developer id="tylerhobbs" name="Tyler Hobbs"/>
501 <developer id="vijay" name="Vijay Parthasarathy"/>
502 <developer id="xedin" name="Pavel Yaskevich"/>
503 <developer id="yukim" name="Yuki Morishita"/>
504 <developer id="zznate" name="Nate McCall"/>
505 </artifact:pom>
506
507 <!-- each dependency set then defines the subset of the dependencies for that dependency set -->
508 <artifact:pom id="build-deps-pom"
509 artifactId="cassandra-build-deps">
510 <parent groupId="org.apache.cassandra"
511 artifactId="cassandra-parent"
512 version="${version}"/>
513 <dependency groupId="junit" artifactId="junit"/>
514 <dependency groupId="org.apache.rat" artifactId="apache-rat"/>
515 <dependency groupId="org.apache.hadoop" artifactId="hadoop-core"/>
516 <dependency groupId="org.apache.hadoop" artifactId="hadoop-minicluster"/>
517 <dependency groupId="com.google.code.findbugs" artifactId="jsr305"/>
518 <dependency groupId="org.antlr" artifactId="antlr"/>
519 <dependency groupId="com.datastax.cassandra" artifactId="cassandra-driver-core" classifier="shaded">
520 <exclusion groupId="io.netty" artifactId="netty-buffer"/>
521 <exclusion groupId="io.netty" artifactId="netty-codec"/>
522 <exclusion groupId="io.netty" artifactId="netty-handler"/>
523 <exclusion groupId="io.netty" artifactId="netty-transport"/>
524 </dependency>
525 <dependency groupId="org.eclipse.jdt.core.compiler" artifactId="ecj"/>
526 <dependency groupId="org.caffinitas.ohc" artifactId="ohc-core" version="0.4.4" />
527 <dependency groupId="org.caffinitas.ohc" artifactId="ohc-core-j8" version="0.4.4" />
528 <dependency groupId="org.openjdk.jmh" artifactId="jmh-core"/>
529 <dependency groupId="org.openjdk.jmh" artifactId="jmh-generator-annprocess"/>
530 <dependency groupId="net.ju-n.compile-command-annotations" artifactId="compile-command-annotations"/>
531 <dependency groupId="org.apache.ant" artifactId="ant-junit" version="1.9.4" />
532 </artifact:pom>
533 <!-- this build-deps-pom-sources "artifact" is the same as build-deps-pom but only with those
534 artifacts that have "-source.jar" files -->
535 <artifact:pom id="build-deps-pom-sources"
536 artifactId="cassandra-build-deps">
537 <parent groupId="org.apache.cassandra"
538 artifactId="cassandra-parent"
539 version="${version}"/>
540 <dependency groupId="junit" artifactId="junit"/>
541 <dependency groupId="com.datastax.cassandra" artifactId="cassandra-driver-core" classifier="shaded">
542 <exclusion groupId="io.netty" artifactId="netty-buffer"/>
543 <exclusion groupId="io.netty" artifactId="netty-codec"/>
544 <exclusion groupId="io.netty" artifactId="netty-handler"/>
545 <exclusion groupId="io.netty" artifactId="netty-transport"/>
546 </dependency>
547 <dependency groupId="io.netty" artifactId="netty-all"/>
548 <dependency groupId="org.eclipse.jdt.core.compiler" artifactId="ecj"/>
549 <dependency groupId="org.caffinitas.ohc" artifactId="ohc-core"/>
550 <dependency groupId="org.openjdk.jmh" artifactId="jmh-core"/>
551 <dependency groupId="org.openjdk.jmh" artifactId="jmh-generator-annprocess"/>
552 <dependency groupId="net.ju-n.compile-command-annotations" artifactId="compile-command-annotations"/>
553 <dependency groupId="org.apache.ant" artifactId="ant-junit" version="1.9.4" />
554 </artifact:pom>
555
556 <artifact:pom id="coverage-deps-pom"
557 artifactId="cassandra-coverage-deps">
558 <parent groupId="org.apache.cassandra"
559 artifactId="cassandra-parent"
560 version="${version}"/>
561 <dependency groupId="org.jacoco" artifactId="org.jacoco.agent"/>
562 <dependency groupId="org.jacoco" artifactId="org.jacoco.ant" />
563 <dependency groupId="org.jboss.byteman" artifactId="byteman-install"/>
564 <dependency groupId="org.jboss.byteman" artifactId="byteman"/>
565 <dependency groupId="org.jboss.byteman" artifactId="byteman-submit"/>
566 <dependency groupId="org.jboss.byteman" artifactId="byteman-bmunit"/>
567 </artifact:pom>
568
569 <artifact:pom id="test-deps-pom"
570 artifactId="cassandra-test-deps">
571 <parent groupId="org.apache.cassandra"
572 artifactId="cassandra-parent"
573 version="${version}"/>
574 <dependency groupId="joda-time" artifactId="joda-time"/>
575 </artifact:pom>
576
577 <!-- now the pom's for artifacts being deployed to Maven Central -->
578
579 <artifact:pom id="all-pom"
580 artifactId="cassandra-all"
581 url="http://cassandra.apache.org"
582 name="Apache Cassandra">
583 <parent groupId="org.apache.cassandra"
584 artifactId="cassandra-parent"
585 version="${version}"/>
586 <scm connection="${scm.connection}" developerConnection="${scm.developerConnection}" url="${scm.url}"/>
587 <dependency groupId="org.xerial.snappy" artifactId="snappy-java"/>
588 <dependency groupId="net.jpountz.lz4" artifactId="lz4"/>
589 <dependency groupId="com.ning" artifactId="compress-lzf"/>
590 <dependency groupId="com.google.guava" artifactId="guava"/>
591 <dependency groupId="commons-cli" artifactId="commons-cli"/>
592 <dependency groupId="commons-codec" artifactId="commons-codec"/>
593 <dependency groupId="org.apache.commons" artifactId="commons-lang3"/>
594 <dependency groupId="org.apache.commons" artifactId="commons-math3"/>
595 <dependency groupId="com.googlecode.concurrentlinkedhashmap" artifactId="concurrentlinkedhashmap-lru"/>
596 <dependency groupId="org.antlr" artifactId="antlr"/>
597 <dependency groupId="org.antlr" artifactId="antlr-runtime"/>
598 <dependency groupId="org.slf4j" artifactId="slf4j-api"/>
599 <dependency groupId="org.slf4j" artifactId="log4j-over-slf4j"/>
600 <dependency groupId="org.slf4j" artifactId="jcl-over-slf4j"/>
601 <dependency groupId="org.codehaus.jackson" artifactId="jackson-core-asl"/>
602 <dependency groupId="org.codehaus.jackson" artifactId="jackson-mapper-asl"/>
603 <dependency groupId="com.googlecode.json-simple" artifactId="json-simple"/>
604 <dependency groupId="com.boundary" artifactId="high-scale-lib"/>
605 <dependency groupId="org.yaml" artifactId="snakeyaml"/>
606 <dependency groupId="org.mindrot" artifactId="jbcrypt"/>
607 <dependency groupId="io.airlift" artifactId="airline"/>
608 <dependency groupId="io.dropwizard.metrics" artifactId="metrics-core"/>
609 <dependency groupId="io.dropwizard.metrics" artifactId="metrics-jvm"/>
610 <dependency groupId="com.addthis.metrics" artifactId="reporter-config3"/>
611 <dependency groupId="com.thinkaurelius.thrift" artifactId="thrift-server"/>
612 <dependency groupId="com.clearspring.analytics" artifactId="stream"/>
613
614 <dependency groupId="ch.qos.logback" artifactId="logback-core"/>
615 <dependency groupId="ch.qos.logback" artifactId="logback-classic"/>
616
617 <dependency groupId="org.apache.thrift" artifactId="libthrift"/>
618 <dependency groupId="org.apache.cassandra" artifactId="cassandra-thrift"/>
619
620 <!-- don't need hadoop classes to run, but if you use the hadoop stuff -->
621 <dependency groupId="org.apache.hadoop" artifactId="hadoop-core" optional="true"/>
622 <dependency groupId="org.apache.hadoop" artifactId="hadoop-minicluster" optional="true"/>
623
624 <!-- don't need the Java Driver to run, but if you use the hadoop stuff or UDFs -->
625 <dependency groupId="com.datastax.cassandra" artifactId="cassandra-driver-core" classifier="shaded" optional="true">
626 <exclusion groupId="io.netty" artifactId="netty-buffer"/>
627 <exclusion groupId="io.netty" artifactId="netty-codec"/>
628 <exclusion groupId="io.netty" artifactId="netty-handler"/>
629 <exclusion groupId="io.netty" artifactId="netty-transport"/>
630 </dependency>
631
632 <!-- don't need jna to run, but nice to have -->
633 <dependency groupId="net.java.dev.jna" artifactId="jna"/>
634
635 <!-- don't need jamm unless running a server in which case it needs to be a -javagent to be used anyway -->
636 <dependency groupId="com.github.jbellis" artifactId="jamm"/>
637
638 <dependency groupId="io.netty" artifactId="netty-all"/>
639 <dependency groupId="joda-time" artifactId="joda-time"/>
640 <dependency groupId="org.fusesource" artifactId="sigar"/>
641 <dependency groupId="org.eclipse.jdt.core.compiler" artifactId="ecj"/>
642 <dependency groupId="org.caffinitas.ohc" artifactId="ohc-core"/>
643 <dependency groupId="org.caffinitas.ohc" artifactId="ohc-core-j8"/>
644 <dependency groupId="com.github.ben-manes.caffeine" artifactId="caffeine" />
645 <dependency groupId="org.jctools" artifactId="jctools-core"/>
646 <dependency groupId="org.ow2.asm" artifactId="asm" />
647 </artifact:pom>
648 <artifact:pom id="thrift-pom"
649 artifactId="cassandra-thrift"
650 url="http://cassandra.apache.org"
651 name="Apache Cassandra">
652 <parent groupId="org.apache.cassandra"
653 artifactId="cassandra-parent"
654 version="${version}"/>
655 <scm connection="${scm.connection}" developerConnection="${scm.developerConnection}" url="${scm.url}"/>
656 <dependency groupId="org.apache.commons" artifactId="commons-lang3"/>
657 <dependency groupId="org.slf4j" artifactId="slf4j-api"/>
658 <dependency groupId="org.slf4j" artifactId="log4j-over-slf4j"/>
659 <dependency groupId="org.slf4j" artifactId="jcl-over-slf4j"/>
660 <dependency groupId="org.apache.thrift" artifactId="libthrift"/>
661 <dependency groupId="com.carrotsearch" artifactId="hppc" version="0.5.4" />
662 <dependency groupId="de.jflex" artifactId="jflex" version="1.6.0" />
663 <dependency groupId="com.github.rholder" artifactId="snowball-stemmer" version="1.3.0.581.1" />
664 <dependency groupId="com.googlecode.concurrent-trees" artifactId="concurrent-trees" version="2.4.0" />
665
666 </artifact:pom>
667 <artifact:pom id="dist-pom"
668 artifactId="apache-cassandra"
669 packaging="pom"
670 url="http://cassandra.apache.org"
671 name="Apache Cassandra">
672 <parent groupId="org.apache.cassandra"
673 artifactId="cassandra-parent"
674 version="${version}"/>
675 <scm connection="${scm.connection}" developerConnection="${scm.developerConnection}" url="${scm.url}"/>
676 </artifact:pom>
677 </target>
678
679 <target name="maven-ant-tasks-retrieve-build" depends="maven-declare-dependencies" unless="without.maven">
680 <!-- retrieve artifacts -->
681 <artifact:dependencies pomRefId="build-deps-pom"
682 filesetId="build-dependency-jars"
683 cacheDependencyRefs="true"
684 dependencyRefsBuildFile="${build.dir}/build-dependencies.xml">
685 <remoteRepository refid="central"/>
686 <remoteRepository refid="apache"/>
687 </artifact:dependencies>
688 <!-- retrieve -source.jar artifacts using the reference-pom with the artifacts that have these -->
689 <artifact:dependencies pomRefId="build-deps-pom-sources"
690 sourcesFilesetId="build-dependency-sources"
691 cacheDependencyRefs="true"
692 dependencyRefsBuildFile="${build.dir}/build-dependencies-sources.xml">
693 <remoteRepository refid="central"/>
694 <remoteRepository refid="apache"/>
695 </artifact:dependencies>
696 <copy todir="${build.dir.lib}/jars">
697 <fileset refid="build-dependency-jars"/>
698 <mapper type="flatten"/>
699 </copy>
700 <copy todir="${build.dir.lib}/sources">
701 <fileset refid="build-dependency-sources"/>
702 <mapper type="flatten"/>
703 </copy>
704 <!-- code coverage tools -->
705 <artifact:dependencies pomRefId="coverage-deps-pom"
706 filesetId="coverage-dependency-jars">
707 <remoteRepository refid="central"/>
708 </artifact:dependencies>
709 <copy todir="${build.dir.lib}/jars">
710 <fileset refid="coverage-dependency-jars"/>
711 <mapper type="flatten"/>
712 </copy>
713 <!-- jacoco agent jar comes wrapped in a jar -->
714 <unzip src="${build.dir.lib}/jars/org.jacoco.agent-${jacoco.version}.jar" dest="${build.dir.lib}/jars">
715 <patternset>
716 <include name="*.jar"/>
717 </patternset>
718 <mapper type="flatten"/>
719 </unzip>
720 </target>
721
722 <target name="maven-ant-tasks-retrieve-test" depends="maven-ant-tasks-init">
723 <artifact:dependencies pomRefId="test-deps-pom"
724 filesetId="test-dependency-jars"
725 sourcesFilesetId="test-dependency-sources"
726 cacheDependencyRefs="true"
727 dependencyRefsBuildFile="${build.dir}/test-dependencies.xml">
728 <remoteRepository refid="apache"/>
729 <remoteRepository refid="central"/>
730 </artifact:dependencies>
731 <copy todir="${test.lib}/jars">
732 <fileset refid="test-dependency-jars"/>
733 <mapper type="flatten"/>
734 </copy>
735 <copy todir="${test.lib}/sources">
736 <fileset refid="test-dependency-sources"/>
737 <mapper type="flatten"/>
738 </copy>
739 </target>
740
741 <target name="echo-base-version">
742 <echo message="${base.version}" />
743 </target>
744
745 <!--
746 Generate thrift code. We have targets to build java because
747 Cassandra depends on it, and python because that is what the system
748 tests run.
749 -->
750 <target name="check-gen-thrift-java">
751 <uptodate property="thriftUpToDate" srcfile="${interface.dir}/cassandra.thrift"
752 targetfile="${interface.thrift.gen-java}/org/apache/cassandra/thrift/Cassandra.java" />
753 </target>
754 <target name="gen-thrift-java" unless="thriftUpToDate" depends="check-gen-thrift-java"
755 description="Generate Thrift Java artifacts">
756 <echo>Generating Thrift Java code from ${basedir}/interface/cassandra.thrift...</echo>
757 <exec executable="thrift" dir="${basedir}/interface" failonerror="true">
758 <arg line="--gen java:hashcode" />
759 <arg line="-o ${interface.thrift.dir}" />
760 <arg line="cassandra.thrift" />
761 </exec>
762 <antcall target="write-java-license-headers" />
763 </target>
764
765 <target name="_write-java-license-headers" depends="rat-init">
766 <java classname="org.apache.rat.Report" fork="true"
767 output="${build.dir}/rat-report.log">
768 <classpath refid="rat.classpath" />
769 <arg value="-a" />
770 <arg value="--force" />
771 <arg value="interface/thrift" />
772 </java>
773 </target>
774
775 <target name="write-java-license-headers" unless="without.rat" description="Add missing java license headers">
776 <antcall target="_write-java-license-headers" />
777 </target>
778
779 <target name="gen-thrift-py" description="Generate Thrift Python artifacts">
780 <echo>Generating Thrift Python code from ${basedir}/interface/cassandra.thrift...</echo>
781 <exec executable="thrift" dir="${basedir}/interface" failonerror="true">
782 <arg line="--gen py" />
783 <arg line="-o ${interface.thrift.dir}" />
784 <arg line="cassandra.thrift" />
785 </exec>
786 <exec executable="thrift" dir="${basedir}/interface" failonerror="true">
787 <arg line="--gen py:twisted" />
788 <arg line="-o ${interface.thrift.dir}" />
789 <arg line="cassandra.thrift" />
790 </exec>
791 </target>
792
793 <!-- create properties file with C version -->
794 <target name="createVersionPropFile">
795 <taskdef name="propertyfile" classname="org.apache.tools.ant.taskdefs.optional.PropertyFile"/>
796 <mkdir dir="${version.properties.dir}"/>
797 <propertyfile file="${version.properties.dir}/version.properties">
798 <entry key="CassandraVersion" value="${version}"/>
799 </propertyfile>
800 </target>
801
802 <target name="test-run" depends="build"
803 description="Run in test mode. Not for production use!">
804 <java classname="org.apache.cassandra.service.CassandraDaemon" fork="true">
805 <classpath>
806 <path refid="cassandra.classpath"/>
807 <pathelement location="${test.conf}"/>
808 </classpath>
809 <jvmarg value="-Dstorage-config=${test.conf}"/>
810 <jvmarg value="-javaagent:${basedir}/lib/jamm-0.3.0.jar" />
811 <jvmarg value="-ea"/>
812 </java>
813 </target>
814
815 <!--
816 The build target builds all the .class files
817 -->
818 <target name="build"
819 depends="maven-ant-tasks-retrieve-build,build-project" description="Compile Cassandra classes"/>
820 <target name="codecoverage" depends="jacoco-run,jacoco-report" description="Create code coverage report"/>
821
822 <target depends="init,gen-cql3-grammar,generate-cql-html,generate-jflex-java"
823 name="build-project">
824 <echo message="${ant.project.name}: ${ant.file}"/>
825 <!-- Order matters! -->
826 <javac fork="true"
827 debug="true" debuglevel="${debuglevel}" encoding="utf-8"
828 destdir="${build.classes.thrift}" includeantruntime="false" source="${source.version}" target="${target.version}"
829 memorymaximumsize="512M">
830 <src path="${interface.thrift.dir}/gen-java"/>
831 <classpath refid="cassandra.classpath"/>
832 </javac>
833 <javac fork="true"
834 debug="true" debuglevel="${debuglevel}" encoding="utf-8"
835 destdir="${build.classes.main}" includeantruntime="false" source="${source.version}" target="${target.version}"
836 memorymaximumsize="512M">
837 <src path="${build.src.java}"/>
838 <src path="${build.src.gen-java}"/>
839 <compilerarg value="-XDignore.symbol.file"/>
840 <compilerarg value="-Xbootclasspath/p:${build.src.jdkoverride}"/>
841 <classpath refid="cassandra.classpath"/>
842 </javac>
843 <antcall target="createVersionPropFile"/>
844 <copy todir="${build.classes.main}">
845 <fileset dir="${build.src.resources}" />
846 </copy>
847 <copy todir="${basedir}/conf" file="${build.classes.main}/META-INF/hotspot_compiler"/>
848 </target>
849
850 <!-- Stress build file -->
851 <property name="stress.build.src" value="${basedir}/tools/stress/src" />
852 <property name="stress.test.src" value="${basedir}/tools/stress/test/unit" />
853 <property name="stress.build.classes" value="${build.classes}/stress" />
854 <property name="stress.test.classes" value="${build.dir}/test/stress-classes" />
855 <property name="stress.manifest" value="${stress.build.classes}/MANIFEST.MF" />
856 <path id="cassandra.classes">
857 <pathelement location="${basedir}/build/classes/main" />
858 <pathelement location="${basedir}/build/classes/thrift" />
859 </path>
860
861 <target name="stress-build-test" depends="stress-build" description="Compile stress tests">
862 <javac debug="true" debuglevel="${debuglevel}" destdir="${stress.test.classes}"
863 includeantruntime="false"
864 source="${source.version}"
865 target="${target.version}"
866 encoding="utf-8">
867 <classpath>
868 <path refid="cassandra.classpath"/>
869 <pathelement location="${stress.build.classes}" />
870 </classpath>
871 <src path="${stress.test.src}"/>
872 </javac>
873 </target>
874
875 <target name="stress-build" depends="build" description="build stress tool">
876 <mkdir dir="${stress.build.classes}" />
877 <javac compiler="modern" debug="true" debuglevel="${debuglevel}" encoding="utf-8" destdir="${stress.build.classes}" includeantruntime="true" source="${source.version}" target="${target.version}">
878 <src path="${stress.build.src}" />
879 <classpath>
880 <path refid="cassandra.classes" />
881 <path>
882 <fileset dir="${build.lib}">
883 <include name="**/*.jar" />
884 </fileset>
885 </path>
886 </classpath>
887 </javac>
888 <copy todir="${stress.build.classes}">
889 <fileset dir="${stress.build.src}/resources" />
890 </copy>
891 </target>
892
893 <target name="stress-test" depends="stress-build-test, build-test" description="Runs stress tests">
894 <testmacro inputdir="${stress.test.src}"
895 timeout="${test.timeout}">
896 </testmacro>
897 </target>
898
899 <target name="_write-poms" depends="maven-declare-dependencies">
900 <artifact:writepom pomRefId="parent-pom" file="${build.dir}/${final.name}-parent.pom"/>
901 <artifact:writepom pomRefId="thrift-pom"
902 file="${build.dir}/${ant.project.name}-thrift-${version}.pom"/>
903 <artifact:writepom pomRefId="all-pom" file="${build.dir}/${final.name}.pom"/>
904 </target>
905
906 <target name="write-poms" unless="without.maven">
907 <antcall target="_write-poms" />
908 </target>
909
910 <!--
911 The jar target makes cassandra.jar output.
912 -->
913 <target name="jar"
914 depends="build, build-test, stress-build, write-poms"
915 description="Assemble Cassandra JAR files">
916 <mkdir dir="${build.classes.main}/META-INF" />
917 <mkdir dir="${build.classes.thrift}/META-INF" />
918 <copy file="LICENSE.txt"
919 tofile="${build.classes.main}/META-INF/LICENSE.txt"/>
920 <copy file="LICENSE.txt"
921 tofile="${build.classes.thrift}/META-INF/LICENSE.txt"/>
922 <copy file="NOTICE.txt"
923 tofile="${build.classes.main}/META-INF/NOTICE.txt"/>
924 <copy file="NOTICE.txt"
925 tofile="${build.classes.thrift}/META-INF/NOTICE.txt"/>
926
927 <!-- Thrift Jar -->
928 <jar jarfile="${build.dir}/${ant.project.name}-thrift-${version}.jar"
929 basedir="${build.classes.thrift}">
930 <fileset dir="${build.classes.main}">
931 <include name="org/apache/cassandra/thrift/ITransportFactory*.class" />
932 <include name="org/apache/cassandra/thrift/TFramedTransportFactory*.class" />
933 </fileset>
934 <manifest>
935 <attribute name="Implementation-Title" value="Cassandra"/>
936 <attribute name="Implementation-Version" value="${version}"/>
937 <attribute name="Implementation-Vendor" value="Apache"/>
938 </manifest>
939 </jar>
940
941 <!-- Main Jar -->
942 <jar jarfile="${build.dir}/${final.name}.jar">
943 <fileset dir="${build.classes.main}">
944 <exclude name="org/apache/cassandra/thrift/ITransportFactory*.class" />
945 <exclude name="org/apache/cassandra/thrift/TFramedTransportFactory*.class" />
946 </fileset>
947 <manifest>
948 <!-- <section name="org/apache/cassandra/infrastructure"> -->
949 <attribute name="Implementation-Title" value="Cassandra"/>
950 <attribute name="Implementation-Version" value="${version}"/>
951 <attribute name="Implementation-Vendor" value="Apache"/>
952 <attribute name="Premain-Class"
953 value="org.apache.cassandra.infrastructure.continuations.CAgent"/>
954 <attribute name="Class-Path"
955 value="${ant.project.name}-thrift-${version}.jar" />
956 <!-- </section> -->
957 </manifest>
958 </jar>
959
960 <!-- Stress jar -->
961 <manifest file="${stress.manifest}">
962 <attribute name="Built-By" value="Pavel Yaskevich"/>
963 <attribute name="Main-Class" value="org.apache.cassandra.stress.Stress"/>
964 </manifest>
965 <mkdir dir="${stress.build.classes}/META-INF" />
966 <mkdir dir="${build.dir}/tools/lib/" />
967 <jar destfile="${build.dir}/tools/lib/stress.jar" manifest="${stress.manifest}">
968 <fileset dir="${stress.build.classes}"/>
969 </jar>
970 </target>
971
972 <!--
973 The javadoc-jar target makes cassandra-javadoc.jar output required for publishing to Maven central repository.
974 -->
975 <target name="javadoc-jar" description="Assemble Cassandra JavaDoc JAR file">
976 <mkdir dir="${javadoc.jars.dir}"/>
977 <create-javadoc destdir="${javadoc.jars.dir}/thrift">
978 <filesets>
979 <fileset dir="${interface.thrift.dir}/gen-java" defaultexcludes="yes">
980 <include name="org/apache/**/*.java"/>
981 </fileset>
982 </filesets>
983 </create-javadoc>
984 <jar jarfile="${build.dir}/${ant.project.name}-thrift-${version}-javadoc.jar"
985 basedir="${javadoc.jars.dir}/thrift"/>
986
987 <create-javadoc destdir="${javadoc.jars.dir}/main">
988 <filesets>
989 <fileset dir="${build.src.java}" defaultexcludes="yes">
990 <include name="org/apache/**/*.java"/>
991 </fileset>
992 <fileset dir="${build.src.gen-java}" defaultexcludes="yes">
993 <include name="org/apache/**/*.java"/>
994 </fileset>
995 </filesets>
996 </create-javadoc>
997 <jar jarfile="${build.dir}/${final.name}-javadoc.jar"
998 basedir="${javadoc.jars.dir}/main"/>
999
1000 <!-- javadoc task always rebuilds so might as well remove the generated docs to prevent
1001 being pulled into the distribution by accident -->
1002 <delete quiet="true" dir="${javadoc.jars.dir}"/>
1003 </target>
1004
1005 <!--
1006 The sources-jar target makes cassandra-sources.jar output required for publishing to Maven central repository.
1007 -->
1008 <target name="sources-jar" depends="init" description="Assemble Cassandra Sources JAR file">
1009 <jar jarfile="${build.dir}/${ant.project.name}-thrift-${version}-sources.jar">
1010 <fileset dir="${interface.thrift.dir}/gen-java" defaultexcludes="yes">
1011 <include name="org/apache/**/*.java"/>
1012 </fileset>
1013 </jar>
1014 <jar jarfile="${build.dir}/${final.name}-sources.jar">
1015 <fileset dir="${build.src.java}" defaultexcludes="yes">
1016 <include name="org/apache/**/*.java"/>
1017 </fileset>
1018 <fileset dir="${build.src.gen-java}" defaultexcludes="yes">
1019 <include name="org/apache/**/*.java"/>
1020 </fileset>
1021 </jar>
1022 </target>
1023
1024 <!-- creates release tarballs -->
1025 <target name="artifacts" depends="jar,javadoc,gen-doc"
1026 description="Create Cassandra release artifacts">
1027 <mkdir dir="${dist.dir}"/>
1028 <!-- fix the control linefeed so that builds on windows works on linux -->
1029 <fixcrlf srcdir="bin" includes="**/*" excludes="**/*.bat, **/*.ps1" eol="lf" eof="remove" />
1030 <fixcrlf srcdir="conf" includes="**/*" excludes="**/*.bat, **/*.ps1" eol="lf" eof="remove" />
1031 <fixcrlf srcdir="tools/bin" includes="**/*" excludes="**/*.bat, **/*.ps1" eol="lf" eof="remove" />
1032 <copy todir="${dist.dir}/lib">
1033 <fileset dir="${build.lib}"/>
1034 <fileset dir="${build.dir}">
1035 <include name="${final.name}.jar" />
1036 <include name="${ant.project.name}-thrift-${version}.jar" />
1037 </fileset>
1038 </copy>
1039 <copy todir="${dist.dir}/javadoc">
1040 <fileset dir="${javadoc.dir}"/>
1041 </copy>
1042 <copy todir="${dist.dir}/doc">
1043 <fileset dir="doc">
1044 <include name="cql3/CQL.html" />
1045 <include name="cql3/CQL.css" />
1046 <include name="SASI.md" />
1047 </fileset>
1048 </copy>
1049 <copy todir="${dist.dir}/doc/html">
1050 <fileset dir="doc" />
1051 <globmapper from="build/html/*" to="*"/>
1052 </copy>
1053 <copy todir="${dist.dir}/bin">
1054 <fileset dir="bin"/>
1055 </copy>
1056 <copy todir="${dist.dir}/conf">
1057 <fileset dir="conf"/>
1058 </copy>
1059 <copy todir="${dist.dir}/interface">
1060 <fileset dir="interface">
1061 <include name="**/*.thrift" />
1062 </fileset>
1063 </copy>
1064 <copy todir="${dist.dir}/pylib">
1065 <fileset dir="pylib">
1066 <include name="**" />
1067 <exclude name="**/*.pyc" />
1068 </fileset>
1069 </copy>
1070 <copy todir="${dist.dir}/">
1071 <fileset dir="${basedir}">
1072 <include name="*.txt" />
1073 </fileset>
1074 </copy>
1075 <copy todir="${dist.dir}/tools/bin">
1076 <fileset dir="${basedir}/tools/bin"/>
1077 </copy>
1078 <copy todir="${dist.dir}/tools/">
1079 <fileset dir="${basedir}/tools/">
1080 <include name="*.yaml"/>
1081 </fileset>
1082 </copy>
1083 <copy todir="${dist.dir}/tools/lib">
1084 <fileset dir="${build.dir}/tools/lib/">
1085 <include name="*.jar" />
1086 </fileset>
1087 </copy>
1088 <artifact:writepom pomRefId="dist-pom"
1089 file="${build.dir}/${final.name}-dist.pom"/>
1090 <tar compression="gzip" longfile="gnu"
1091 destfile="${build.dir}/${final.name}-bin.tar.gz">
1092
1093 <!-- Everything but bin/ (default mode) -->
1094 <tarfileset dir="${dist.dir}" prefix="${final.name}">
1095 <include name="**"/>
1096 <exclude name="bin/*" />
1097 </tarfileset>
1098 <!-- Shell includes in bin/ (default mode) -->
1099 <tarfileset dir="${dist.dir}" prefix="${final.name}">
1100 <include name="bin/*.in.sh" />
1101 </tarfileset>
1102 <!-- Executable scripts in bin/ -->
1103 <tarfileset dir="${dist.dir}" prefix="${final.name}" mode="755">
1104 <include name="bin/*"/>
1105 <include name="tools/bin/*"/>
1106 <not>
1107 <filename name="bin/*.in.sh" />
1108 </not>
1109 </tarfileset>
1110 </tar>
1111
1112 <tar compression="gzip" longfile="gnu"
1113 destfile="${build.dir}/${final.name}-src.tar.gz">
1114
1115 <tarfileset dir="${basedir}"
1116 prefix="${final.name}-src">
1117 <include name="**"/>
1118 <exclude name="build/**" />
1119 <exclude name="src/gen-java/**" />
1120 <exclude name=".git/**" />
1121 <exclude name="bin/*" /> <!-- handled separately below -->
1122 <!-- exclude Eclipse files -->
1123 <exclude name=".project" />
1124 <exclude name=".classpath" />
1125 <exclude name=".settings/**" />
1126 <exclude name=".externalToolBuilders/**" />
1127 </tarfileset>
1128
1129 <!-- Shell includes and batch files in bin/ -->
1130 <tarfileset dir="${basedir}" prefix="${final.name}-src">
1131 <include name="bin/*.in.sh" />
1132 <include name="bin/*.bat" />
1133 </tarfileset>
1134 <!-- Everything else (assumed to be scripts), is executable -->
1135 <tarfileset dir="${basedir}" prefix="${final.name}-src" mode="755">
1136 <include name="bin/*"/>
1137 <exclude name="bin/*.in.sh" />
1138 <exclude name="bin/*.bat" />
1139 </tarfileset>
1140 </tar>
1141 </target>
1142
1143 <target name="release" depends="eclipse-warnings,artifacts,rat-init"
1144 description="Create and QC release artifacts">
1145 <checksum forceOverwrite="yes" todir="${build.dir}" fileext=".md5"
1146 algorithm="MD5">
1147 <fileset dir="${build.dir}">
1148 <include name="*.tar.gz" />
1149 </fileset>
1150 </checksum>
1151 <checksum forceOverwrite="yes" todir="${build.dir}" fileext=".sha"
1152 algorithm="SHA">
1153 <fileset dir="${build.dir}">
1154 <include name="*.tar.gz" />
1155 </fileset>
1156 </checksum>
1157
1158 <rat:report xmlns:rat="antlib:org.apache.rat.anttasks"
1159 reportFile="${build.dir}/${final.name}-bin.rat.txt">
1160 <tarfileset>
1161 <gzipresource>
1162 <file file="${build.dir}/${final.name}-bin.tar.gz" />
1163 </gzipresource>
1164 </tarfileset>
1165 </rat:report>
1166
1167 <rat:report xmlns:rat="antlib:org.apache.rat.anttasks"
1168 reportFile="${build.dir}/${final.name}-src.rat.txt">
1169 <tarfileset>
1170 <gzipresource>
1171 <file file="${build.dir}/${final.name}-src.tar.gz" />
1172 </gzipresource>
1173 </tarfileset>
1174 </rat:report>
1175 </target>
1176
1177 <target name="build-jmh" depends="build-test" description="Create JMH uber jar">
1178 <jar jarfile="${build.test.dir}/deps.jar">
1179 <zipgroupfileset dir="${build.dir.lib}/jars">
1180 <include name="*jmh*.jar"/>
1181 <include name="jopt*.jar"/>
1182 <include name="commons*.jar"/>
1183 </zipgroupfileset>
1184 <zipgroupfileset dir="${build.lib}" includes="*.jar"/>
1185 </jar>
1186 <jar jarfile="${build.test.dir}/benchmarks.jar">
1187 <manifest>
1188 <attribute name="Main-Class" value="org.openjdk.jmh.Main"/>
1189 </manifest>
1190 <zipfileset src="${build.test.dir}/deps.jar" excludes="META-INF/*.SF" />
1191 <fileset dir="${build.classes.main}"/>
1192 <fileset dir="${test.classes}"/>
1193 </jar>
1194 </target>
1195
1196 <!-- use https://github.com/krummas/jstackjunit to get thread dumps when unit tests time out -->
1197 <taskdef name="junit" classname="org.krummas.junit.JStackJUnitTask" classpath="lib/jstackjunit-0.0.1.jar"/>
1198
1199 <target name="build-test" depends="build" description="Compile test classes">
1200 <javac
1201 compiler="modern"
1202 debug="true"
1203 debuglevel="${debuglevel}"
1204 destdir="${test.classes}"
1205 includeantruntime="true"
1206 source="${source.version}"
1207 target="${target.version}"
1208 encoding="utf-8">
1209 <classpath>
1210 <path refid="cassandra.classpath"/>
1211 </classpath>
1212 <compilerarg value="-XDignore.symbol.file"/>
1213 <src path="${test.unit.src}"/>
1214 <src path="${test.long.src}"/>
1215 <src path="${test.burn.src}"/>
1216 <src path="${test.microbench.src}"/>
1217 </javac>
1218
1219 <!-- Non-java resources needed by the test suite -->
1220 <copy todir="${test.classes}">
1221 <fileset dir="${test.resources}"/>
1222 </copy>
1223 </target>
1224
1225 <!-- Defines how to run a set of tests. If you change the defaults for attributes
1226 you should also update them in testmacro.,
1227 The two are split because the helper doesn't generate
1228 a junit report or fail on errors, since this is called in parallel to run tests
1229 when we choose to run tests in parallel -->
1230 <macrodef name="testmacrohelper">
1231 <attribute name="inputdir" />
1232 <attribute name="timeout" default="${test.timeout}" />
1233 <attribute name="forkmode" default="perTest"/>
1234 <element name="optjvmargs" implicit="true" optional="true" />
1235 <attribute name="filter" default="**/${test.name}.java"/>
1236 <attribute name="exclude" default="" />
1237 <attribute name="filelist" default="" />
1238 <attribute name="poffset" default="0"/>
1239 <attribute name="testtag" default=""/>
1240 <attribute name="usejacoco" default="no"/>
1241
1242 <sequential>
1243 <condition property="additionalagent"
1244 value="-javaagent:${build.dir.lib}/jars/jacocoagent.jar=destfile=${jacoco.partialexecfile}"
1245 else="">
1246 <istrue value="${usejacoco}"/>
1247 </condition>
1248 <mkdir dir="${build.test.dir}/cassandra"/>
1249 <mkdir dir="${build.test.dir}/output"/>
1250 <mkdir dir="${build.test.dir}/output/@{testtag}"/>
1251 <junit fork="on" forkmode="@{forkmode}" failureproperty="testfailed" maxmemory="1024m" timeout="@{timeout}">
1252 <formatter classname="org.apache.cassandra.CassandraXMLJUnitResultFormatter" extension=".xml" usefile="true"/>
1253 <formatter classname="org.apache.cassandra.CassandraBriefJUnitResultFormatter" usefile="false"/>
1254 <jvmarg value="-Dstorage-config=${test.conf}"/>
1255 <jvmarg value="-Djava.awt.headless=true"/>
1256 <!-- Cassandra 3.0+ needs <jvmarg line="... ${additionalagent}" /> here! (not value=) -->
1257 <jvmarg line="-javaagent:${basedir}/lib/jamm-0.3.0.jar ${additionalagent}" />
1258 <jvmarg value="-ea"/>
1259 <jvmarg value="-Dcassandra.debugrefcount=true"/>
1260 <jvmarg value="-Xss256k"/>
1261 <jvmarg value="-Dcassandra.memtable_row_overhead_computation_step=100"/>
1262 <jvmarg value="-Dcassandra.test.use_prepared=${cassandra.test.use_prepared}"/>
1263 <jvmarg value="-Dcassandra.test.offsetseed=@{poffset}"/>
1264 <jvmarg value="-Dcassandra.test.sstableformatdevelopment=true"/>
1265 <!-- The first time SecureRandom initializes can be slow if it blocks on /dev/random -->
1266 <jvmarg value="-Djava.security.egd=file:/dev/urandom" />
1267 <jvmarg value="-Dcassandra.testtag=@{testtag}"/>
1268 <jvmarg value="-Dcassandra.keepBriefBrief=${cassandra.keepBriefBrief}" />
1269 <optjvmargs/>
1270 <classpath>
1271 <pathelement path="${java.class.path}"/>
1272 <pathelement location="${stress.build.classes}"/>
1273 <path refid="cassandra.classpath" />
1274 <pathelement location="${test.classes}"/>
1275 <pathelement location="${stress.test.classes}"/>
1276 <pathelement location="${test.conf}"/>
1277 <fileset dir="${test.lib}">
1278 <include name="**/*.jar" />
1279 </fileset>
1280 </classpath>
1281 <batchtest todir="${build.test.dir}/output/@{testtag}">
1282 <fileset dir="@{inputdir}" includes="@{filter}" excludes="@{exclude}"/>
1283 <filelist dir="@{inputdir}" files="@{filelist}"/>
1284 </batchtest>
1285 </junit>
1286
1287 <condition property="fileSep" value=";">
1288 <os family="windows"/>
1289 </condition>
1290 <condition property="fileSep" else=":">
1291 <isset property="fileSep"/>
1292 </condition>
1293 <fail unless="fileSep">Failed to set File Separator. This shouldn't happen.</fail>
1294
1295 <delete quiet="true" failonerror="false" dir="${build.test.dir}/cassandra/commitlog${fileSep}@{poffset}"/>
1296 <delete quiet="true" failonerror="false" dir="${build.test.dir}/cassandra/cdc_raw${fileSep}@{poffset}"/>
1297 <delete quiet="true" failonerror="false" dir="${build.test.dir}/cassandra/data${fileSep}@{poffset}"/>
1298 <delete quiet="true" failonerror="false" dir="${build.test.dir}/cassandra/saved_caches${fileSep}@{poffset}"/>
1299 <delete quiet="true" failonerror="false" dir="${build.test.dir}/cassandra/hints${fileSep}@{poffset}"/>
1300 </sequential>
1301 </macrodef>
1302
1303 <target name="testold" depends="build-test" description="Execute unit tests">
1304 <testmacro inputdir="${test.unit.src}" timeout="${test.timeout}">
1305 <jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
1306 <jvmarg value="-Dinvalid-legacy-sstable-root=${test.data}/invalid-legacy-sstables"/>
1307 <jvmarg value="-Dmigration-sstable-root=${test.data}/migration-sstables"/>
1308 <jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
1309 <jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1310 <jvmarg value="-Djava.io.tmpdir=${tmp.dir}"/>
1311 <jvmarg value="-Dcassandra.skip_sync=true" />
1312 </testmacro>
1313 <fileset dir="${test.unit.src}" />
1314 </target>
1315
1316 <!-- Will not generate a junit report or fail on error since it is called in parallel for test-compression
1317 That is taken care of by testparallel -->
1318 <macrodef name="testlist">
1319 <attribute name="test.file.list"/>
1320 <attribute name="testlist.offset"/>
1321 <sequential>
1322 <testmacrohelper inputdir="${test.unit.src}" filelist="@{test.file.list}" poffset="@{testlist.offset}" exclude="**/*.java" timeout="${test.timeout}">
1323 <jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
1324 <jvmarg value="-Dinvalid-legacy-sstable-root=${test.data}/invalid-legacy-sstables"/>
1325 <jvmarg value="-Dmigration-sstable-root=${test.data}/migration-sstables"/>
1326 <jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
1327 <jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1328 <jvmarg value="-Dcassandra.config.loader=org.apache.cassandra.OffsetAwareConfigurationLoader"/>
1329 <jvmarg value="-Dcassandra.skip_sync=true" />
1330 </testmacrohelper>
1331 </sequential>
1332 </macrodef>
1333
1334 <!-- Will not generate a junit report or fail on error since it is called in parallel for test-compression
1335 That is taken care of by testparallel -->
1336 <macrodef name="testlist-compression">
1337 <attribute name="test.file.list" />
1338 <attribute name="testlist.offset" />
1339 <sequential>
1340 <property name="compressed_yaml" value="${build.test.dir}/cassandra.compressed.yaml"/>
1341 <testmacrohelper inputdir="${test.unit.src}" filelist="@{test.file.list}" poffset="@{testlist.offset}"
1342 exclude="**/*.java" timeout="${test.timeout}" testtag="compression">
1343 <jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
1344 <jvmarg value="-Dinvalid-legacy-sstable-root=${test.data}/invalid-legacy-sstables"/>
1345 <jvmarg value="-Dmigration-sstable-root=${test.data}/migration-sstables"/>
1346 <jvmarg value="-Dcassandra.test.compression=true"/>
1347 <jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
1348 <jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1349 <jvmarg value="-Dcassandra.config=file:///${compressed_yaml}"/>
1350 <jvmarg value="-Dcassandra.skip_sync=true" />
1351 <jvmarg value="-Dcassandra.config.loader=org.apache.cassandra.OffsetAwareConfigurationLoader"/>
1352 </testmacrohelper>
1353 </sequential>
1354 </macrodef>
1355
1356 <macrodef name="testlist-cdc">
1357 <attribute name="test.file.list" />
1358 <attribute name="testlist.offset" />
1359 <sequential>
1360 <property name="cdc_yaml" value="${build.test.dir}/cassandra.cdc.yaml"/>
1361 <testmacrohelper inputdir="${test.unit.src}" filelist="@{test.file.list}" poffset="@{testlist.offset}"
1362 exclude="**/*.java" timeout="${test.timeout}" testtag="cdc">
1363 <jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
1364 <jvmarg value="-Dinvalid-legacy-sstable-root=${test.data}/invalid-legacy-sstables"/>
1365 <jvmarg value="-Dmigration-sstable-root=${test.data}/migration-sstables"/>
1366 <jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
1367 <jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1368 <jvmarg value="-Dcassandra.config=file:///${cdc_yaml}"/>
1369 <jvmarg value="-Dcassandra.skip_sync=true" />
1370 <jvmarg value="-Dcassandra.config.loader=org.apache.cassandra.OffsetAwareConfigurationLoader"/>
1371 </testmacrohelper>
1372 </sequential>
1373 </macrodef>
1374
1375 <!--
1376 Run named ant task with jacoco, such as "ant jacoco-run -Dtaskname=test"
1377 the target run must enable the jacoco agent if usejacoco is 'yes' -->
1378 <target name="jacoco-run" description="run named task with jacoco instrumentation">
1379 <condition property="runtask" value="${taskname}" else="test">
1380 <isset property="taskname"/>
1381 </condition>
1382 <antcall target="${runtask}">
1383 <param name="usejacoco" value="yes"/>
1384 </antcall>
1385 </target>
1386
1387 <!-- Use this with an FQDN for test class, and a csv list of methods like this:
1388 ant testsome -Dtest.name=org.apache.cassandra.service.StorageServiceServerTest -Dtest.methods=testRegularMode,testGetAllRangesEmpty
1389 -->
1390 <target name="testsome" depends="build-test" description="Execute specific unit tests" >
1391 <testmacro inputdir="${test.unit.src}" timeout="${test.timeout}">
1392 <test name="${test.name}" methods="${test.methods}"/>
1393 <jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
1394 <jvmarg value="-Dinvalid-legacy-sstable-root=${test.data}/invalid-legacy-sstables"/>
1395 <jvmarg value="-Dmigration-sstable-root=${test.data}/migration-sstables"/>
1396 <jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
1397 <jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1398 <jvmarg value="-Dcassandra.skip_sync=true" />
1399 </testmacro>
1400 </target>
1401
1402 <target name="test-compression" depends="build-test,stress-build" description="Execute unit tests with sstable compression enabled">
1403 <property name="compressed_yaml" value="${build.test.dir}/cassandra.compressed.yaml"/>
1404 <concat destfile="${compressed_yaml}">
1405 <fileset file="${test.conf}/cassandra.yaml"/>
1406 <fileset file="${test.conf}/commitlog_compression.yaml"/>
1407 </concat>
1408 <path id="all-test-classes-path">
1409 <fileset dir="${test.unit.src}" includes="**/${test.name}.java" />
1410 </path>
1411 <property name="all-test-classes" refid="all-test-classes-path"/>
1412 <testparallel testdelegate="testlist-compression" />
1413 </target>
1414
1415 <target name="test-cdc" depends="build-test" description="Execute unit tests with change-data-capture enabled">
1416 <property name="cdc_yaml" value="${build.test.dir}/cassandra.cdc.yaml"/>
1417 <concat destfile="${cdc_yaml}">
1418 <fileset file="${test.conf}/cassandra.yaml"/>
1419 <fileset file="${test.conf}/cdc.yaml"/>
1420 </concat>
1421 <path id="all-test-classes-path">
1422 <fileset dir="${test.unit.src}" includes="**/${test.name}.java" />
1423 </path>
1424 <property name="all-test-classes" refid="all-test-classes-path"/>
1425 <testparallel testdelegate="testlist-cdc" />
1426 </target>
1427
1428 <target name="msg-ser-gen-test" depends="build-test" description="Generates message serializations">
1429 <testmacro inputdir="${test.unit.src}"
1430 timeout="${test.timeout}" filter="**/SerializationsTest.java">
1431 <jvmarg value="-Dcassandra.test-serialization-writes=True"/>
1432 </testmacro>
1433 </target>
1434
1435 <target name="msg-ser-test" depends="build-test" description="Tests message serializations">
1436 <testmacro inputdir="${test.unit.src}" timeout="${test.timeout}"
1437 filter="**/SerializationsTest.java"/>
1438 </target>
1439
1440 <target name="msg-ser-test-7" depends="build-test" description="Generates message serializations">
1441 <testmacro inputdir="${test.unit.src}"
1442 timeout="${test.timeout}" filter="**/SerializationsTest.java">
1443 <jvmarg value="-Dcassandra.version=0.7"/>
1444 </testmacro>
1445 </target>
1446
1447 <target name="msg-ser-test-10" depends="build-test" description="Tests message serializations on 1.0 messages">
1448 <testmacro inputdir="${test.unit.src}"
1449 timeout="${test.timeout}" filter="**/SerializationsTest.java">
1450 <jvmarg value="-Dcassandra.version=1.0"/>
1451 </testmacro>
1452 </target>
1453
1454 <target name="test-burn" depends="build-test" description="Execute functional tests">
1455 <testmacro inputdir="${test.burn.src}"
1456 timeout="${test.burn.timeout}">
1457 </testmacro>
1458 </target>
1459
1460 <target name="long-test" depends="build-test" description="Execute functional tests">
1461 <testmacro inputdir="${test.long.src}"
1462 timeout="${test.long.timeout}">
1463 <jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
1464 <jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1465 </testmacro>
1466 </target>
1467
1468 <target name="cql-test" depends="build-test" description="Execute CQL tests">
1469 <sequential>
1470 <echo message="running CQL tests"/>
1471 <mkdir dir="${build.test.dir}/cassandra"/>
1472 <mkdir dir="${build.test.dir}/output"/>
1473 <junit fork="on" forkmode="once" failureproperty="testfailed" maxmemory="1024m" timeout="${test.timeout}">
1474 <formatter type="brief" usefile="false"/>
1475 <jvmarg value="-Dstorage-config=${test.conf}"/>
1476 <jvmarg value="-Djava.awt.headless=true"/>
1477 <jvmarg value="-javaagent:${basedir}/lib/jamm-0.3.0.jar" />
1478 <jvmarg value="-ea"/>
1479 <jvmarg value="-Xss256k"/>
1480 <jvmarg value="-Dcassandra.memtable_row_overhead_computation_step=100"/>
1481 <jvmarg value="-Dcassandra.test.use_prepared=${cassandra.test.use_prepared}"/>
1482 <jvmarg value="-Dcassandra.skip_sync=true" />
1483 <classpath>
1484 <path refid="cassandra.classpath" />
1485 <pathelement location="${test.classes}"/>
1486 <pathelement location="${test.conf}"/>
1487 <fileset dir="${test.lib}">
1488 <include name="**/*.jar" />
1489 </fileset>
1490 </classpath>
1491 <batchtest todir="${build.test.dir}/output">
1492 <fileset dir="${test.unit.src}" includes="**/cql3/*Test.java">
1493 <contains text="CQLTester" casesensitive="yes"/>
1494 </fileset>
1495 </batchtest>
1496 </junit>
1497 <fail message="Some CQL test(s) failed.">
1498 <condition>
1499 <and>
1500 <isset property="testfailed"/>
1501 <not>
1502 <isset property="ant.test.failure.ignore"/>
1503 </not>
1504 </and>
1505 </condition>
1506 </fail>
1507 </sequential>
1508 </target>
1509
1510 <target name="cql-test-some" depends="build-test" description="Execute specific CQL tests" >
1511 <sequential>
1512 <echo message="running ${test.methods} tests from ${test.name}"/>
1513 <mkdir dir="${build.test.dir}/cassandra"/>
1514 <mkdir dir="${build.test.dir}/output"/>
1515 <junit fork="on" forkmode="once" failureproperty="testfailed" maxmemory="1024m" timeout="${test.timeout}">
1516 <formatter type="brief" usefile="false"/>
1517 <jvmarg value="-Dstorage-config=${test.conf}"/>
1518 <jvmarg value="-Djava.awt.headless=true"/>
1519 <jvmarg value="-javaagent:${basedir}/lib/jamm-0.3.0.jar" />
1520 <jvmarg value="-ea"/>
1521 <jvmarg value="-Xss256k"/>
1522 <jvmarg value="-Dcassandra.test.use_prepared=${cassandra.test.use_prepared}"/>
1523 <jvmarg value="-Dcassandra.memtable_row_overhead_computation_step=100"/>
1524 <jvmarg value="-Dcassandra.skip_sync=true" />
1525 <classpath>
1526 <path refid="cassandra.classpath" />
1527 <pathelement location="${test.classes}"/>
1528 <pathelement location="${test.conf}"/>
1529 <fileset dir="${test.lib}">
1530 <include name="**/*.jar" />
1531 </fileset>
1532 </classpath>
1533 <test name="org.apache.cassandra.cql3.${test.name}" methods="${test.methods}" todir="${build.test.dir}/output"/>
1534 </junit>
1535 </sequential>
1536 </target>
1537
1538 <target name="test-all"
1539 depends="eclipse-warnings,test,long-test,test-compression,stress-test"
1540 description="Run all tests except for those under test-burn" />
1541
1542 <!-- Use JaCoCo ant extension without needing externally saved lib -->
1543 <target name="jacoco-init" depends="maven-ant-tasks-init">
1544 <artifact:dependencies pathId="jacocoant.classpath">
1545 <dependency groupId="org.jacoco" artifactId="org.jacoco.ant" version="${jacoco.version}" />
1546 </artifact:dependencies>
1547 <typedef uri="antlib:org.jacoco.ant" classpathref="jacocoant.classpath"/>
1548 </target>
1549
1550 <target name="jacoco-merge" depends="jacoco-init">
1551 <jacoco:merge destfile="${jacoco.finalexecfile}" xmlns:jacoco="antlib:org.jacoco.ant">
1552 <fileset dir="${jacoco.export.dir}" includes="*.exec,**/*.exec"/>
1553 </jacoco:merge>
1554 </target>
1555
1556 <target name="jacoco-report" depends="jacoco-merge">
1557 <jacoco:report xmlns:jacoco="antlib:org.jacoco.ant">
1558 <executiondata>
1559 <file file="${jacoco.finalexecfile}" />
1560 </executiondata>
1561 <structure name="JaCoCo Cassandara Coverage Report">
1562 <classfiles>
1563 <fileset dir="${build.classes.main}">
1564 <include name="**/*.class"/>
1565 </fileset>
1566 </classfiles>
1567 <sourcefiles encoding="UTF-8">
1568 <dirset dir="${build.src}">
1569 <include name="java"/>
1570 <include name="gen-java"/>
1571 </dirset>
1572 </sourcefiles>
1573 </structure>
1574 <!-- to produce reports in different formats. -->
1575 <html destdir="${jacoco.export.dir}" />
1576 <csv destfile="${jacoco.export.dir}/report.csv" />
1577 <xml destfile="${jacoco.export.dir}/report.xml" />
1578 </jacoco:report>
1579 </target>
1580
1581 <target name="jacoco-cleanup" description="Destroy JaCoCo exec data and reports">
1582 <delete file="${jacoco.partialexecfile}"/>
1583 <delete dir="${jacoco.export.dir}"/>
1584 </target>
1585
1586 <!--
1587 License audit tool
1588 -->
1589 <target name="rat-init" depends="maven-ant-tasks-init">
1590 <artifact:dependencies pathId="rat.classpath">
1591 <dependency groupId="org.apache.rat" artifactId="apache-rat-tasks" version="0.6" />
1592 </artifact:dependencies>
1593 <typedef uri="antlib:org.apache.rat.anttasks" classpathref="rat.classpath"/>
1594 </target>
1595
1596 <target name="rat-check" depends="rat-init">
1597 <rat:report xmlns:rat="antlib:org.apache.rat.anttasks"
1598 reportFile="${build.dir}/rat-report.log">
1599 <fileset dir="." excludesfile=".rat-excludes" />
1600 </rat:report>
1601 <condition property="rat.passed">
1602 <isfileselected file="${build.dir}/rat-report.log">
1603 <containsregexp expression="^0 Unknown Licenses"/>
1604 </isfileselected>
1605 </condition>
1606 <fail unless="rat.passed">Unknown licenses: See build/rat-report.log.</fail>
1607 </target>
1608
1609 <target name="rat-write" depends="rat-init">
1610 <echo>RAT: invoking addLicense to write missing headers</echo>
1611 <java classname="org.apache.rat.Report" fork="true"
1612 output="${build.dir}/rat-report.log">
1613 <classpath refid="rat.classpath" />
1614 <arg value="-a" />
1615 <arg value="--force" />
1616 <arg value="." />
1617 </java>
1618 </target>
1619
1620 <target name="javadoc" depends="init" description="Create javadoc" unless="no-javadoc">
1621 <create-javadoc destdir="${javadoc.dir}">
1622 <filesets>
1623 <fileset dir="${build.src.java}" defaultexcludes="yes">
1624 <include name="org/apache/**/*.java"/>
1625 </fileset>
1626 <fileset dir="${interface.thrift.gen-java}" defaultexcludes="yes">
1627 <include name="org/apache/**/*.java"/>
1628 </fileset>
1629 </filesets>
1630 </create-javadoc>
1631 </target>
1632
1633 <!-- Run tests not in parallel and reports errors and generates a junit report after -->
1634 <macrodef name="testmacro">
1635 <attribute name="inputdir" />
1636 <attribute name="timeout" default="${test.timeout}" />
1637 <attribute name="forkmode" default="perTest"/>
1638 <element name="optjvmargs" implicit="true" optional="true" />
1639 <attribute name="filter" default="**/${test.name}.java"/>
1640 <attribute name="exclude" default="" />
1641 <attribute name="filelist" default="" />
1642 <attribute name="poffset" default="0"/>
1643 <attribute name="testtag" default=""/>
1644
1645 <sequential>
1646 <testmacrohelper inputdir="@{inputdir}" timeout="@{timeout}"
1647 forkmode="@{forkmode}" filter="@{filter}"
1648 exclude="@{exclude}" filelist="@{filelist}" poffset="@{poffset}"
1649 testtag="@{testtag}" >
1650 <optjvmargs/>
1651 </testmacrohelper>
1652 <junitreport todir="${build.test.dir}">
1653 <fileset dir="${build.test.dir}/output">
1654 <include name="**/TEST-*.xml"/>
1655 </fileset>
1656 <report format="frames" todir="${build.test.dir}/junitreport"/>
1657 </junitreport>
1658 <fail message="Some test(s) failed.">
1659 <condition>
1660 <and>
1661 <isset property="testfailed"/>
1662 <not>
1663 <isset property="ant.test.failure.ignore"/>
1664 </not>
1665 </and>
1666 </condition>
1667 </fail>
1668 </sequential>
1669 </macrodef>
1670
1671 <!-- Run tests in parallel and report errors after and generate a junit report -->
1672 <macrodef name="testparallel">
1673 <attribute name="testdelegate"/>
1674 <sequential>
1675 <testparallelhelper testdelegate="@{testdelegate}"/>
1676 <junitreport todir="${build.test.dir}">
1677 <fileset dir="${build.test.dir}/output">
1678 <include name="**/TEST-*.xml"/>
1679 </fileset>
1680 <report format="frames" todir="${build.test.dir}/junitreport"/>
1681 </junitreport>
1682 <fail message="Some test(s) failed.">
1683 <condition>
1684 <and>
1685 <isset property="testfailed"/>
1686 <not>
1687 <isset property="ant.test.failure.ignore"/>
1688 </not>
1689 </and>
1690 </condition>
1691 </fail>
1692 </sequential>
1693 </macrodef>
1694
1695 <!-- Run multiple junit tasks in parallel, but don't track errors or generate a report after
1696 If a test fails the testfailed property will be set. All the tests are run using te testdelegate
1697 macro that is specified as an attribute and they will be run concurrently in this ant process -->
1698 <scriptdef name="testparallelhelper" language="javascript">
1699 <attribute name="testdelegate"/>
1700 <![CDATA[
1701 sep = project.getProperty("path.separator");
1702 all = project.getProperty("all-test-classes").split(sep);
1703 runners = project.getProperty("test.runners")
1704 cores = project.getProperty("cores.count")
1705 mem = project.getProperty("mem.size")
1706
1707 numRunners = 1
1708 if (runners != null) // there's test.runners override
1709 numRunners = parseInt(runners) || 1;
1710 else if (cores != null && mem != null) // only if cores and memory size is set
1711 numRunners = Math.min(Math.floor(Math.sqrt(parseInt(cores) || 1)),
1712 Math.floor((parseInt(mem) || 1)/(4*1024*1024*1024)));
1713
1714 if (numRunners < 1)
1715 numRunners = 1
1716
1717 var echo = project.createTask("echo");
1718 echo.setMessage("Number of test runners: " + numRunners);
1719 echo.perform();
1720
1721 var p = project.createTask('parallel');
1722 p.setThreadCount(numRunners);
1723
1724 for (i = 0; i < all.length; i++) {
1725
1726 if (all[i] == undefined) continue;
1727
1728 task = project.createTask( attributes.get("testdelegate") );
1729
1730 task.setDynamicAttribute( "test.file.list", "" + all[i]);
1731
1732 task.setDynamicAttribute( "testlist.offset", "" + i );
1733
1734 p.addTask(task);
1735 }
1736
1737 p.perform();
1738 ]]>
1739 </scriptdef>
1740
1741 <target name="get-cores">
1742 <property environment="env"/>
1743 <!-- support for Windows -->
1744 <condition property="cores.count" value="${env.NUMBER_OF_PROCESSORS}">
1745 <os family="windows" />
1746 </condition>
1747 <!-- support for Linux and Solaris (package SUNWgnu-coreutils is required) -->
1748 <exec executable="nproc" outputproperty="cores.count" os="Linux,SunOS,Solaris" failifexecutionfails="false">
1749 <arg value="--all"/>
1750 </exec>
1751 <!-- support for Mac OS X -->
1752 <exec executable="sysctl" outputproperty="cores.count" os="Mac,Mac OS X,Darwin" failifexecutionfails="false">
1753 <arg value="-n"/>
1754 <arg value="hw.ncpu"/>
1755 </exec>
1756 <echo message="Number of cores: ${cores.count}"/>
1757 </target>
1758
1759 <target name="get-mem">
1760 <condition property="mem.size" value="unknown">
1761 <os family="windows" />
1762 </condition>
1763 <!-- support for Linux and Solaris (package SUNWgnu-coreutils is required) -->
1764 <exec executable="bash" outputproperty="mem.size" os="Linux,SunOS,Solaris" failifexecutionfails="false">
1765 <arg value="-c"/>
1766 <arg value="free -b | grep Mem: | awk '{print $2}'"/>
1767 </exec>
1768 <!-- support for Mac OS X -->
1769 <exec executable="sysctl" outputproperty="mem.size" os="Mac,Mac OS X,Darwin" failifexecutionfails="false">
1770 <arg value="-n"/>
1771 <arg value="hw.memsize"/>
1772 </exec>
1773 <echo message="Mem size : ${mem.size}"/>
1774 </target>
1775
1776 <target name="test" depends="build-test,get-cores,get-mem,stress-build" description="Parallel Test Runner">
1777 <path id="all-test-classes-path">
1778 <fileset dir="${test.unit.src}" includes="**/${test.name}.java" />
1779 </path>
1780 <property name="all-test-classes" refid="all-test-classes-path"/>
1781 <testparallel testdelegate="testlist"/>
1782 </target>
1783
1784 <!-- run a list of tests as provided in -Dtest.classlistfile (or default of 'testnames.txt')
1785 The class list file should be one test class per line, with the path starting after test/unit
1786 e.g. org/apache/cassandra/hints/HintMessageTest.java -->
1787 <target name="testclasslist" depends="build-test" description="Parallel-run tests given in file -Dtest.classlistfile (one-class-per-line, e.g. org/apache/cassandra/db/SomeTest.java)">
1788 <path id="all-test-classes-path">
1789 <fileset dir="${test.unit.src}" includesfile="${test.classlistfile}"/>
1790 </path>
1791 <property name="all-test-classes" refid="all-test-classes-path"/>
1792 <testparallel testdelegate="testlist"/>
1793 </target>
1794
1795 <!-- run microbenchmarks suite -->
1796 <target name="microbench" depends="build-jmh">
1797 <java classname="org.openjdk.jmh.Main"
1798 fork="true"
1799 failonerror="true">
1800 <classpath>
1801 <path refid="cassandra.classpath" />
1802 <pathelement location="${test.classes}"/>
1803 <pathelement location="${test.conf}"/>
1804 <fileset dir="${test.lib}">
1805 <include name="**/*.jar" />
1806 </fileset>
1807 </classpath>
1808 <arg value=".*microbench.*${benchmark.name}"/>
1809 </java>
1810 </target>
1811
1812 <!-- Generate IDEA project description files -->
1813 <target name="generate-idea-files" depends="build-test" description="Generate IDEA files">
1814 <mkdir dir=".idea"/>
1815 <mkdir dir=".idea/libraries"/>
1816 <copy todir=".idea">
1817 <fileset dir="ide/idea"/>
1818 </copy>
1819 <copy tofile="${eclipse.project.name}.iml" file="ide/idea-iml-file.xml"/>
1820 <echo file=".idea/.name">Apache Cassandra ${eclipse.project.name}</echo>
1821 <echo file=".idea/modules.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
1822 <project version="4">
1823 <component name="ProjectModuleManager">
1824 <modules>
1825 <module fileurl="file://$PROJECT_DIR$/]]>${eclipse.project.name}<![CDATA[.iml" filepath="$PROJECT_DIR$/]]>${eclipse.project.name}<![CDATA[.iml" />
1826 </modules>
1827 </component>
1828 </project>]]></echo>
1829 </target>
1830
1831 <!-- Generate Eclipse project description files -->
1832 <target name="generate-eclipse-files" depends="build-test" description="Generate eclipse files">
1833 <echo file=".project"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
1834 <projectDescription>
1835 <name>${eclipse.project.name}</name>
1836 <comment></comment>
1837 <projects>
1838 </projects>
1839 <buildSpec>
1840 <buildCommand>
1841 <name>org.eclipse.jdt.core.javabuilder</name>
1842 </buildCommand>
1843 </buildSpec>
1844 <natures>
1845 <nature>org.eclipse.jdt.core.javanature</nature>
1846 </natures>
1847 </projectDescription>]]>
1848 </echo>
1849 <echo file=".classpath"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
1850 <classpath>
1851 <classpathentry kind="src" path="src/java"/>
1852 <classpathentry kind="src" path="src/resources"/>
1853 <classpathentry kind="src" path="src/gen-java"/>
1854 <classpathentry kind="src" path="conf" including="hotspot_compiler"/>
1855 <classpathentry kind="src" path="interface/thrift/gen-java"/>
1856 <classpathentry kind="src" output="build/test/classes" path="test/unit"/>
1857 <classpathentry kind="src" output="build/test/classes" path="test/long"/>
1858 <classpathentry kind="src" output="build/test/classes" path="test/resources" />
1859 <classpathentry kind="src" path="tools/stress/src"/>
1860 <classpathentry kind="src" output="build/test/stress-classes" path="tools/stress/test/unit" />
1861 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
1862 <classpathentry kind="output" path="build/classes/eclipse"/>
1863 <classpathentry kind="lib" path="build/classes/thrift" sourcepath="interface/thrift/gen-java/"/>
1864 <classpathentry kind="lib" path="test/conf"/>
1865 <classpathentry kind="lib" path="${java.home}/../lib/tools.jar"/>
1866 ]]>
1867 </echo>
1868 <path id="eclipse-project-libs-path">
1869 <fileset dir="lib">
1870 <include name="**/*.jar" />
1871 </fileset>
1872 <fileset dir="build/lib/jars">
1873 <include name="**/*.jar" />
1874 </fileset>
1875 </path>
1876 <property name="eclipse-project-libs" refid="eclipse-project-libs-path"/>
1877 <script language="javascript" classpathref="cassandra.classpath"> <![CDATA[
1878 var File = java.io.File;
1879 var FilenameUtils = Packages.org.apache.commons.io.FilenameUtils;
1880 jars = project.getProperty("eclipse-project-libs").split(project.getProperty("path.separator"));
1881
1882 cp = "";
1883 for (i=0; i< jars.length; i++) {
1884 srcjar = FilenameUtils.getBaseName(jars[i]) + '-sources.jar';
1885 srcdir = FilenameUtils.concat(project.getProperty("build.dir.lib"), 'sources');
1886 srcfile = new File(FilenameUtils.concat(srcdir, srcjar));
1887
1888 cp += ' <classpathentry kind="lib" path="' + jars[i] + '"';
1889 if (srcfile.exists()) {
1890 cp += ' sourcepath="' + srcfile.getAbsolutePath() + '"';
1891 }
1892 cp += '/>\n';
1893 }
1894
1895 cp += '</classpath>';
1896
1897 echo = project.createTask("echo");
1898 echo.setMessage(cp);
1899 echo.setFile(new File(".classpath"));
1900 echo.setAppend(true);
1901 echo.perform();
1902 ]]> </script>
1903 <mkdir dir=".settings" />
1904 </target>
1905
1906 <pathconvert property="eclipse.project.name">
1907 <path path="${basedir}" />
1908 <regexpmapper from="^.*/([^/]+)$$" to="\1" handledirsep="yes" />
1909 </pathconvert>
1910
1911 <!-- Clean Eclipse project description files -->
1912 <target name="clean-eclipse-files">
1913 <delete file=".project" />
1914 <delete file=".classpath" />
1915 <delete dir=".settings" />
1916 <delete dir=".externalToolBuilders" />
1917 <delete dir="build/eclipse-classes" />
1918 </target>
1919
1920
1921 <target name="eclipse-warnings" depends="build" description="Run eclipse compiler code analysis">
1922 <property name="ecj.log.dir" value="${build.dir}/ecj" />
1923 <property name="ecj.warnings.file" value="${ecj.log.dir}/eclipse_compiler_checks.txt"/>
1924 <mkdir dir="${ecj.log.dir}" />
1925
1926 <property name="ecj.properties" value="${basedir}/eclipse_compiler.properties" />
1927
1928 <echo message="Running Eclipse Code Analysis. Output logged to ${ecj.warnings.file}" />
1929
1930 <java
1931 jar="${build.dir.lib}/jars/ecj-${ecj.version}.jar"
1932 fork="true"
1933 failonerror="true"
1934 maxmemory="512m">
1935 <arg value="-source"/>
1936 <arg value="${source.version}" />
1937 <arg value="-target"/>
1938 <arg value="${target.version}" />
1939 <arg value="-d" />
1940 <arg value="none" />
1941 <arg value="-proc:none" />
1942 <arg value="-log" />
1943 <arg value="${ecj.warnings.file}" />
1944 <arg value="-properties" />
1945 <arg value="${ecj.properties}" />
1946 <arg value="-cp" />
1947 <arg value="${toString:cassandra.classpath}" />
1948 <arg value="${build.src.java}" />
1949 </java>
1950 </target>
1951
1952
1953 <!-- Publish artifacts to Maven repositories -->
1954 <target name="mvn-install"
1955 depends="maven-declare-dependencies,artifacts,jar,sources-jar,javadoc-jar"
1956 description="Installs the artifacts in the Maven Local Repository">
1957
1958 <!-- the parent -->
1959 <install pomFile="${build.dir}/${final.name}-parent.pom"
1960 file="${build.dir}/${final.name}-parent.pom"
1961 packaging="pom"/>
1962
1963 <!-- the distribution -->
1964 <install pomFile="${build.dir}/${final.name}-dist.pom"
1965 file="${build.dir}/${final.name}-dist.pom"
1966 packaging="pom"/>
1967 <install pomFile="${build.dir}/${final.name}-dist.pom"
1968 file="${build.dir}/${final.name}-bin.tar.gz"
1969 packaging="tar.gz"
1970 classifier="bin"/>
1971 <install pomFile="${build.dir}/${final.name}-dist.pom"
1972 file="${build.dir}/${final.name}-src.tar.gz"
1973 packaging="tar.gz"
1974 classifier="src"/>
1975
1976 <!-- the cassandra-thrift jar -->
1977 <install pomFile="${build.dir}/${ant.project.name}-thrift-${version}.pom"
1978 file="${build.dir}/${ant.project.name}-thrift-${version}.jar"/>
1979 <install pomFile="${build.dir}/${ant.project.name}-thrift-${version}.pom"
1980 file="${build.dir}/${ant.project.name}-thrift-${version}-sources.jar"
1981 classifier="sources"/>
1982 <install pomFile="${build.dir}/${ant.project.name}-thrift-${version}.pom"
1983 file="${build.dir}/${ant.project.name}-thrift-${version}-javadoc.jar"
1984 classifier="javadoc"/>
1985
1986 <!-- the cassandra-all jar -->
1987 <install pomFile="${build.dir}/${final.name}.pom"
1988 file="${build.dir}/${final.name}.jar"/>
1989 <install pomFile="${build.dir}/${final.name}.pom"
1990 file="${build.dir}/${final.name}-sources.jar"
1991 classifier="sources"/>
1992 <install pomFile="${build.dir}/${final.name}.pom"
1993 file="${build.dir}/${final.name}-javadoc.jar"
1994 classifier="javadoc"/>
1995 </target>
1996
1997 <target name="publish"
1998 depends="mvn-install"
1999 if="release"
2000 description="Publishes the artifacts to the Maven repository">
2001
2002 <!-- the parent -->
2003 <deploy pomFile="${build.dir}/${final.name}-parent.pom"
2004 file="${build.dir}/${final.name}-parent.pom"
2005 packaging="pom"/>
2006
2007 <!-- the distribution -->
2008 <deploy pomFile="${build.dir}/${final.name}-dist.pom"
2009 file="${build.dir}/${final.name}-dist.pom"
2010 packaging="pom"/>
2011 <deploy pomFile="${build.dir}/${final.name}-dist.pom"
2012 file="${build.dir}/${final.name}-bin.tar.gz"
2013 packaging="tar.gz"
2014 classifier="bin"/>
2015 <deploy pomFile="${build.dir}/${final.name}-dist.pom"
2016 file="${build.dir}/${final.name}-src.tar.gz"
2017 packaging="tar.gz"
2018 classifier="src"/>
2019
2020 <!-- the cassandra-thrift jar -->
2021 <deploy pomFile="${build.dir}/${ant.project.name}-thrift-${version}.pom"
2022 file="${build.dir}/${ant.project.name}-thrift-${version}.jar"/>
2023 <deploy pomFile="${build.dir}/${ant.project.name}-thrift-${version}.pom"
2024 file="${build.dir}/${ant.project.name}-thrift-${version}-sources.jar"
2025 classifier="sources"/>
2026 <deploy pomFile="${build.dir}/${ant.project.name}-thrift-${version}.pom"
2027 file="${build.dir}/${ant.project.name}-thrift-${version}-javadoc.jar"
2028 classifier="javadoc"/>
2029
2030 <!-- the cassandra-all jar -->
2031 <deploy pomFile="${build.dir}/${final.name}.pom"
2032 file="${build.dir}/${final.name}.jar"/>
2033 <deploy pomFile="${build.dir}/${final.name}.pom"
2034 file="${build.dir}/${final.name}-sources.jar"
2035 classifier="sources"/>
2036 <deploy pomFile="${build.dir}/${final.name}.pom"
2037 file="${build.dir}/${final.name}-javadoc.jar"
2038 classifier="javadoc"/>
2039 </target>
2040
2041 </project>