4j.sanity4j.1.1.1.source-code.sanity4j-qa-test.xml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sanity4j Show documentation
Show all versions of sanity4j Show documentation
Sanity4J was created to simplify running multiple static code
analysis tools on the Java projects. It provides a single entry
point to run all the selected tools and produce a consolidated
report, which presents all findings in an easily accessible
manner.
The newest version!
<?xml version="1.0"?> <!-- ******************************************************************* ** ** NAME ** sanity4j-qa-test.xml ** ** PURPOSE ** This file is an XML (eXtensible Markup Language) file used to define ** an Apache ANT (http://ant.apache.org) library. ** ** This set of macros perform code quality assurance tests using ** various third party tools. ** ** USAGE ** Ensure that you are running at least Java 1.5, as some of the tools ** don't work on 1.4 or earlier VMs. ** ** Within a project's build.xml file, include the following line: ** ** <typedef ** resource ="sanity4j-qa-test.xml" ** classpath ="sanity4j.jar"/> ** ** MACROS ** sanity4j.run - Runs the QA tools against a project ** ** AUTHOR ** Yiannis Paschalidis, 2008. ** ******************************************************************** --> <antlib> <!-- *************************************************************** ** TYPE DEFINITIONS **************************************************************** --> <!-- No types --> <!-- *************************************************************** ** TASK DEFINITIONS **************************************************************** --> <!-- *************************************************************** ** This runs the QA tools against a project and produces the raw ** output that is used to generate the reports. Projects should use ** the sanity4j.run macro instead. ** ** The QA tools are run using java code rather than a macro as ** - the ant Tasks for tools use different types (e.g. not all allow FileSets) ** - Most tools don't support multiple source directories ** - It's less of a pain for an end user to set a few top-level directories ** and let the task figure out what the source/class paths should be. ** **************************************************************** --> <typedef name="sanity4j.runtask" classname="net.sf.sanity4j.ant.taskdef.RunQA"/> <!-- *************************************************************** ** MACRO DEFINITIONS **************************************************************** --> <!-- *************************************************************** ** This runs the QA tools against a project and produces reports that ** can be published on a webserver. ** ** Attributes: ** ** products.dir ** ** The location of the products vob containing the QA tools ** (FindBugs, PMD, CheckStyle, etc.) ** ** report.dir ** ** The report output directory. Subdirectories will be created ** for each type of report. ** ** cobertura.data.file [optional] ** ** A cobertura data file (e.g. cobertura.ser) if you want to ** include unit testing coverage data in your report. ** ** summary.data.file [optional] ** ** The location of a (persitent) file to store summary data, if ** you want to include trend graphs in your report. ** ** include.tool.output [optional] ** ** If set to "true", the raw tool output is also copied to the ** report directory. ** ** java.runtime [optional] ** ** The location of the java executable; 1.5 or later. ** ** Elements: ** ** source.path ** ** This element accepts nested Paths pointing to ** the location of *this* project's source only. ** If you have multiple source directories contained within ** a main directory, you can just list the main directory ** here - the task will search for all source directories. ** ** class.path ** ** This element accepts nested Paths pointing to ** the location of *this* project's built classes/jars only ** ** library.path ** ** This element accepts nested Paths pointing to ** the location of jars/classes that this project depends on. ** Don't use the whole products_vob, use the products directory ** in the project that only contains symlinks to the libaries ** that the project depends on to compile. ** ** EXAMPLE: ** ** <sanity4j.run ** products.dir="${component.rootdir}/../products" ** report.dir="${build.dir}/reports"> ** ** <source.path> ** <path path="${component.rootdir}"/> ** </source.path> ** <class.path> ** <path path="${build.dir}/libs"/> ** </class.path> ** <library.path> ** <path> ** <fileset dir="${component.rootdir}/products"> ** <exclude name="WebSphere_6.0/**"/> ** </fileset> ** </path> ** </library.files> ** </sanity4j.run> ** **************************************************************** --> <macrodef name="sanity4j.run"> <attribute name="products.dir"/> <attribute name="report.dir"/> <attribute name="cobertura.data.file" default=""/> <attribute name="summary.data.file" default=""/> <attribute name="java.runtime" default="java"/> <attribute name="include.tool.output" default="false"/> <element name="source.path"/> <element name="class.path"/> <element name="library.path"/> <sequential> <!-- delete all old data/reports --> <delete dir="@{report.dir}" failonerror="false" /> <mkdir dir="@{report.dir}" /> <!-- generate the raw output --> <echo message="Performing QA analysis"/> <sanity4j.runtask productsDir="@{products.dir}" reportDir="@{report.dir}" coberturaDataFile="@{cobertura.data.file}" summaryDataFile="@{summary.data.file}" javaRuntime="@{java.runtime}" includeToolOutput="@{include.tool.output}"> <sourcepath> <source.path/> </sourcepath> <classpath> <class.path/> </classpath> <librarypath> <library.path/> </librarypath> </sanity4j.runtask> </sequential> </macrodef> </antlib>