| <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.importcontroltest.file" file="config/import-control-test.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> |