aboutsummaryrefslogtreecommitdiff
path: root/config/build.xml
blob: 18db86a12163a82b3cff35e16b4c713c24ff7f8d (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
84
85
86
87
88
<project name="checkstyle" default="checkstyle.checkstyle" basedir=".">
  <!-- Building by ANT is no longer formerly supported. Use Maven instead!! -->

  <!-- set global properties for this build -->
  <property name="target.dir" value="${basedir}/target" />
  <property name="version" value="5.4-SNAPSHOT" />
  <property name="checkstyle.dir"
            value="src/checkstyle/com/puppycrawl/tools/checkstyle" />

  <!-- override using -Dgui.target= if you wish to load a source file from startup -->
  <property name="gui.target" value=""/>

  <path id="run.classpath">
    <pathelement location="${target.dir}/checkstyle-${version}-all.jar"/>
  </path>

  <target name="checkstyle.checkstyle"
          description="Runs checkstyle against it's own sources">
    <taskdef name="checkstyle"
             classname="com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask">
      <classpath refid="run.classpath"/>
    </taskdef>

    <property name="checkstyle.pattern.todo" value="NOTHingWillMatCH_-"/>
    <property name="check.config" location="config/checkstyle_checks.xml"/>
    <checkstyle config="${check.config}"
                failOnViolation="false"
                failureProperty="checkstyle.failure.property"
                >
      <fileset dir="src"
               includes="checkstyle/**/*.java,checkstyle/**/*.properties,xdocs/**/*.xml,tests/**/*Test.java"
               excludes="**/Generated*.java,**/gui/*"/>
      <formatter type="plain"/>
      <formatter type="xml" toFile="${target.dir}/cs_errors.xml"/>
      <classpath refid="run.classpath"/>
      <property key="checkstyle.cache.file" file="${target.dir}/cachefile"/>
      <property key="checkstyle.header.file" file="config/java.header"/>
      <property key="checkstyle.regexp.header.file" file="config/java_regexp.header"/>
      <property key="checkstyle.importcontrol.file" file="config/import-control.xml"/>
      <property key="checkstyle.suppressions.file"
                file="config/suppressions.xml"/>
    </checkstyle>

    <fail if="checkstyle.failure.property"
          message="Checkstyle failed: ${checkstyle.failure.property}"
          />
  </target>

  <!-- Run the GUI -->
  <target name="run.gui"
          description="Run the GUI for displaying a tree">
    <java classname="com.puppycrawl.tools.checkstyle.gui.Main"
          fork="yes" classpathref="run.classpath">
          <arg line="${gui.target}"/>
    </java>
  </target>

  <target name="validate.xml"
          description="Validates checkstyle XML file">
    <xmlvalidate file="config/checkstyle_checks.xml">
      <xmlcatalog>
        <dtd
          publicId="-//Puppy Crawl//DTD Check Configuration 1.1//EN"
          location="${checkstyle.dir}/configuration_1_1.dtd"/>
      </xmlcatalog>
    </xmlvalidate>
  </target>

  <target name="checkstyle.sun_checks"
          description="Runs checkstyle using sun_checks.xml">
    <taskdef name="checkstyle"
             classname="com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask">
      <classpath refid="run.classpath"/>
    </taskdef>

    <property name="check.config" location="sun_checks.xml"/>
    <checkstyle config="${check.config}"
                failOnViolation="true"
                >
      <fileset dir="src/checkstyle"
               includes="**/*.java,**/*.properties"
               excludes="**/Generated*.java,**/gui/*"/>
      <formatter type="plain"/>
      <classpath refid="run.classpath"/>
    </checkstyle>
  </target>

</project>