ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eli Kay <elialexander...@yahoo.com>
Subject Re: Ant task extensions / contributions
Date Tue, 13 Mar 2001 13:18:11 GMT
Hi Stefan,

> > Is there a collection of contributed tasks?
> 
> Yes and no. 
> 
> Many tasks have been sent to this list and many but
> not all of them
> now live in Ant's CVS module as optional tasks.
> Furthermore, we'll
> probably start a separate CVS module for contributed
> stuff, but don't
> hold your breath.

On the subject of contributed tasks: Do think there
would be any interest in a task I recently created
that generates Java source code for a simple bean? 
The task reads a comma delimited file with two
columns. The second column lists the names of the
simple bean's properties and the first column lists
the data type of each property.  I use this task to
rapidly create useBeans. It outputs the Java source
code with a package statement, import statements,
properties and the getters and setters.  

The task has 4 attributes: the comma delimited source
file; a semi colon delimited list of import
statements; the full class name of the Java source
code to be generated (the directory structure is
parsed and becomes the package statement of the source
code); and the directory to which the generated Java
source code is saved.

I attached 3 files as a sample: a csv file (called
"account.csv"), the task source code (called
"BeanCodeGenerator") and the output source code
(called "account.java").

Here is contents of the build file:

 <project name="MyProject" default="compile" 
     basedir="G:/mycode">

     <taskdef name="generatebeancode"
         classname="util.BeanCodeGenerator"/>

     <property name="src" value="./src"/>
     <property name="build" value="build"/>

     <target name="prepare">
    	 <mkdir dir="${build}"/>
     </target>

    <target name="compile" depends="prepare">
        <javac srcdir="${src}" includes="util/**" 
            destdir="${build}"/>
    </target>

    <target name="codegenexample">
        <generatebeancode
            sourcefile="${basedir}
               \src\codegensrc\account.csv"
            imports="java.util.*;java.io.*"
            fullclassname="myproject.account"
            outputdirectory="${basedir}\src\myproject"
        />
    </target>

</project>






__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices.
http://auctions.yahoo.com/
Mime
View raw message