Skip to content

Commit

Permalink
Improve usage of clang-format in the Java test project
Browse files Browse the repository at this point in the history
  • Loading branch information
mikir committed Jan 9, 2024
1 parent 3b4f6e9 commit b2735c4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
6 changes: 5 additions & 1 deletion test/arguments/without_sql_code/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
<testCompile testName="without_sql_code" srcPath="${without_sql_code.zs.out_dir}"/>
</target>

<target name="spotbugs" depends="compile" if="spotbugs.home_dir">
<target name="clang_format" depends="compile" if="clang_format.exec_file">
<testClangFormat testName="without_sql_code"/>
</target>

<target name="spotbugs" depends="clang_format" if="spotbugs.home_dir">
<testSpotBugs testName="without_sql_code" srcPath="${without_sql_code.zs.out_dir}"/>
</target>

Expand Down
7 changes: 5 additions & 2 deletions test/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,15 @@ spotbugs.home_dir - Location of the spotbugs tool. If not set, spo
<attribute name="testName"/>
<attribute name="srcPath" default="${@{testName}.base_dir}/java"/>
<sequential>
<echo>
<condition property="src_path.exists">
<available file="@{srcPath}" type="dir"/>
</condition>
<echo if:set="src_path.exists">
Command hints to reformat source manually using clang-format tool (in case of format errors):
git clang-format
clang-format --style=file -i [SOURCE]
</echo>
<apply executable="${clang_format.exec_file}" failonerror="true">
<apply if:set="src_path.exists" executable="${clang_format.exec_file}" failonerror="true">
<arg value="--style=file"/>
<arg value="--dry-run"/>
<arg value="--Werror"/>
Expand Down
6 changes: 5 additions & 1 deletion test/language/comments/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
<testCompile testName="comments" srcPath="${comments.zs.out_dir}"/>
</target>

<target name="spotbugs" depends="compile" if="spotbugs.home_dir">
<target name="clang_format" depends="compile" if="clang_format.exec_file">
<testClangFormat testName="comments"/>
</target>

<target name="spotbugs" depends="clang_format" if="spotbugs.home_dir">
<testSpotBugs testName="comments" srcPath="${comments.zs.out_dir}"/>
</target>

Expand Down
6 changes: 5 additions & 1 deletion test/language/rules/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
<testCompile testName="rules" srcPath="${rules.zs.out_dir}"/>
</target>

<target name="spotbugs" depends="compile" if="spotbugs.home_dir">
<target name="clang_format" depends="compile" if="clang_format.exec_file">
<testClangFormat testName="rules"/>
</target>

<target name="spotbugs" depends="clang_format" if="spotbugs.home_dir">
<testSpotBugs testName="rules" srcPath="${rules.zs.out_dir}"/>
</target>

Expand Down

0 comments on commit b2735c4

Please sign in to comment.