JDepend Task for Android

Posted: June 24, 2009 in AndCooper, Android, Java, Mobile
Tags:

There is somewhat a trick to get JDepend ot wokr for an Andorid Application build:


<!-- To load jdepend.properties in taskdef for jdepend -->
 <taskdef  classpathref= "reporttools.classpath" resource= "${jdependConfigFile}" />

Notice, you have to declare the path to where your jdepend.properties file is located. Once, that is done your task looks like:


<target name="jdepend.reports"  >
 <jdepend
 fork="true"
 outputfile="${inreports-folder}/${project.name}.${DSTAMP}.${TSTAMP}.jdepend.xml"
 format="xml"
 classpathref="reporttools.classpath"
 >
 <sourcespath>
<pathelement location="src"/>
 </sourcespath>

 <classespath>
<path refid="classes.dir.path"/>

 </classespath>
 </jdepend>
 <xslt basedir="${inreports-folder}" destdir="${outreports-folder}"
 includes="${project.name}.${DSTAMP}.${TSTAMP}.jdepend.xml" 
 style="${jdepend.home}/andcooper.jdepend.xsl" >
<param name="project" expression="${project}"/>
<param name="today" expression="${today}"/>

 </xslt>
 <xslt basedir="${inreports-folder}"
 destdir="${inreports-folder}"
 includes="${project.name}.${DSTAMP}.${TSTAMP}.jdepend.xml"
 extension=".dot"
 style="${jdepend.home}/jdepend2dot.xsl"/>
 <!-- need to define a path to Graphiz/dot path -->
 <apply executable="${graphviz-location}"
 dest="${outreports-folder}"
 parallel="false"
 output="${logs}/$(project.name}.${DSTAMP}.${TSTAMP}.dot-output.log"   >
 <arg value="-Tpng"/>
 <arg value="-o"/>
 <targetfile/>
 <srcfile/>
 <fileset dir="${inreports-folder}" includes="*.dot"/>
 <mapper type="glob" from="*.dot" to="*.png"/>
 </apply>
 <copy file="${inreports-folder}/${project.name}.${DSTAMP}.${TSTAMP}.jdepend.xml" tofile="${ciserver-jdepend-folder}/input/${project.name}.${DSTAMP}.${TSTAMP}.jdepend.xml"/>

 <copy file="${outreports-folder}/${project.name}.${DSTAMP}.${TSTAMP}.jdepend.html" tofile="${ciserver-jdepend-folder}/output/jdepend.html"/>
 <copy file="${outreports-folder}/${project.name}.${DSTAMP}.${TSTAMP}.jdepend.png" tofile="${ciserver-jdepend-folder}/output/jdepend.png"/>
 <emit message="jdepend report generated and transformed to html"/>
 </target>

Nice and simple.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s