Skip to content

Commit

Permalink
Follow up fixes to CASSANDRA-16633
Browse files Browse the repository at this point in the history
* Don't run rat check if git fails or not available
* Check for presence of rat.txt before running eclipse-warnings task
  (to ensure that the report is always generated by CI runs)

Patch by Sam Tunnicliffe; reviewed by Mick Semb Wever for CASSANDRA-16633
  • Loading branch information
beobal committed Apr 27, 2021
1 parent bd27026 commit 26163bb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
18 changes: 17 additions & 1 deletion .build/build-rat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@
</target>

<target name="_build_ratinclude" depends="_rat_init">
<exec executable="git" failifexecutionfails="true" failonerror="true" output="build/.versioned_files">
<exec executable="git" failifexecutionfails="false" failonerror="false" resultproperty="git.success" output="build/.versioned_files">
<arg line="ls-tree -r HEAD --name-only"/>
</exec>
<condition property="rat.skip" value="true">
<not>
<equals arg1="${git.success}" arg2="0"/>
</not>
</condition>
<copy file="build/.versioned_files" tofile="build/.ratinclude">
<filterchain>
<linecontainsregexp>
Expand Down Expand Up @@ -101,4 +106,15 @@
<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/rat.txt" />
</not>
</condition>
</fail>
</target>

</project>
3 changes: 1 addition & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1920,8 +1920,7 @@
<delete dir="build/eclipse-classes" />
</target>


<target name="eclipse-warnings" depends="build" description="Run eclipse compiler code analysis">
<target name="eclipse-warnings" depends="build, _assert_rat_output" description="Run eclipse compiler code analysis">
<property name="ecj.log.dir" value="${build.dir}/ecj" />
<property name="ecj.warnings.file" value="${ecj.log.dir}/eclipse_compiler_checks.txt"/>
<delete dir="${ecj.log.dir}" />
Expand Down

0 comments on commit 26163bb

Please sign in to comment.