You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Vijay Raghavan <vi...@netscape.com> on 2000/07/20 00:21:06 UTC

javacc task

Hi,
I saw a mail about the javacc task.
Does it work alright? If so can someone send it to me?
Thanks
Vijay


Re: Example on web page

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "BB" == Bill Brooks <wb...@lug.ee.calpoly.edu> writes:

 BB> David, When I use your example, I get the following warning:


 BB>     [javac] The implicit copying of support files by javac has
 BB> been deprecated. Use the copydir task to copy support files
 BB> explicitly.


 BB> ...can we modify the example to eliminate this?

Difficult issue here. The version of Ant David's example has been added
to (speaking of CVS version) will not issue this warning. Ant 1.1
will, but it shipped with a different example.

Stefan

Re: Example on web page

Posted by Bill Brooks <wb...@lug.ee.calpoly.edu>.
David,

When I use your example, I get the following warning:


    [javac] The implicit copying of support files by javac has been
deprecated. Use the copydir task to copy support files explicitly.


...can we modify the example to eliminate this? 

Bill


Re: Example on web page

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "DW" == David Walend <dw...@eecs.tufts.edu> writes:

 DW> Can you verify that this is OK? In my setup (Using the July 18th
 DW> 1.1 ant release) if I don't have this <include name="*.java"/>,
 DW> the javac task copies the build.xml file into the build
 DW> directory.

And you get a deprecation warning, right?

Yes, the copying of support files has been dropped after the 1.1
release.

Stefan

[Patch] Re: Example in index.html

Posted by David Walend <dw...@eecs.tufts.edu>.
No one had more suggestions in the last 22 hours. So here's my first try
at a patch. Additional changes were moving the discussion of filter syntax
after the example (which has no filters), and adding myself to the contact
list at the top. Is that premature?

Please tell me what you think.

Thanks,

Dave



Re: Example on web page

Posted by David Walend <dw...@eecs.tufts.edu>.
Thanks again for the comments. Another revision:

<project name="MyProject" default="dist" basedir=".">

  <!-- set global properties for this build -->
  <property name="src" value="." />
  <property name="build" value="build" />
  <property name="dist"  value="dist" />

  <target name="prepare">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}" />
  </target>

  <target name="compile" depends="prepare">
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}" />
  </target>

  <target name="dist" depends="compile">
    <!-- Create the ${dist}/lib directory 
       put everything in ${build} into the MyProject-${DSTAMP}.jar file-->
    <mkdir dir="${dist}/lib" />
    <jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" 
           basedir="${build}" />
  </target>

  <target name="clean">
    <!-- Delete the ${build} and ${dist} directory trees -->
    <deltree dir="${build}" />
    <deltree dir="${dist}" />
  </target>
</project>

------------------------------
Changes this time:

Hey Barrie... It's still grey! 

Changed the name of the project from "foo" to "MyProject." Is there a way
to get the project name as a property? 

Removed init target and put tstamp into prepare.

Removed the comment in the file about filtering

Removed the <include> tags (after downloading last night's build).

Decided not to add a javadoc target. I want to keep this really simple.
Barrie, perhaps one of us should update the javadoc example after this
one.

Decided to leave ${src} as "." I'm in the "build.xml is part of the source
code" school. And I want kids at home to be able to toss this file into a 
directory with some java source and get a .jar file.

Dave


Re: Example on web page

Posted by Barrie Treloar <Ba...@camtech.com.au>.
On Wed, 26 Jul 2000, David Walend wrote:

> On Wed, 26 Jul 2000, Barrie Treloar wrote:
> 
> >         - Remove <include> in javac as this should be done
> >           automatically. 
> 
> Barrie,
> 
> Can you verify that this is OK? In my setup (Using the July 18th 1.1 ant
> release) if I don't have this <include name="*.java"/>, the javac task
> copies the build.xml file into the build directory. 

As Stefan pointed out the 1.1 build still has the deprecated
functionality that copies support files from the src to the dest directory.

The problem occurs because you use:
        <property name="src" value="."/>

I would suggest that you use a directory hierarchy similar to jakarta
projects which put all source in the "src" directory.  So use

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

This will mean that it won't copy any files unless they are in the src
directory and hopefully it will only contains .java files.

Add a comment to the javac target that warns of the deprecated
behaviour.

        <!-- The javac target has deprecated behaviour which copies 
        support files from the src to the dest directories.  Use
        copydir with include/exclude values instead of the deprecated
        behaviour -->

Barrie
--
Barrie Treloar
____________________________________________________________________

  Barrie Treloar                      Phone: +61 8 8303 3300
  Senior Analyst/Programmer           Fax:   +61 8 8303 4403 
  Electronic Commerce Division        Email: barrie@camtech.com.au
  Camtech (SA) Pty Ltd                http://www.camtech.com.au
 --- Level 8, 10 Pulteney Street, Adelaide SA 5000, Australia. ---
____________________________________________________________________



Re: Example on web page

Posted by David Walend <dw...@eecs.tufts.edu>.
On Wed, 26 Jul 2000, Barrie Treloar wrote:

>         - Remove <include> in javac as this should be done
>           automatically. 

Barrie,

Can you verify that this is OK? In my setup (Using the July 18th 1.1 ant
release) if I don't have this <include name="*.java"/>, the javac task
copies the build.xml file into the build directory. 

Thanks,

Dave





Re: Example on web page

Posted by Barrie Treloar <Ba...@camtech.com.au>.
On Tue, 25 Jul 2000, David Walend wrote:

> <project name="foo" default="dist" basedir=".">
> 
>   <!-- set global properties for this build -->
>   <property name="src" value="." />
>   <property name="build" value="build" />
>   <property name="dist"  value="dist" />
> 
>   <target name="init">
>     <!-- Create the time stamp -->
>     <tstamp/>
>   </target>
> 
>   <target name="prepare" depends="init">
>     <!-- Create the build directory structure used by compile -->
>     <mkdir dir="${build}" />
>   </target>
> 
>   <target name="compile" depends="prepare">
>     <!-- Compile the java code from ${src} into ${build}
>        Use filtering to replace @version@ and @year@ marks in the code -->
>     <javac srcdir="${src}" destdir="${build}">
>       <include name="*.java"/>
>     </javac>
>   </target>
> 
>   <target name="dist" depends="compile">
>     <!-- Create the ${dist}/lib directory 
>        put everything in ${build} into the foo${DSTAMP}.jar file-->
>     <mkdir dir="${dist}/lib" />
>     <jar jarfile="${dist}/lib/foo${DSTAMP}.jar" 
>            basedir="${build}">
>       <include name="**" />
>     </jar>
>   </target>
> 
>   <target name="clean">
>     <!-- Delete the ${build} and ${dist} directory trees -->
>     <deltree dir="${build}" />
>     <deltree dir="${dist}" />
>   </target>
> </project>
> 
> -------------------

> I've left things grey. (I like grey.)

Some more comments:
        - grrr, I hate grey :)
        - Change name of project to MyProject or some such besides
          foo.
        - Remove init target and place tstamp into prepare.
        - Remove the comment in compile about use of filtering
        - Remove <include> in javac as this should be done
          automatically. 
        - Remove <include> in jar as this is should be done
          automatically.
        - Add a javadoc target?
          We do this by using the properties:

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

    <property name="build.dir" value="build" />
    <property name="build.dir.classes" value="${build.dir}/classes" />
    <property name="build.dir.javadoc" value="${build.dir}/javadoc" />

    <property name="classpath" value="your:classpath:goes:here" />
    <!-- You only need to specify the topmost package as javadoc task
    will create the correct package names for you -->
    <property name="packages" value="com.*" />    


    <target name="javadocs" depends="prepare">
      <mkdir dir="${build.dir.javadoc}" />
      <javadoc packagenames="${packages}"
               sourcepath="${src.dir}"
               destdir="${build.dir.javadoc}"
               classpath="${classpath}"
      </javadoc>
    </target>

Thanks for putting it together.

Barrie
--
Barrie Treloar
____________________________________________________________________

  Barrie Treloar                      Phone: +61 8 8303 3300
  Senior Analyst/Programmer           Fax:   +61 8 8303 4403 
  Electronic Commerce Division        Email: barrie@camtech.com.au
  Camtech (SA) Pty Ltd                http://www.camtech.com.au
 --- Level 8, 10 Pulteney Street, Adelaide SA 5000, Australia. ---
____________________________________________________________________



Re: Example on web page

Posted by David Walend <dw...@eecs.tufts.edu>.
Thanks for the feedback. Here's another rev:

<project name="foo" default="dist" basedir=".">

  <!-- set global properties for this build -->
  <property name="src" value="." />
  <property name="build" value="build" />
  <property name="dist"  value="dist" />

  <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
  </target>

  <target name="prepare" depends="init">
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}" />
  </target>

  <target name="compile" depends="prepare">
    <!-- Compile the java code from ${src} into ${build}
       Use filtering to replace @version@ and @year@ marks in the code -->
    <javac srcdir="${src}" destdir="${build}">
      <include name="*.java"/>
    </javac>
  </target>

  <target name="dist" depends="compile">
    <!-- Create the ${dist}/lib directory 
       put everything in ${build} into the foo${DSTAMP}.jar file-->
    <mkdir dir="${dist}/lib" />
    <jar jarfile="${dist}/lib/foo${DSTAMP}.jar" 
           basedir="${build}">
      <include name="**" />
    </jar>
  </target>

  <target name="clean">
    <!-- Delete the ${build} and ${dist} directory trees -->
    <deltree dir="${build}" />
    <deltree dir="${dist}" />
  </target>
</project>

-------------------

The changes from the first rev:

I switched to two space indents. (emacs' psgml kit)
I removed the filtering.
I moved the properties out of the init target and added a comment global
properties. (Will this cause less or more confusion?)
I removed clean's depends="init"
I changed the includes attributes to include tags, but left them in.
(Else, the build.xml file gets copied to the build tree.)
I've left things grey. (I like grey.)

I welcome any other feedback. Tomorrow night I hope to show my first
patch.

Thanks,

Dave



Re: Example on web page

Posted by Stefan Bodewig <bo...@bost.de>.
Hi David,

I think you should move the <property> tags out from the init target
to the projects top level as putting them into targets might raise
expectations that are not true. And don't make the clean target depend
on init for the same reasons - it doesn't really depend on it, the
<property> things - avoiding the name task here - will be evaluated
anyway.

Actually I'd put the <filter> tasks into the compile target and remove
the references to init altogether.

The includes attributes in javac and jar are superfluous (at least
since the copying of support files has been removed from javac). If
you want to keep them just to illustrate the feature, I'd prefer to
see nested <include> elements.

Stefan

[PATCH] index.html

Posted by Steve Loughran <st...@iseran.com>.
Here are the documentation changes to go with the already committed changes
to the GET task, which describes how the timestamp option works.

While adding that, I made two other edits to the document

1. added an 's' to the include=".." line in the example for Delete, so that
cut-and-paste of that example works

2. changed the URL at the beginning which points to the release copy to
point at the ant1.1 bin and source directories, instead of the zip files in
the tomcat3.1 release.

-Steve

Re: Example on web page

Posted by Barrie Treloar <Ba...@camtech.com.au>.
On Sat, 22 Jul 2000, David Walend wrote:

> <project name="foo" default="dist" basedir=".">
> 
>  <target name="init">
>   <!-- Create the time stamp, set properties and filters -->
>   <tstamp/>
>   <property name="src" value="." />
>   <property name="build" value="build" />
>   <property name="dist"  value="dist" />
>   <filter token="version" value="1.0.3" />
>   <filter token="year" value="2000" />
>  </target>
> 
>  <target name="prepare" depends="init">
>   <!-- Create the build directory structure used by compile -->
>   <mkdir dir="${build}" />
>  </target>
> 
>  <target name="compile" depends="prepare">
>   <!-- Compile the java code from ${src} into ${build}
>        Use filtering to replace @version@ and @year@ marks in the code -->
>   <javac srcdir="${src}" destdir="${build}" includes="*.java"
> filtering="on"/>
>  </target>
> 
>  <target name="dist" depends="compile">
>   <!-- Create the ${dist}/lib directory 
>        put everything in ${build} into the foo${DSTAMP}.jar file-->
>   <mkdir dir="${dist}/lib" />
>   <jar jarfile="${dist}/lib/foo${DSTAMP}.jar" 
>        basedir="${build}" 
>        includes="**"/>
>  </target>
> 
>  <target name="clean" depends="init">
>   <!-- Delete the ${build} and ${dist} directory trees -->
>   <deltree dir="${build}" />
>   <deltree dir="${dist}" />
>  </target>
> 
> </project>
> 
> I know this is an easy one, but I'd love to get some feedback before
> figuring out how to submit it to the index.html page. Specifically, I'd
> like to hear if you love or hate the comments, and if it works in other
> places. Also, I couldn't find any guidelines on XML format for
> apache/jakarta, so I winged it.

Some comments,

        - add a comment to the filter tags (like "see User Guide#Token
          Filters).  Because people are going to be cut-n-pasting they
          probably should consider removing them if they dont use
          the filtering options.  I know you have a comment in the
          compile target but they aren't linked explicitly enough for
          a newbie.

        - I would use 4 spaces as indentation but that's personal
          preference.  As an aside does anyone know of a decent XML
          mode for emacs that I can turn of XML validation for and
          will auto-indent my code?

        - Is it possible to add 'bgcolor="white"' to the body tag of
          the user guide?  I hate grey backgrounds :)

Barrie
--
Barrie Treloar
____________________________________________________________________

  Barrie Treloar                      Phone: +61 8 8303 3300
  Senior Analyst/Programmer           Fax:   +61 8 8303 4403 
  Electronic Commerce Division        Email: barrie@camtech.com.au
  Camtech (SA) Pty Ltd                http://www.camtech.com.au
 --- Level 8, 10 Pulteney Street, Adelaide SA 5000, Australia. ---
____________________________________________________________________



Re: Example on web page

Posted by David Walend <dw...@eecs.tufts.edu>.
On Thu, 20 Jul 2000 donaldp@mad.scientist.com wrote:

> 
> On Wed, 19 Jul 2000, David Walend wrote:
> 
> > Has anyone taken up revisting the example on the web page?
> 
> go for it :P

:-3 Yes, I'm a bucked-tooth newbie.

I've tried to (1) stay true to the existing example on the web page, (2)
get rid of all the deprecated calls in the example, (3) produce something
that anyone can drop into an existing java project and get a result, and
(4) make something that people (like me) who start with an example and
bend it to their will can use easily.

So here it is:

<project name="foo" default="dist" basedir=".">

 <target name="init">
  <!-- Create the time stamp, set properties and filters -->
  <tstamp/>
  <property name="src" value="." />
  <property name="build" value="build" />
  <property name="dist"  value="dist" />
  <filter token="version" value="1.0.3" />
  <filter token="year" value="2000" />
 </target>

 <target name="prepare" depends="init">
  <!-- Create the build directory structure used by compile -->
  <mkdir dir="${build}" />
 </target>

 <target name="compile" depends="prepare">
  <!-- Compile the java code from ${src} into ${build}
       Use filtering to replace @version@ and @year@ marks in the code -->
  <javac srcdir="${src}" destdir="${build}" includes="*.java"
filtering="on"/>
 </target>

 <target name="dist" depends="compile">
  <!-- Create the ${dist}/lib directory 
       put everything in ${build} into the foo${DSTAMP}.jar file-->
  <mkdir dir="${dist}/lib" />
  <jar jarfile="${dist}/lib/foo${DSTAMP}.jar" 
       basedir="${build}" 
       includes="**"/>
 </target>

 <target name="clean" depends="init">
  <!-- Delete the ${build} and ${dist} directory trees -->
  <deltree dir="${build}" />
  <deltree dir="${dist}" />
 </target>

</project>

I know this is an easy one, but I'd love to get some feedback before
figuring out how to submit it to the index.html page. Specifically, I'd
like to hear if you love or hate the comments, and if it works in other
places. Also, I couldn't find any guidelines on XML format for
apache/jakarta, so I winged it.

Thanks,

Dave



Re: Example on web page

Posted by do...@mad.scientist.com.
On Wed, 19 Jul 2000, David Walend wrote:

> Has anyone taken up revisting the example on the web page, under "Writing
> a simple buildfile" ? It's a bit dated. (I can make this a first, easy
> contribution if no one else wants it.)

go for it :P

Cheers,

Pete

*--------------------------------------------------*
| Latrobe University,     |                        |
| Bundoora, Australia     | Does the name 'Pavlov' |
| Office: PW220           |    ring a bell ?       |
| Ex: 2503                |                        |
*--------------------------------------------------*


Example on web page

Posted by David Walend <dw...@eecs.tufts.edu>.
Has anyone taken up revisting the example on the web page, under "Writing
a simple buildfile" ? It's a bit dated. (I can make this a first, easy
contribution if no one else wants it.)

Dave


Re: javacc task

Posted by do...@mad.scientist.com.
On Wed, 19 Jul 2000, Vijay Raghavan wrote:

> Thanks...
> I am a new ANT user and am loving it so far.
> Can you let me know the name of the CVS server and the user name and all that
> good information?

All the information is available at jakarta.apache.org
website (same place you signed up for this list). Go have a
look and you should find what you need :P


Pete




Re: javacc task

Posted by Vijay Raghavan <vi...@netscape.com>.
Thanks...
I am a new ANT user and am loving it so far.
Can you let me know the name of the CVS server and the user name and all that
good information?
Thanks
Vijay


Mariusz Nowostawski wrote:

> On Wed, 19 Jul 2000, Vijay Raghavan wrote:
> > Hi,
> > I saw a mail about the javacc task.
> > Does it work alright? If so can someone send it to me?
> > Thanks
> > Vijay
>
> It is already in the newest CVS, just check it out. Unfortunately you need
> to have a look at the source code to figure out what arguments to use with
> it ;o) or ask Thomas for nicer javadocs comments/help

Re: javacc task

Posted by Mariusz Nowostawski <ma...@marni.otago.ac.nz>.
On Wed, 19 Jul 2000, Vijay Raghavan wrote:
> Hi,
> I saw a mail about the javacc task.
> Does it work alright? If so can someone send it to me?
> Thanks
> Vijay

It is already in the newest CVS, just check it out. Unfortunately you need
to have a look at the source code to figure out what arguments to use with
it ;o) or ask Thomas for nicer javadocs comments/help