Hi peeps,

is it a good idea to integrate jalopy into our build? Attached two files that make it possible. Get the jars from jalopy.sf.net, put them in ant/lib or avalon/lib and it'll work.

- Leo
<?xml version="1.0"?>

<!--
==============================================================================
 Avalon build file: source beautification using jalopy
==============================================================================
You need ant 1.5 or later and forrest 0.2 or later installed in order to
build avalon from source. See:

http://ant.apache.org/
http://xml.apache.org/forrest/

type `ant -projecthelp` for more info

Legal:
  Copyright (c) 1999-2003 The Apache Software Foundation. All Rights Reserved.
==============================================================================
-->

<project name="Avalon Framework Formatting" default="jalopy" basedir=".">
    <property name="project.home" value="${basedir}"/>
    <!--
      Give user a chance to override without editing this file
      (and without typing -D each time he compiles it)
    -->
    <property file="ant.properties"/>
    <property file="${user.home}/.ant.properties"/>

    <property name="name" value="avalon"/>
    <property name="Name" value="Avalon"/>
    <property name="framework.name" value="avalon-framework"/>
    <property name="version" value="4.1.4"/>
    <property name="year" value="1999-2003"/>
    <property name="status" value="final"/>
    <property name="release" value="5th"/>
    <property name="short.version" value="4.1"/>

    <property name="debug" value="on"/>
    <property name="optimize" value="off"/>
    <property name="deprecation" value="off"/>
    <property name="compress.jars" value="true"/>

    <!-- Set the properties for intermediate directory -->
    <property name="target.dir" value="target"/>
    <property name="target.lib" value="${target.dir}/lib"/>
    <property name="target.src" value="${target.dir}/src"/>
    <property name="target.conf" value="${target.dir}/conf"/>
    <property name="target.classes" value="${target.dir}/classes"/>
    <property name="target.javadocs" value="${target.dir}/javadocs"/>
    <property name="target.docs" value="${target.dir}/docs"/>
    <property name="target.testdocs" value="${target.docs}/test"/>
    <property name="target.reports" value="${target.dir}/reports"/>

    <!-- Set the properties for source directories -->
    <property name="src.dir" value="src"/>
    <property name="java.dir" value="${src.dir}/java"/>
    <property name="test.dir" value="${src.dir}/test"/>
    <property name="conf.dir" value="${src.dir}/conf"/>
    <property name="xdocs.dir" value="${src.dir}/xdocs"/>
    <property name="lib.dir" value="lib"/>
    <property name="tools.dir" value="tools"/>
    <property name="docs.dir" value="docs"/>
    <property name="www.dir" value="../avalon-site/site/framework"/>
    <property name="javadocs.dir" value="${docs.dir}/api"/>
    <property name="context.dir" value="${src.dir}/documentation"/>

    <property name="dist.name" value="${Name}-${version}"/>
    <property name="dist.base" value="distributions"/>

    <property name="tools.jar" value="${java.home}/../lib/tools.jar"/>

    <path id="project.class.path">
        <pathelement path="${java.class.path}" />
        <fileset dir="${lib.dir}">
            <include name="*.jar" />
        </fileset>
        <pathelement path="${target.classes}" />
    </path>

    <path id="tools.class.path">
        <path refid="project.class.path"/>
        <pathelement location="${tools.jar}"/>
    </path>

    <path id="test.class.path">
        <path refid="tools.class.path"/>
        <path refid="project.class.path"/>
    </path>

    <!-- Set up properties -->
    <target name="setup-properties">
        <property name="dist.dir" value="${dist.base}/${dist.name}"/>
        <property name="dist.bin" value="${dist.dir}/bin"/>
        <property name="dist.apps" value="${dist.dir}/apps"/>
        <property name="dist.lib" value="${dist.dir}/lib"/>
        <property name="dist.docs" value="${dist.dir}/docs"/>
        <property name="dist.javadocs" value="${dist.dir}/docs/api"/>

        <property name="src.dist.dir" value="${dist.name}-src"/>
        <property name="src.dist.src" value="${src.dist.dir}/src"/>
        <property name="src.dist.docs" value="${src.dist.dir}/docs"/>
        <property name="src.dist.javadocs" value="${src.dist.dir}/docs/api"/>
        <property name="src.dist.lib" value="${src.dist.dir}/lib"/>
        <property name="src.dist.tools" value="${src.dist.dir}/tools"/>
    </target>

    <!-- Prepares the build directory -->
    <target name="prepare">
        <tstamp/>
        <mkdir dir="${target.src}"/>
    </target>

    <target name="jalopy" description="Runs Jalopy Code Formatter" depends="setup-properties,prepare">
        <!-- this invocation of jalopy requires that jalopy be downloaded and setup -->
	<taskdef name="jalopy"
        	   classname="de.hunsicker.jalopy.plugin.ant.AntPlugin"/>
      <!--

      Invokes Jalopy as follows:

      - All formatted files will have unix fileformat (\n)
      - Load your code convention from the given url
      - Override the convention to use the file history feature
      - Override the convention to use alder32 checksums of files for history testing
      - Override the convention to use loglevel "info"
      - Override the convention to use 2 threads
      - The import optimization feature will work (if enabled in the active
        convention), because a classpath reference is specified

        Don't forget to setup an include pattern as Jalopy truly expects
        valid Java source files as input!

      -->
    <jalopy fileformat="unix"
            convention="jalopy-conventions.xml"
            history="none"
            loglevel="info"
            threads="2"
            classpathref="project.class.path"
	    destdir="${target.src}"
	    force="yes">
      <fileset dir="${java.dir}">
        <include name="**/*.java" />
      </fileset>
    </jalopy>

    <echo/>
    <echo message="now replacing blah(  ) with blah()..."/>
    <echo/>
	<replaceregexp byline="true">
		<regexp pattern="\(  \)"/>
		<substitution expression="()"/>
		<fileset dir="${target.src}">
			<include name="**/*.java"/>
		</fileset>
	</replaceregexp>
	<replaceregexp byline="true">
		<regexp pattern="@year@"/>
		<substitution expression="1997-2003"/>
		<fileset dir="${target.src}">
			<include name="**/*.java"/>
		</fileset>
	</replaceregexp>
    <echo message="Reformatted sources in ${target.src}"/>
    </target>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<jalopy>
    <general>
        <compliance>
            <version>13</version>
        </compliance>
        <style>
            <description>Avalon Java Coding Convention</description>
            <name>Avalon</name>
        </style>
    </general>
    <inspector>
        <enable>false</enable>
        <naming>
            <classes>
                <abstract>[A-Z][a-zA-Z0-9]+</abstract>
                <general>[A-Z][a-zA-Z0-9]+</general>
            </classes>
            <fields>
                <default>[a-z][\w]+</default>
                <defaultStatic>[a-z][\w]+</defaultStatic>
                <defaultStaticFinal>[a-zA-Z][\w]+</defaultStaticFinal>
                <private>[a-z][\w]+</private>
                <privateStatic>[a-z][\w]+</privateStatic>
                <privateStaticFinal>[a-zA-Z][\w]+</privateStaticFinal>
                <protected>[a-z][\w]+</protected>
                <protectedStatic>[a-z][\w]+</protectedStatic>
                <protectedStaticFinal>[a-zA-Z][\w]+</protectedStaticFinal>
                <public>[a-z][\w]+</public>
                <publicStatic>[a-z][\w]+</publicStatic>
                <publicStaticFinal>[a-zA-Z][\w]+</publicStaticFinal>
            </fields>
            <interfaces>[A-Z][a-zA-Z0-9]+</interfaces>
            <labels>\w+</labels>
            <methods>
                <default>[a-z][\w]+</default>
                <defaultStatic>[a-z][\w]+</defaultStatic>
                <defaultStaticFinal>[a-z][\w]+</defaultStaticFinal>
                <private>[a-z][\w]+</private>
                <privateStatic>[a-z][\w]+</privateStatic>
                <privateStaticFinal>[a-z][\w]+</privateStaticFinal>
                <protected>[a-z][\w]+</protected>
                <protectedStatic>[a-z][\w]+</protectedStatic>
                <protectedStaticFinal>[a-z][\w]+</protectedStaticFinal>
                <public>[a-z][\w]+</public>
                <publicStatic>[a-z][\w]+</publicStatic>
                <publicStaticFinal>[a-z][\w]+</publicStaticFinal>
            </methods>
            <packages>[a-z]+(?:\.[a-z]+)*</packages>
            <parameters>
                <default>[a-z][\w]+</default>
                <final>[a-z][\w]+</final>
            </parameters>
            <variables>[a-z][\w]*</variables>
        </naming>
        <tips>
            <adhereToNamingConvention>false</adhereToNamingConvention>
            <alwaysOverrideEquals>false</alwaysOverrideEquals>
            <alwaysOverrideHashCode>false</alwaysOverrideHashCode>
            <avoidThreadGroups>false</avoidThreadGroups>
            <declareCollectionComment>false</declareCollectionComment>
            <dontIgnoreExceptions>false</dontIgnoreExceptions>
            <dontSubstituteObjectEquals>false</dontSubstituteObjectEquals>
            <neverDeclareException>false</neverDeclareException>
            <neverDeclareThrowable>false</neverDeclareThrowable>
            <neverInvokeWaitOutsideLoop>false</neverInvokeWaitOutsideLoop>
            <neverReturnZeroArrays>false</neverReturnZeroArrays>
            <neverUseEmptyFinally>false</neverUseEmptyFinally>
            <obeyContractEquals>false</obeyContractEquals>
            <overrideToString>false</overrideToString>
            <referToObjectsByInterface>false</referToObjectsByInterface>
            <replaceStructureWithClass>false</replaceStructureWithClass>
            <stringLiterallI18n>false</stringLiterallI18n>
            <useInterfaceOnlyForTypes>false</useInterfaceOnlyForTypes>
            <wrongCollectionComment>false</wrongCollectionComment>
        </tips>
    </inspector>
    <internal>
        <version>6</version>
    </internal>
    <messages>
        <priority>
            <general>30000</general>
            <parser>30000</parser>
            <parserJavadoc>30000</parserJavadoc>
            <printer>30000</printer>
            <printerJavadoc>30000</printerJavadoc>
            <transform>30000</transform>
        </priority>
        <showErrorStackTrace>true</showErrorStackTrace>
    </messages>
    <misc>
        <threadCount>1</threadCount>
    </misc>
    <printer>
        <alignment>
            <methodCallChain>false</methodCallChain>
            <parameterMethodDeclaration>false</parameterMethodDeclaration>
            <ternaryOperator>false</ternaryOperator>
            <variableAssignment>false</variableAssignment>
            <variableIdentifier>false</variableIdentifier>
        </alignment>
        <backup>
            <directory>bak</directory>
            <level>1</level>
        </backup>
        <blanklines>
            <after>
                <block>1</block>
                <braceLeft>0</braceLeft>
                <class>1</class>
                <declaration>0</declaration>
                <footer>1</footer>
                <header>0</header>
                <interface>1</interface>
                <lastImport>2</lastImport>
                <method>1</method>
                <package>1</package>
            </after>
            <before>
                <block>1</block>
                <braceRight>0</braceRight>
                <caseBlock>1</caseBlock>
                <comment>
                    <javadoc>1</javadoc>
                    <multiline>1</multiline>
                    <singleline>1</singleline>
                </comment>
                <controlStatement>1</controlStatement>
                <declaration>1</declaration>
                <footer>0</footer>
                <header>0</header>
            </before>
            <keepUpTo>1</keepUpTo>
        </blanklines>
        <braces>
            <empty>
                <cuddle>false</cuddle>
                <insertStatement>true</insertStatement>
            </empty>
            <insert>
                <dowhile>true</dowhile>
                <for>true</for>
                <ifelse>true</ifelse>
                <while>true</while>
            </insert>
            <remove>
                <block>true</block>
                <dowhile>false</dowhile>
                <for>false</for>
                <ifelse>false</ifelse>
                <while>false</while>
            </remove>
            <treatDifferent>
                <methodClass>false</methodClass>
                <methodClassIfWrapped>false</methodClassIfWrapped>
            </treatDifferent>
        </braces>
        <chunks>
            <blanklines>true</blanklines>
            <comments>true</comments>
        </chunks>
        <comments>
            <format>
                <multiline>true</multiline>
            </format>
            <javadoc>
                <check>
                    <innerclass>false</innerclass>
                    <tags>false</tags>
                    <throwsTags>true</throwsTags>
                </check>
                <fieldsShort>true</fieldsShort>
                <generate>
                    <class>23</class>
                    <constructor>23</constructor>
                    <field>0</field>
                    <method>23</method>
                </generate>
                <parseComments>false</parseComments>
                <tags>
                    <in-line />
                    <standard />
                </tags>
                <templates>
                    <class>/**| * | *| * @author $author$| * @version CVS $Revision$ $Date$| */</class>
                    <constructor>
                        <bottom> */</bottom>
                        <exception> * @throws $exceptionType$ exception</exception>
                        <param> * @param $paramType$ param</param>
                        <top>/**| * Creates a new $objectType$ object.</top>
                    </constructor>
                    <interface>/**| * | *| * @author $author$| * @version CVS $Revision$ $Date$| */</interface>
                    <method>
                        <bottom> */</bottom>
                        <exception> * @throws $exceptionType$ exception</exception>
                        <param> * @param $paramType$ param</param>
                        <return> * @return value</return>
                        <top>/**| * </top>
                    </method>
                    <variable>/** blah */</variable>
                </templates>
            </javadoc>
            <remove>
                <javadoc>false</javadoc>
                <multiline>false</multiline>
                <singleline>false</singleline>
            </remove>
            <separator>
                <fillCharacter>-</fillCharacter>
                <insert>false</insert>
                <insertRecursive>false</insertRecursive>
                <text>
                    <class>Inner Classes</class>
                    <constructor>Constructors</constructor>
                    <field>Instance fields</field>
                    <initializer>Instance initializers</initializer>
                    <interface>Inner Interfaces</interface>
                    <method>Methods</method>
                    <static>Static fields/initializers</static>
                </text>
            </separator>
        </comments>
        <environment />
        <footer>
            <keys />
            <smartMode>0</smartMode>
            <use>false</use>
        </footer>
        <header>
            <keys/>
            <smartMode>0</smartMode>
            <use>false</use>
        </header>
        <history>
            <policy>disabled</policy>
        </history>
        <imports>
            <grouping>
                <defaultDepth>3</defaultDepth>
                <packages>*:0|gnu:2|java:2|javax:2</packages>
            </grouping>
            <policy>expand</policy>
            <sort>true</sort>
        </imports>
        <indentation>
            <caseFromSwitch>true</caseFromSwitch>
            <continuation>
                <block>true</block>
                <operator>false</operator>
            </continuation>
            <firstColumnComments>true</firstColumnComments>
            <label>false</label>
            <policy>
                <deep>true</deep>
            </policy>
            <sizes>
                <braceCuddled>1</braceCuddled>
                <braceLeft>0</braceLeft>
                <braceRight>0</braceRight>
                <braceRightAfter>0</braceRightAfter>
                <continuation>8</continuation>
                <deep>55</deep>
                <extends>8</extends>
                <general>4</general>
                <implements>8</implements>
                <leading>0</leading>
                <tabs>4</tabs>
                <throws>8</throws>
                <trailingComment>1</trailingComment>
            </sizes>
            <tabs>
                <enable>false</enable>
                <onlyLeading>false</onlyLeading>
            </tabs>
        </indentation>
        <misc>
            <arrayBracketsAfterIdent>false</arrayBracketsAfterIdent>
            <forceFormatting>false</forceFormatting>
            <insertExpressionParentheses>true</insertExpressionParentheses>
            <insertLoggingConditional>false</insertLoggingConditional>
            <insertTrailingNewline>true</insertTrailingNewline>
            <insertUID>false</insertUID>
        </misc>
        <sorting>
            <declaration>
                <class>true</class>
                <constructor>true</constructor>
                <enable>true</enable>
                <interface>true</interface>
                <method>true</method>
                <order>static|field|initializer|constructor|method|interface|class</order>
                <variable>true</variable>
            </declaration>
            <modifier>
                <enable>true</enable>
                <order>public|protected|private|abstract|static|final|synchronized|transient|volatile|native|strictfp</order>
            </modifier>
        </sorting>
        <whitespace>
            <after>
                <comma>true</comma>
                <semicolon>true</semicolon>
                <typeCast>false</typeCast>
            </after>
            <before>
                <braces>true</braces>
                <brackets>false</brackets>
                <bracketsTypes>false</bracketsTypes>
                <caseColon>false</caseColon>
                <operator>
                    <not>false</not>
                </operator>
                <parentheses>
                    <methodCall>false</methodCall>
                    <methodDeclaration>false</methodDeclaration>
                    <statement>false</statement>
                </parentheses>
            </before>
            <padding>
                <braces>true</braces>
                <brackets>false</brackets>
                <operator>
                    <assignment>true</assignment>
                    <bitwise>true</bitwise>
                    <logical>true</logical>
                    <mathematical>true</mathematical>
                    <relational>true</relational>
                    <shift>true</shift>
                </operator>
                <parenthesis>true</parenthesis>
                <typeCast>false</typeCast>
            </padding>
        </whitespace>
        <wrapping>
            <always>
                <after>
                    <arrayElement>2147483647</arrayElement>
                    <braceRight>true</braceRight>
                    <extendsTypes>false</extendsTypes>
                    <implementsTypes>false</implementsTypes>
                    <label>true</label>
                    <methodCallChained>false</methodCallChained>
                    <ternaryOperator>
                        <first>false</first>
                        <second>false</second>
                    </ternaryOperator>
                    <throwsTypes>false</throwsTypes>
                </after>
                <before>
                    <braceLeft>true</braceLeft>
                    <extends>false</extends>
                    <implements>false</implements>
                    <throws>false</throws>
                </before>
                <parameter>
                    <methodCall>false</methodCall>
                    <methodCallNested>false</methodCallNested>
                    <methodDeclaration>false</methodDeclaration>
                </parameter>
            </always>
            <general>
                <beforeOperator>false</beforeOperator>
                <enable>true</enable>
                <lineLength>80</lineLength>
            </general>
            <ondemand>
                <after>
                    <assignment>true</assignment>
                    <leftParenthesis>false</leftParenthesis>
                    <parameter>false</parameter>
                    <types>
                        <extends>true</extends>
                        <implements>true</implements>
                        <throws>true</throws>
                    </types>
                </after>
                <before>
                    <rightParenthesis>false</rightParenthesis>
                </before>
                <groupingParentheses>false</groupingParentheses>
            </ondemand>
        </wrapping>
    </printer>
</jalopy>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to