You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

check.xml 3.6 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?xml version="1.0"?>
  2. <project default="checkstyle" name="CheckAnt">
  3. <description>
  4. Check Ants codebase against certain code styleguide rules using
  5. checkstyle and simian.
  6. Checkstyle uses an abstract syntax tree (AST) for doing checks
  7. against java sources. It is available at http://checkstyle.sourceforge.net/
  8. under GPL 2.1 license.
  9. "Simian (Similarity Analyser) identifies duplication in Java, C#, C,
  10. CPP, COBOL, JSP, HTML source code and even plain text files."
  11. It is available at http://www.redhillconsulting.com.au/products/simian/
  12. and is for free use in open source projects.
  13. See external task page and homepages for more information.
  14. </description>
  15. <import file="build.xml"/>
  16. <property name="config.dir" location="${etc.dir}/checkstyle"/>
  17. <property name="checkstyle.reportdir" location="${build.dir}/reports/checkstyle"/>
  18. <property name="checkstyle.raw" location="${checkstyle.reportdir}/raw.xml"/>
  19. <property name="stylesheet.html" location="${config.dir}/checkstyle-frames.xsl"/>
  20. <property name="stylesheet.text" location="${config.dir}/checkstyle-text.xsl"/>
  21. <property name="stylesheet.xdoc" location="${config.dir}/checkstyle-xdoc.xsl"/>
  22. <property name="checkstyle.basedir" location="${java.dir}"/>
  23. <!-- Ant Checkstyle report -->
  24. <property name="tocheck" value="**/*.java"/>
  25. <property name="javadoc.scope" value="public"/>
  26. <taskdef resource="simiantask.properties"/>
  27. <taskdef resource="checkstyletask.properties"/>
  28. <target name="checkstyle" description="--> checks Ant codebase according to ${config.dir}/checkstyle-config">
  29. <mkdir dir="${checkstyle.reportdir}"/>
  30. <checkstyle config="${config.dir}/checkstyle-config" failOnViolation="false">
  31. <formatter type="xml" toFile="${checkstyle.raw}"/>
  32. <fileset dir="${java.dir}">
  33. <include name="${tocheck}"/>
  34. <exclude name="**/bzip2/*.java"/>
  35. <exclude name="**/CVSPass.java"/>
  36. </fileset>
  37. </checkstyle>
  38. </target>
  39. <target name="htmlreport" description="--> generates a html checkstyle report">
  40. <mkdir dir="${checkstyle.reportdir}"/>
  41. <style in="${checkstyle.raw}" style="${stylesheet.html}"
  42. out="${checkstyle.reportdir}/html/output.txt">
  43. <param name="basedir" expression="${checkstyle.basedir}"/>
  44. </style>
  45. </target>
  46. <target name="textreport" description="--> generates a text checkstyle report">
  47. <style in="${checkstyle.raw}" style="${stylesheet.text}"
  48. out="${checkstyle.reportdir}/report.txt">
  49. </style>
  50. </target>
  51. <target name="textreport-display" depends="textreport" description="--> generates a text checkstyle report and displays it immediately">
  52. <loadfile property="report" srcfile="${checkstyle.reportdir}/report.txt"/>
  53. <echo>${report}</echo>
  54. </target>
  55. <target name="xdocreport" description="--> generates a xdoc checkstyle report">
  56. <style in="${checkstyle.raw}" style="${stylesheet.xdoc}"
  57. out="${checkstyle.reportdir}/xdocs/index.xml">
  58. <param name="basedir" expression="${checkstyle.basedir}"/>
  59. </style>
  60. </target>
  61. <target name="dumphtml" depends="checkstyle, htmlreport" description="--> runs the checkstyle and generates a html report"/>
  62. <target name="dumptext" depends="checkstyle, textreport" description="--> runs the checkstyle and displays result as text">
  63. <concat>
  64. <filelist dir="${checkstyle.reportdir}" files="report.txt"/>
  65. </concat>
  66. </target>
  67. <target name="simiancheck" description="--> runs the check for duplicates">
  68. <simian>
  69. <fileset dir="${java.dir}" />
  70. </simian>
  71. </target>
  72. </project>