Source

Cassandra / build.xml

Full commit
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
 ~ Licensed to the Apache Software Foundation (ASF) under one
 ~ or more contributor license agreements.  See the NOTICE file
 ~ distributed with this work for additional information
 ~ regarding copyright ownership.  The ASF licenses this file
 ~ to you under the Apache License, Version 2.0 (the
 ~ "License"); you may not use this file except in compliance
 ~ with the License.  You may obtain a copy of the License at
 ~
 ~    http://www.apache.org/licenses/LICENSE-2.0
 ~
 ~ Unless required by applicable law or agreed to in writing,
 ~ software distributed under the License is distributed on an
 ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 ~ KIND, either express or implied.  See the License for the
 ~ specific language governing permissions and limitations
 ~ under the License.
 -->
<project basedir="." default="build" name="apache-cassandra"
         xmlns:ivy="antlib:org.apache.ivy.ant">
    <property environment="env"/>
    <property file="build.properties" />
    <property name="debuglevel" value="source,lines,vars"/>

    <property name="basedir" value="."/>
    <property name="build.src" value="${basedir}/src"/>
    <property name="build.src.java" value="${basedir}/src/java"/>
    <property name="avro.src" value="${basedir}/src/avro"/>
    <property name="build.src.gen-java" value="${basedir}/src/gen-java"/>
    <property name="build.lib" value="${basedir}/lib"/>
    <property name="build.dir" value="${basedir}/build"/>
    <property name="build.dir.lib" value="${basedir}/build/lib"/>
    <property name="build.test.dir" value="${build.dir}/test"/>
    <property name="build.classes" value="${build.dir}/classes"/>
    <property name="javadoc.dir" value="${build.dir}/javadoc"/>
    <property name="interface.dir" value="${basedir}/interface"/>
    <property name="interface.thrift.dir" value="${interface.dir}/thrift"/>
    <property name="interface.thrift.gen-java" value="${interface.thrift.dir}/gen-java"/>
    <property name="interface.avro.dir" value="${interface.dir}/avro"/>
    <property name="test.dir" value="${basedir}/test"/>
    <property name="test.resources" value="${test.dir}/resources"/>
    <property name="test.classes" value="${build.dir}/test/classes"/>
    <property name="test.conf" value="${test.dir}/conf"/>
    <property name="test.data" value="${test.dir}/data"/>
    <property name="test.name" value="*Test"/>
    <property name="test.unit.src" value="${test.dir}/unit"/>
    <property name="test.long.src" value="${test.dir}/long"/>
    <property name="dist.dir" value="${build.dir}/dist"/>
    <property name="base.version" value="0.7.0-rc3"/>
    <condition property="version" value="${base.version}">
      <isset property="release"/>
    </condition>
    <property name="version" value="${base.version}-SNAPSHOT"/>
    <property name="version.properties.dir" value="${build.classes}/org/apache/cassandra/config/"/>
    <property name="final.name" value="${ant.project.name}-${version}"/>
    <property name="ivy.version" value="2.1.0" />
    <property name="ivy.url"
              value="http://repo2.maven.org/maven2/org/apache/ivy/ivy" />

    <!-- http://cobertura.sourceforge.net/ -->
    <property name="cobertura.build.dir" value="${build.dir}/cobertura"/>
    <!-- can't include due to licensing, specify jar via command line -->
    <property name="cobertura.dir" value="/tmp"/>
    <property name="cobertura.report.dir" value="${cobertura.build.dir}/report"/>
    <property name="cobertura.classes.dir" value="${cobertura.build.dir}/classes"/>
    <property name="cobertura.datafile" value="${cobertura.build.dir}/cobertura.ser"/>

    <condition property="ivy.jar.exists">
      <available file="${build.dir}/ivy-${ivy.version}.jar" />
    </condition>

    <condition property="is.source.artifact">
      <available file="${build.src.java}" type="dir" />
    </condition>

    <!--
         Add all the dependencies.
    -->
    <path id="autoivy.classpath">
        <fileset dir="${build.dir.lib}">
          <include name="**/*.jar" />
        </fileset>
        <pathelement location="${build.dir}/ivy-${ivy.version}.jar"/>
    </path>
    <path id="cassandra.classpath">
        <pathelement location="${cobertura.classes.dir}"/>
        <pathelement location="${build.classes}"/>
        <fileset dir="${build.lib}">
          <include name="**/*.jar" />
        </fileset>
        <path refid="autoivy.classpath" />
    </path>
    <path id="rat.classpath">
      <fileset dir="${build.dir.lib}">
        <include name="**/apache-rat*.jar"/>
        <include name="**/commons-*.jar"/>
      </fileset>
    </path>

    <!--
        Setup the output directories.
    -->
    <target name="init">
        <fail unless="is.source.artifact"
            message="Not a source artifact, stopping here." />
        <mkdir dir="${build.classes}"/>
        <mkdir dir="${test.classes}"/>
        <mkdir dir="${build.src.gen-java}"/>
    </target>

    <target name="clean" description="Remove all locally created artifacts">
        <delete dir="${build.test.dir}" />
        <delete dir="${build.classes}" />
        <delete dir="${build.src.gen-java}" />
        <delete dir="${interface.avro.dir}" />
        <delete file="${build.dir}/internode.avpr" />
    </target>
    <target depends="clean" name="cleanall"/>

    <target name="realclean" depends="clean">
        <delete dir="${build.dir}" />
    </target>

    <!--
       This generates the CLI grammar files from Cli.g
    -->
    <target name="check-gen-cli-grammar">
        <uptodate property="cliUpToDate"
                srcfile="${build.src.java}/org/apache/cassandra/cli/Cli.g"
                targetfile="${build.src.gen-java}/org/apache/cassandra/cli/Cli.tokens"/>
    </target>

    <target name="gen-cli-grammar" depends="check-gen-cli-grammar" unless="cliUpToDate">
      <echo>Building Grammar ${build.src.java}/org/apache/cassandra/cli/Cli.g  ....</echo>
      <java classname="org.antlr.Tool"
            classpath="${build.lib}/antlr-3.1.3.jar"
            fork="true"
            failonerror="true">
         <arg value="${build.src.java}/org/apache/cassandra/cli/Cli.g" />
         <arg value="-fo" />
         <arg value="${build.src.gen-java}/org/apache/cassandra/cli/" />
      </java>
    </target>

    <!--
       Fetch Ivy and Cassandra's dependencies

       These targets are intentionally free of dependencies so that they
       can be run stand-alone from a binary release artifact.
    -->
    <target name="ivy-download" unless="ivy.jar.exists">
      <echo>Downloading Ivy...</echo>
      <mkdir dir="${build.dir}" />
      <get src="${ivy.url}/${ivy.version}/ivy-${ivy.version}.jar"
           dest="${build.dir}/ivy-${ivy.version}.jar" usetimestamp="true" />
    </target>

    <target name="ivy-init" depends="ivy-download" unless="ivy.initialized">
      <mkdir dir="${build.dir.lib}"/>
      <taskdef resource="org/apache/ivy/ant/antlib.xml"
               uri="antlib:org.apache.ivy.ant"
               classpathref="autoivy.classpath"/>
      <property name="ivy.initialized" value="true"/>
    </target>

    <target name="ivy-retrieve-build" depends="ivy-init">
      <ivy:retrieve type="jar,source" sync="true"
             pattern="${build.dir.lib}/[type]s/[artifact]-[revision].[ext]" />
    </target>

    <!--
       Generate avro code
    -->
    <target name="check-avro-generate" depends="ivy-init">
      <taskdef name="avro-protocol" classname="org.apache.avro.specific.ProtocolTask">
        <classpath refid="cassandra.classpath" />
      </taskdef>
      <uptodate property="avroInterfaceUpToDate" srcfile="${interface.dir}/cassandra.genavro"
                targetfile="${interface.avro.dir}/cassandra.avpr" />
      <uptodate property="avroINProtoUpToDate" srcfile="${avro.src}/internode.genavro"
                targetfile="${build.dir}/internode.avpr" />
    </target>

    <target name="avro-generate"
            depends="avro-interface-generate-client,avro-interface-generate-internode"
            description="Generates Java Avro classes for client and internal use." />

    <target name="avro-interface-generate-client" unless="avroInterfaceUpToDate"
            depends="init,check-avro-generate,ivy-retrieve-build">
      <!-- A copy for interested clients. TODO: Jar this stuff up. -->
      <avromacro protocolname="cassandra" inputfile="${interface.dir}/cassandra.genavro"
          jsondir="${interface.avro.dir}" outputdir="${interface.avro.dir}" />
      <!-- A copy for our build. -->
      <avromacro protocolname="api" inputfile="${interface.dir}/cassandra.genavro"
                 jsondir="${build.dir}" outputdir="${build.src}" />
    </target>
    <target name="avro-interface-generate-internode" unless="avroINProtoUpToDate"
            depends="init,check-avro-generate,ivy-retrieve-build">
      <avromacro protocolname="internode" inputfile="${avro.src}/internode.genavro"
                 jsondir="${build.dir}" outputdir="${build.src}"/>
    </target>

    <macrodef name="avromacro">
      <attribute name="protocolname" />
      <attribute name="inputfile" />
      <attribute name="jsondir" />
      <attribute name="outputdir" />
      <sequential>
        <echo message="Generating Avro @{protocolname} code..." />
        <mkdir dir="@{jsondir}" />
        <!-- Generate json schema from genavro IDL -->
        <java classname="org.apache.avro.tool.Main" fork="true">
          <classpath refid="cassandra.classpath" />
          <arg value="idl" />
          <arg value="@{inputfile}" />
          <arg value="@{jsondir}/@{protocolname}.avpr" />
        </java>

        <!-- Generate java code from JSON protocol schema -->
        <avro-protocol destdir="@{outputdir}/gen-java">
            <fileset file="@{jsondir}/@{protocolname}.avpr" />
        </avro-protocol>
      </sequential>
    </macrodef>


    <!--
       Generate thrift code.  We have targets to build java because
       Cassandra depends on it, and python because that is what the system
       tests run.
    -->
    <target name="gen-thrift-java" depends="rat-init" description="Generate Thrift Java artifacts">
      <echo>Generating Thrift Java code from ${basedir}/interface/cassandra.thrift ....</echo>
      <exec executable="thrift" dir="${basedir}/interface" failonerror="true">
        <arg line="--gen java:hashcode" />
        <arg line="-o ${interface.thrift.dir}" />
        <arg line="cassandra.thrift" />
      </exec>
      <java classname="org.apache.rat.Report" fork="true"
            output="${build.dir}/rat-report.log">
        <classpath refid="rat.classpath" />
        <arg value="-a" />
        <arg value="--force" />
        <arg value="interface/thrift" />
      </java>
    </target>
    <target name="gen-thrift-py" description="Generate Thrift Python artifacts">
      <echo>Generating Thrift Python code from ${basedir}/interface/cassandra.thrift ....</echo>
      <exec executable="thrift" dir="${basedir}/interface" failonerror="true">
        <arg line="--gen py" />
        <arg line="-o ${interface.thrift.dir}" />
        <arg line="cassandra.thrift" />
      </exec>
    </target>

    <!-- create properties file with C version -->
    <target name="createVersionPropFile">
      <taskdef name="propertyfile" classname="org.apache.tools.ant.taskdefs.optional.PropertyFile"/>
      <propertyfile file="${version.properties.dir}/version.properties">
        <entry key="CassandraVersion" value="${version}"/>
      </propertyfile>
    </target>

    <!--
        The build target builds all the .class files
    -->
    <target name="build"
        depends="ivy-retrieve-build,avro-generate,build-subprojects,build-project" description="Compile Cassandra classes"/>
    <target name="build-subprojects" description="Compile Cassandra contrib projects"/>
    <target name="codecoverage" depends="cobertura-instrument,test,cobertura-report" description="Create code coverage report"/>

    <target depends="init,avro-generate,gen-cli-grammar" name="build-project">
        <echo message="${ant.project.name}: ${ant.file}"/>
        <javac debug="true" debuglevel="${debuglevel}" destdir="${build.classes}" includeantruntime="false">
            <src path="${build.src.java}"/>
            <src path="${build.src.gen-java}"/>
            <src path="${interface.thrift.dir}/gen-java"/>
                <classpath refid="cassandra.classpath"/>
        </javac>

        <taskdef name="paranamer" classname="com.thoughtworks.paranamer.ant.ParanamerGeneratorTask">
          <classpath refid="cassandra.classpath" />
        </taskdef>

        <!--<paranamer sourceDirectory="${interface.avro.dir}"-->
               <!--outputDirectory="${build.classes}"/>-->

        <antcall target="createVersionPropFile"/>
    </target>


    <!--
        The jar target makes cassandra.jar output.
    -->
    <target name="jar" depends="build" description="Assemble Cassandra JAR files">
      <mkdir dir="${build.classes}/META-INF"/>
      <copy file="LICENSE.txt" tofile="${build.classes}/META-INF/LICENSE.txt"/>
      <copy file="NOTICE.txt" tofile="${build.classes}/META-INF/NOTICE.txt"/>
      <jar jarfile="${build.dir}/${final.name}.jar"
           basedir="${build.classes}">
        <manifest>
        <!-- <section name="org/apache/cassandra/infrastructure"> -->
          <attribute name="Implementation-Title" value="Cassandra"/>
          <attribute name="Implementation-Version" value="${version}"/>
          <attribute name="Implementation-Vendor" value="Apache"/>
          <attribute name="Premain-Class" value="org.apache.cassandra.infrastructure.continuations.CAgent"/>
        <!-- </section> -->
        </manifest>
      </jar>
    </target>

    <!-- creates release tarballs -->
    <target name="artifacts" depends="jar,javadoc"
            description="Create Cassandra release artifacts">
      <mkdir dir="${dist.dir}"/>
      <copy todir="${dist.dir}/lib">
        <fileset dir="${build.lib}"/>
        <fileset dir="${build.dir}">
          <include name="*.jar" />
        </fileset>
      </copy>
      <copy todir="${dist.dir}/javadoc">
        <fileset dir="${javadoc.dir}"/>
      </copy>
      <copy todir="${dist.dir}/bin">
        <fileset dir="bin"/>
      </copy>
      <copy todir="${dist.dir}/conf">
        <fileset dir="conf"/>
      </copy>
      <copy todir="${dist.dir}/interface">
        <fileset dir="interface">
          <include name="**/*.thrift" />
          <include name="cassandra.genavro" />
          <include name="avro/cassandra.avpr" />
        </fileset>
      </copy>
      <copy todir="${dist.dir}/">
        <fileset dir="${basedir}">
          <include name="*.txt" />
        </fileset>
      </copy>

      <tar compression="gzip" longfile="gnu"
        destfile="${build.dir}/${final.name}-bin.tar.gz">

        <!-- Everything but bin/ (default mode) -->
        <tarfileset dir="${dist.dir}" prefix="${final.name}">
          <include name="**"/>
          <exclude name="bin/*" />
        </tarfileset>
        <!-- Shell includes in bin/ (default mode) -->
        <tarfileset dir="${dist.dir}" prefix="${final.name}">
          <include name="bin/*.in.sh" />
        </tarfileset>
        <!-- Executable scripts in bin/ -->
        <tarfileset dir="${dist.dir}" prefix="${final.name}" mode="755">
          <include name="bin/*"/>
          <not>
                <filename name="bin/*.in.sh" />
          </not>
        </tarfileset>
      </tar>

      <tar compression="gzip" longfile="gnu"
           destfile="${build.dir}/${final.name}-src.tar.gz">

        <tarfileset dir="${basedir}"
                    prefix="${final.name}-src">
          <include name="**"/>
          <exclude name="build/**" />
          <exclude name="src/gen-java/**" />
          <exclude name="interface/avro/**" />
          <exclude name=".git/**" />
          <exclude name="bin/*" /> <!-- handled separately below -->
        </tarfileset>

        <!-- Shell includes and batch files in bin/ -->
        <tarfileset dir="${basedir}" prefix="${final.name}-src">
          <include name="bin/*.in.sh" />
          <include name="bin/*.bat" />
        </tarfileset>
        <!-- Everything else (assumed to be scripts), is executable -->
        <tarfileset dir="${basedir}" prefix="${final.name}-src" mode="755">
          <include name="bin/*"/>
          <exclude name="bin/*.in.sh" />
          <exclude name="bin/*.bat" />
        </tarfileset>
      </tar>
    </target>

    <target name="release" depends="artifacts,rat-init"
            description="Create and QC release artifacts">
      <checksum file="${build.dir}/${final.name}-bin.tar.gz"
                forceOverwrite="yes"
                todir="${build.dir}"
                fileext=".md5"
                algorithm="MD5" />
      <checksum file="${build.dir}/${final.name}-src.tar.gz"
                forceOverwrite="yes"
                todir="${build.dir}"
                fileext=".md5"
                algorithm="MD5" />
      <checksum file="${build.dir}/${final.name}-bin.tar.gz"
                forceOverwrite="yes"
                todir="${build.dir}"
                fileext=".sha"
                algorithm="SHA" />
      <checksum file="${build.dir}/${final.name}-src.tar.gz"
                forceOverwrite="yes"
                todir="${build.dir}"
                fileext=".sha"
                algorithm="SHA" />

      <rat:report xmlns:rat="antlib:org.apache.rat.anttasks"
                  reportFile="${build.dir}/${final.name}-bin.rat.txt">
        <tarfileset>
          <gzipresource>
            <file file="${build.dir}/${final.name}-bin.tar.gz" />
          </gzipresource>
        </tarfileset>
      </rat:report>

      <rat:report xmlns:rat="antlib:org.apache.rat.anttasks"
                  reportFile="${build.dir}/${final.name}-src.rat.txt">
        <tarfileset>
          <gzipresource>
            <file file="${build.dir}/${final.name}-src.tar.gz" />
          </gzipresource>
        </tarfileset>
      </rat:report>
    </target>

  <target name="build-test" depends="build" description="Compile test classes">
    <javac
     debug="true"
     debuglevel="${debuglevel}"
     destdir="${test.classes}">
      <classpath refid="cassandra.classpath"/>
      <src path="${test.unit.src}"/>
      <src path="${test.long.src}"/>
    </javac>

    <!-- Non-java resources needed by the test suite -->
    <copy todir="${test.classes}">
      <fileset dir="${test.resources}"/>
    </copy>
  </target>

  <macrodef name="testmacro">
    <attribute name="suitename" />
    <attribute name="inputdir" />
    <attribute name="timeout" />
    <sequential>
      <echo message="running @{suitename} tests"/>
      <mkdir dir="${build.test.dir}/cassandra"/>
      <mkdir dir="${build.test.dir}/output"/>
      <junit fork="on" failureproperty="testfailed" maxmemory="1024m" timeout="@{timeout}">
        <sysproperty key="net.sourceforge.cobertura.datafile" file="${cobertura.datafile}"/>
        <formatter type="xml" usefile="true"/>
        <formatter type="brief" usefile="false"/>
        <jvmarg value="-Dstorage-config=${test.conf}"/>
        <jvmarg value="-Daccess.properties=${test.conf}/access.properties"/>
        <jvmarg value="-Dlog4j.configuration=log4j-junit.properties" />
        <jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
        <jvmarg value="-ea"/>
        <classpath>
          <path refid="cassandra.classpath" />
          <pathelement location="${test.classes}"/>
          <pathelement location="${cobertura.dir}/cobertura.jar"/>
          <pathelement location="${test.conf}"/>
        </classpath>
        <batchtest todir="${build.test.dir}/output">
          <fileset dir="@{inputdir}" includes="**/${test.name}.java" />
        </batchtest>
      </junit>
      <fail if="testfailed" message="Some @{suitename} test(s) failed."/>
    </sequential>
  </macrodef>

  <target name="test" depends="build-test" description="Execute unit tests">
    <testmacro suitename="unit" inputdir="${test.unit.src}" timeout="60000" />
  </target>

  <target name="long-test" depends="build-test" description="Execute functional tests">
    <testmacro suitename="long" inputdir="${test.long.src}" timeout="300000" />
  </target>

  <!-- instruments the classes to later create code coverage reports -->
  <target name="cobertura-instrument" depends="build,build-test">
    <taskdef resource="tasks.properties">
      <classpath>
        <fileset dir="${cobertura.dir}">
            <include name="cobertura.jar" />
            <include name="lib/**/*.jar" />
        </fileset>
      </classpath>
    </taskdef>

    <delete file="${cobertura.datafile}"/>

    <cobertura-instrument todir="${cobertura.classes.dir}" datafile="${cobertura.datafile}">
      <ignore regex="org.apache.log4j.*"/>

      <fileset dir="${build.classes}">
        <include name="**/*.class"/>
        <exclude name="**/*Test.class"/>
        <exclude name="**/*TestCase.class"/>
        <exclude name="**/test/*.class"/>
        <exclude name="${cobertura.excludes}"/>
      </fileset>

    </cobertura-instrument>
  </target>

  <!-- create both html and xml code coverage reports -->
  <target name="cobertura-report">
    <cobertura-report format="html" destdir="${cobertura.report.dir}" srcdir="${build.src.java}"
      datafile="${cobertura.datafile}"/>
    <cobertura-report format="xml" destdir="${cobertura.report.dir}" srcdir="${build.src.java}"
      datafile="${cobertura.datafile}"/>
  </target>

  <!--
    License audit tool
  -->
  <target name="rat-init" depends="ivy-retrieve-build">
    <typedef resource="org/apache/rat/anttasks/antlib.xml"
             uri="antlib:org.apache.rat.anttasks">
      <classpath refid="rat.classpath" />
    </typedef>
  </target>

  <target name="rat-check" depends="rat-init">
    <rat:report xmlns:rat="antlib:org.apache.rat.anttasks"
                reportFile="${build.dir}/rat-report.log">
      <fileset dir="."  excludesfile=".rat-excludes" />
    </rat:report>
    <condition property="rat.passed">
      <isfileselected file="${build.dir}/rat-report.log">
        <containsregexp expression="^0 Unknown Licenses"/>
      </isfileselected>
    </condition>
    <fail unless="rat.passed">Unknown licenses: See build/rat-report.log.</fail>
  </target>

  <target name="rat-write" depends="rat-init">
    <echo>RAT: invoking addLicense to write missing headers</echo>
    <java classname="org.apache.rat.Report" fork="true"
          output="${build.dir}/rat-report.log">
      <classpath refid="rat.classpath" />
      <arg value="-a" />
      <arg value="--force" />
      <arg value="." />
    </java>
  </target>

  <target name="javadoc" depends="init" description="Create javadoc">
    <tstamp>
      <format property="YEAR" pattern="yyyy"/>
    </tstamp>
    <javadoc destdir="${javadoc.dir}" author="true" version="true" use="true"
      windowtitle="${ant.project.name} API" classpathref="cassandra.classpath"
      bottom="Copyright &amp;copy; ${YEAR} The Apache Software Foundation">

      <fileset dir="${build.src.java}" defaultexcludes="yes">
        <include name="org/apache/**/*.java"/>
      </fileset>
      <fileset dir="${interface.thrift.gen-java}" defaultexcludes="yes">
        <include name="org/apache/**/*.java"/>
      </fileset>
    </javadoc>
   </target>

</project>