pmd/pmd/maven.xml
2005-06-07 13:20:49 +00:00

87 lines
3.2 KiB
XML

<?xml version="1.0"?>
<project default="pmd:dist-bin"
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:doc="doc"
xmlns:x="jelly:xml"
xmlns:u="jelly:util"
xmlns:maven="jelly:org.apache.maven.jelly.tags.project.MavenTagLibrary">
<preGoal name="site">
<attainGoal name="pmd:rulesets-index"/>
<attainGoal name="pmd:ruleset-docs"/>
<attainGoal name="clover:on"/>
</preGoal>
<goal name="pmd:ruleset-docs" description="Generates rulesets documentation">
<mkdir dir="${maven.gen.docs}/rules" />
<ant:fileScanner var="rulesetFiles">
<ant:fileset dir="${rulesets.dir}/" includes="*.xml"/>
</ant:fileScanner>
<j:forEach var="file" items="${rulesetFiles.iterator()}">
<echo message="Processing ${file}"/>
<doc:jslFile
input="${file}"
stylesheet="etc/jsl/rule-format.jsl"
output="${maven.gen.docs}/rules/${file.name}"/>
</j:forEach>
</goal>
<goal name="pmd:dist-bin" description="Build binary distribution archive">
<attainGoal name="site:generate"/>
<attainGoal name="jar:jar"/>
<j:set var="dist.bin.dir" value="${maven.build.dir}/pmd-${pom.currentVersion}"/>
<ant:mkdir dir="${dist.bin.dir}"/>
<ant:copy todir="${dist.bin.dir}">
<ant:fileset dir="." includes="lib/*jar"/>
<ant:fileset dir="${maven.build.dir}" includes="docs/**"/>
</ant:copy>
<ant:fileset dir="." includes="etc/**" excludes="CVS"/>
<ant:copy todir="${dist.bin.dir}/lib">
<ant:fileset dir="${maven.build.dir}" includes="${maven.final.name}.jar"/>
</ant:copy>
<ant:chmod perm="uga+x">
<ant:fileset dir="${dist.bin.dir}/etc" includes="*.sh"/>
</ant:chmod>
<ant:zip basedir="${dist.bin.dir}" destfile="${dist.bin.dir}.zip"/>
<echo>******************************************************************</echo>
<echo>* </echo>
<echo>* Binary distribution built in ${dist.bin.dir}</echo>
<echo>* </echo>
<echo>* packaged into ${dist.bin.dir}.zip </echo>
<echo>* </echo>
</goal>
<goal name="pmd:rulesets-index" description="Generate a document with links to all available rulesets">
<mkdir dir="${maven.gen.docs}/rules" />
<ant:fileScanner var="rulesetFiles">
<ant:fileset dir="${rulesets.dir}/" includes="*.xml"/>
</ant:fileScanner>
<echo message="Merging rulesets files"/>
<j:set var="mergedrulesfile" value="${maven.build.dir}/mergedrules.xml"/>
<j:set var="buf"/>
<j:forEach var="file" items="${rulesetFiles.iterator()}">
<u:loadText var="b" file="${file}"/>
<j:set var="buf" value="${buf}${b}"/>
</j:forEach>
<j:set var="buf" value="&lt;rulesets&gt;${buf}&lt;/rulesets&gt;"/>
<j:file name="${mergedrulesfile}" escapeText="false">${buf}</j:file>
<echo message="Merged rulesets into ${mergedrulesfile}"/>
<!-- TODO this is a truly dirty solution but I couldn't come
with anything better now... -->
<ant:replace file="${mergedrulesfile}" token='&lt;?xml version="1.0"?&gt;'/>
<doc:jslFile
input="${mergedrulesfile}"
stylesheet="etc/jsl/rules-index.jsl"
output="${maven.gen.docs}/rules/index.xml"/>
</goal>
</project>