mirror of https://github.com/apache/cassandra
130 lines
5.9 KiB
XML
130 lines
5.9 KiB
XML
<!--
|
|
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="." name="apache-cassandra--rat-tasks"
|
|
xmlns:rat="antlib:org.apache.rat.anttasks">
|
|
|
|
<!--
|
|
License audit tool
|
|
-->
|
|
|
|
|
|
<target name="_rat_init" depends="resolver-init">
|
|
<typedef uri="antlib:org.apache.rat.anttasks" classpathref="rat.classpath"/>
|
|
</target>
|
|
|
|
<target name="_build_ratinclude" depends="_rat_init">
|
|
<exec executable="git" failifexecutionfails="false" failonerror="false" resultproperty="git.success" output="${build.dir}/.ratinclude">
|
|
<arg line="ls-tree -r HEAD --name-only"/>
|
|
</exec>
|
|
<condition property="rat.skip" value="true">
|
|
<not>
|
|
<equals arg1="${git.success}" arg2="0"/>
|
|
</not>
|
|
</condition>
|
|
</target>
|
|
|
|
<target name="rat-check" depends="_build_ratinclude" unless="${rat.skip}" description="License checks on source" >
|
|
<rat:report reportFile="${build.dir}/rat.txt">
|
|
<fileset dir="." includesfile="${build.dir}/.ratinclude">
|
|
<!-- Config files with not much creativity -->
|
|
<exclude name="ide/**/*"/>
|
|
<exclude name="conf/metrics-reporter-config-sample.yaml"/>
|
|
<exclude name="**/cassandra*.yaml"/>
|
|
<exclude NAME="doc/antora.yml"/>
|
|
<exclude NAME="eclipse_compiler.properties"/>
|
|
<exclude name="test/conf/cdc.yaml"/>
|
|
<exclude name="pylib/cqlshlib/test/config/sslhandling*.config"/>
|
|
<exclude name="test/conf/commitlog_compression_*.yaml"/>
|
|
<exclude name="test/conf/system_keyspaces_directory.yaml"/>
|
|
<exclude name="test/conf/unit-test-conf/test-native-port.yaml"/>
|
|
<exclude name="tools/cqlstress-*.yaml"/>
|
|
<!-- test data -->
|
|
<exclude name="test/**/cassandra*.conf"/>
|
|
<exclude name="test/**/*.csv"/>
|
|
<exclude name="test/**/*.json"/>
|
|
<exclude name="test/**/*.txt"/>
|
|
<exclude name="test/data/**/*.adler32"/>
|
|
<exclude name="test/data/**/*.crc32"/>
|
|
<exclude name="test/data/**/CommitLog-*.log"/>
|
|
<exclude name="test/data/**/*.bin"/>
|
|
<exclude name="test/data/**/*.db"/>
|
|
<exclude name="test/data/**/*.sha1"/>
|
|
<exclude name="test/data/CASSANDRA-15313/lz4-jvm-crash-failure.txt"/>
|
|
<exclude name="test/data/jmxdump/cassandra-*-jmx.yaml"/>
|
|
<!-- Documentation files -->
|
|
<exclude NAME="src/java/**/*.md"/>
|
|
<exclude NAME="**/README*"/>
|
|
<exclude NAME="CHANGES.txt"/>
|
|
<exclude NAME="CASSANDRA-14092.txt"/>
|
|
<!-- legal files -->
|
|
<exclude NAME="NOTICE.txt"/>
|
|
<exclude NAME="LICENSE.txt"/>
|
|
<!-- misc -->
|
|
<exclude NAME="**/*.patch"/>
|
|
<exclude NAME="**/*.dpatch"/>
|
|
<exclude NAME="**/*.diff"/>
|
|
<exclude NAME="debian/TODO"/>
|
|
<exclude NAME="debian/cassandra.bash-completion"/>
|
|
<exclude NAME="debian/cassandra-sysctl.conf"/>
|
|
<exclude NAME="debian/cassandra.install"/>
|
|
<exclude NAME="debian/cassandra-tools.install"/>
|
|
<exclude NAME="debian/compat"/>
|
|
<exclude NAME="debian/control"/>
|
|
<exclude NAME="debian/dirs"/>
|
|
<exclude NAME="debian/patches/00list"/>
|
|
</fileset>
|
|
</rat:report>
|
|
<exec executable="grep" outputproperty="rat.failed.files" failifexecutionfails="false">
|
|
<arg line="-A5 'Unapproved licenses' ${build.dir}/rat.txt"/>
|
|
</exec>
|
|
<fail message="Some files have missing or incorrect license information. Check RAT report in ${build.dir}/rat.txt for more details! \n ${rat.failed.files}">
|
|
<condition>
|
|
<and>
|
|
<not>
|
|
<resourcecontains resource="${build.dir}/rat.txt" substring="0 Unknown Licenses" casesensitive="false" />
|
|
</not>
|
|
</and>
|
|
</condition>
|
|
</fail>
|
|
</target>
|
|
|
|
<target name="_write_java_license_headers" depends="_rat_init">
|
|
<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="write-java-license-headers" unless="without.rat" description="Add missing java license headers">
|
|
<antcall target="_write_java_license_headers" />
|
|
</target>
|
|
|
|
<target name="_assert_rat_output">
|
|
<fail message="The rat report at build/rat.txt was not generated. Please ensure that the rat-check task is able to run successfully. For dev builds only, touch build/rat.txt to skip this check">
|
|
<condition>
|
|
<not>
|
|
<available file="${build.dir}/rat.txt" />
|
|
</not>
|
|
</condition>
|
|
</fail>
|
|
</target>
|
|
|
|
</project>
|