ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rob...@elastica.com
Subject Re: PMD and Checkstyle rules.
Date Tue, 04 Oct 2005 21:09:48 GMT
In this case this seems to have done the trick

<target name="pmd_init" depends="init">
  <uptodate property="pmd.unnecessary">
      <srcfiles dir="${src.dir}" includes="**/*.java"/>
      <mapper type="merge" to="${lib.dir}/pmd/pmd_report.xml"/>
  </uptodate> 
</target>

<target name="pmd" depends="pmd_init" unless="pmd.unnecessary">
    <path id="pmd.classpath">
      <fileset dir="${pmd.dir}/lib">
        <include name="*.jar"/>
      </fileset>
    </path>   
    <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"
classpathref="pmd.classpath"/>
    <mkdir dir="${lib.dir}/pmd"/>  
    <pmd rulesetfiles="rulesets/favorites.xml">
        <formatter type="xml" toFile="${lib.dir}/pmd/pmd_report.xml"/>
        <fileset dir="${src.dir}" includes="**/*.java"/>
    </pmd>   
    <xslt in="${lib.dir}/pmd/pmd_report.xml"
style="${pmd.dir}/etc/xslt/wz-pmd-report.xslt"
out="${lib.dir}/pmd/pmd_report.html"/>
</target>


Quoting robert@elastica.com:

> So whilst I understand how to use <uptodate> to determine whether .class
> files
> are in sync with .java file etc. How do you do this when you have say a PMD
> or
> checkstyle producing less files than there are classes and you want to only
> reparse the source trees if in fact source has been changed since you last
> ran
> PMD. even if you've compiled since. Then basically have you compare the
> dates
> of the PMD xml file and the dates of all the source files. If any last date
> modified of a source file is more recent than the PMD xml file then you want
> to
> run PMD again. Ideally only on the file that changed but I can live with it
> needing to run it again on all files since it doesn't produce reports per
> file.
> 
> ....
> 
> How do you structure the targets when you need to compare the timestamps b/w
> two
> different arbitary sets of files?
> 
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 




----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message