<project name="pmdtasktest">

    <property name="pmd.home" value="${user.dir}" />
    <property name="src" value="src/main/java" />

    <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" />

    <target name="testBasic">
        <pmd rulesetfiles="${pmd.home}/src/test/resources/rulesets/dummy/basic.xml" />
    </target>

    <target name="testInvalidLanguageVersion">
        <pmd rulesetfiles="${pmd.home}/src/test/resources/rulesets/dummy/basic.xml">
            <sourceLanguage name="java" version="42" />
        </pmd>
    </target>

    <target name="testFormatterWithNoToFileAttribute">
        <pmd rulesetfiles="${pmd.home}/src/test/resources/rulesets/dummy/basic.xml">
            <formatter />
        </pmd>
    </target>

    <target name="testNoRuleSets">
        <pmd />
    </target>

    <target name="testRelativizeWith">
        <pmd noCache="true">
            <!-- note: this ruleset is in pmd-core/src/test/resources -->
            <ruleset>rulesets/dummy/basic.xml</ruleset>
            <formatter type="text" toFile="${pmd.home}/target/pmd-ant-test.txt" />
            <fileset dir="${pmd.home}/src/test/resources/net/sourceforge/pmd/ant/">
                <include name="**/*dummy"/>
            </fileset>
            <relativizePathsWith>
                <pathelement location="${pmd.home}/src/test/resources/net/sourceforge/pmd/ant"/>
            </relativizePathsWith>
        </pmd>
    </target>

    <target name="testXmlFormatter">
        <pmd noCache="true">
            <!-- note: this ruleset is in pmd-core/src/test/resources -->
            <ruleset>rulesets/dummy/basic.xml</ruleset>
            <formatter type="xml" toFile="${pmd.home}/target/pmd-ant-xml.xml" />
            <fileset dir="${pmd.home}/src/test/resources/net/sourceforge/pmd/ant/src">
                <include name="**/*dummy"/>
            </fileset>
            <relativizePathsWith>
                <pathelement location="${pmd.home}/src/test/resources/net/sourceforge/pmd/ant/src"/>
            </relativizePathsWith>
        </pmd>
    </target>
</project>
