Nelz's Blog

Mah blogginess

Code-Formatter Snippet

...
<target name="format.code">
<property name="common.view"    value="//some/depot/path/..." />
<property name="compile.dir"    value="${project.dir}" />
<path id="jalopy.path">
<pathelement location="${jar.dir}/aelfred-1.2.jar"/>
<pathelement location="${jar.dir}/jalopy-1.0b11.jar"/>
<pathelement location="${jar.dir}/jalopy-ant-0.6.2.jar"/>
<pathelement location="${jar.dir}/jaxp-1.2.jar"/>
<pathelement location="${jar.dir}/jdom-1.0b8.jar"/>
<pathelement location="${jar.dir}/log4j-1.2.6.jar"/>
<pathelement location="${jar.dir}/oro-2.0.6.jar"/>
<pathelement location="${jar.dir}/sax-2.0.1.jar"/>
</path>
<taskdef classpathref="jalopy.path" name="jalopy"
classname="de.hunsicker.jalopy.plugin.ant.AntPlugin"/>
<!-- Get the latest from Perforce -->
<p4sync view="${common.view}" force="true" />
<!-- Get a Perforce changelist -->
<p4change description="Jalopy-ize the Java code." />
<!-- Open up EVERY file for editing purposes -->
<p4edit view="${common.view}" change="${p4.change}" />
<!-- Actually run Jalopy on the java files now.  -->
<jalopy loglevel="info" threads="2" >
<fileset dir="${compile.dir}">
<include name="**/*.java" />
</fileset>
</jalopy>
<!-- Revert any file that was not changed -->
<p4revert change="${p4.change}" revertonlyunchanged="true"/>
<!-- Actually submit the changes to the Perforce server -->
<p4submit change="${p4.change}"/>
</target>
...