summaryrefslogtreecommitdiff
path: root/check.xml
blob: 61e059158eda91bcc8fb5b3b443c2809c985a561 (plain)
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
<?xml version="1.0"?>
<project default="checkstyle" name="CheckAnt">

  <description>
    Check Ants codebase against certain code styleguide rules using
    checkstyle and simian.

    Checkstyle uses an abstract syntax tree (AST) for doing checks
    against java sources. It is available at http://checkstyle.sourceforge.net/
    under GPL 2.1 license.

    "Simian (Similarity Analyser) identifies duplication in Java, C#, C,
    CPP, COBOL, JSP, HTML source code and even plain text files."
    It is available at http://www.redhillconsulting.com.au/products/simian/
    and is for free use in open source projects.

    See external task page and homepages for more information.
  </description>

  <import file="build.xml"/>
  <property name="config.dir" value="${etc.dir}/checkstyle"/>

  <property name="checkstyle.reportdir" value="${build.dir}/reports/checkstyle"/>
  <property name="checkstyle.raw" value="${checkstyle.reportdir}/raw.xml"/>
  <property name="stylesheet.html" value="${config.dir}/checkstyle-frames.xsl"/>
  <property name="stylesheet.text" value="${config.dir}/checkstyle-text.xsl"/>
  <property name="stylesheet.xdoc" value="${config.dir}/checkstyle-xdoc.xsl"/>

  <property name="checkstyle.basedir" location="${java.dir}"/>

  <!-- Ant Checkstyle report -->
  <property name="tocheck" value="**/*.java"/>
  <property name="javadoc.scope" value="public"/>

  <taskdef resource="simiantask.properties"/>
  <taskdef resource="checkstyletask.properties"/>

  <target name="checkstyle" description="--> checks Ant codebase according to ${config.dir}/chestyle-config">
    <mkdir dir="${checkstyle.reportdir}"/>
    <checkstyle config="${config.dir}/checkstyle-config" failOnViolation="false">
      <formatter type="xml" toFile="${checkstyle.raw}"/>
      <fileset dir="${java.dir}">
        <include name="${tocheck}"/>
        <exclude name="**/bzip2/*.java"/>
        <exclude name="**/CVSPass.java"/>
      </fileset>
    </checkstyle>
  </target>

  <target name="htmlreport" description="--> generates a html checkstyle report">
    <mkdir dir="${checkstyle.reportdir}"/>
    <style in="${checkstyle.raw}" style="${stylesheet.html}"
           out="${checkstyle.reportdir}/html/output.txt">
      <param name="basedir" expression="${checkstyle.basedir}"/>
    </style>
  </target>

  <target name="textreport" description="--> generates a text checkstyle report">
    <style in="${checkstyle.raw}" style="${stylesheet.text}"
           out="${checkstyle.reportdir}/report.txt">
    </style>
  </target>

  <target name="xdocreport" description="--> generates a xdoc checkstyle report">
    <style in="${checkstyle.raw}" style="${stylesheet.xdoc}"
           out="${checkstyle.reportdir}/xdocs/index.xml">
      <param name="basedir" expression="${checkstyle.basedir}"/>
    </style>
  </target>

  <target name="dumptext" depends="checkstyle, textreport" description="--> runs the checkstyle and displays result as text">
    <concat>
      <filelist dir="${checkstyle.reportdir}" files="report.txt"/>
    </concat>
  </target>

  <target name="simiancheck" description="--> runs the check for duplicates">
    <simian>
        <fileset dir="${java.dir}" />
    </simian>
  </target>

</project>