
<!-- 
Script para Coleta de Metricas JDepend e JavaNCSS
-->
<project name="ColetaMetricas" default="colectAll" basedir=".">
   	<taskdef name="javancss" classname="javancss.JavancssAntTask"/>   
	<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
   
   	<property name="metrics.dir" value="metricas"/>
   	<property name="metrics.dir.oo" value="${metrics.dir}/oo"/>
   	<property name="metrics.dir.code" value="${metrics.dir}/code"/>
   	<property name="metrics.dir.quality" value="${metrics.dir}/quality"/>
   	<property name="java.source" value="hibernate/src"/>
   	<property name="java.classes" value="hibernate/bin"/>
	<property name="xsl.dir" value="xsl"/>
	<property name="pmdrules.dir" value="pmd"/>
	
	<target name="init">
		<mkdir dir="${metrics.dir.oo}"/>
		<mkdir dir="${metrics.dir.code}"/>
		<mkdir dir="${metrics.dir.quality}"/>
	</target>

   <!-- JavaNCSS -->
   <target name="codeMetrics" >
      <javancss srcdir="${java.source}"
            generateReport="true"
            outputfile="${metrics.dir.code}/code.xml"
            format="xml"/>

      <style basedir="${metrics.dir.code}" destdir="${metrics.dir.code}"
       extension=".html" style="${xsl.dir}/javancss2html.xsl"/>
   </target>

   <!-- JDepend -->
   <target name="ooMetrics" >
      <jdepend outputfile="${metrics.dir.oo}/oo.xml" format="xml">
        <classespath>
            <pathelement location="${java.classes}"/>
        </classespath>
     </jdepend>          
     
     <style basedir="${metrics.dir.oo}" destdir="${metrics.dir.oo}"
       extension=".html" style="${xsl.dir}/jdepend.xsl"/>
   </target>

   	 <!-- PMD - quality metrics -->
	<target name="qualityMetrics" depends="init">
	    <pmd rulesetfiles="rulesets/basic.xml,rulesets/design.xml">
	        <formatter type="html" toFile="${metrics.dir.quality}/quality.html"/>
	        <fileset dir="${java.source}">
	            <include name="**/*.java"/>
	        </fileset>
	    </pmd>
	</target>
   
   
   <target name="colectAll" depends="init, ooMetrics, codeMetrics"/>

</project>
