ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Bergbauer" <vincent_bergba...@yahoo.com>
Subject Submission: refid, CompositeType, NestedDataType
Date Tue, 03 Oct 2000 21:36:11 GMT
This is a fairly large submission and it touches quite a few files, so here are a few explanations.

- The original aim of this submission is to make Argument a true DataType, that can exist
under a project
   just like a Path or a FileSet.
- I also wanted references to Path to Argument, to FileSet to be meaningful, with an Argument
being able to
  reference a Path for example. For this purpose I created the CompositeType interface, implemented
by 
  those three classes.
- A Property can now reference a Path, an Argument, or a FileSet and, optionally, specify
a custom separator.
- The major problem is that to extract a meaningful value out of a FileSet, or to do a circular
reference check
  on any of those types, a Project needs to be specified, which is not compatible with a simple
toString()
  method. I realized that when any of those types are evaluated only one project is current:
if we are running
  nested Ant tasks, there may be several projects but only one is active.
  I therefore added three static method to Project:
    public static Project create() // creates  a project and makes it the current one (the
constructor is now protected).
    public static Project getCurrent() // gets the current project.
    public static void removeCurrent() // removes the current project, making the previous
one current.
  Currently, Projects are simply added to and removed from a Stack. If we ever venture into
multithreaded Ant 
  tasks, there will probably be one such stack per thread.
  At this point, the current project is readily available from any class. Therefore I have
removed any Project parameter
  from all the methods and constructors of DataType-derived classes. Obviously, this is a
change in the API.
  The next logical step would be to do the same with Tasks (but I haven't done that yet).
- Path and Argument are very similar. I made them derive both from the class NestedDataType
which derives from 
  DataType, implements the CompositeType interface, implements dieOnCircularReference() correctly
for nested 
  data types, and implement several utility methods.
- The class PathElement is gone, since Path could already contain Strings as a result of append().
- In a build file: 
  path and pathelement are synonyms.
  arg, args, and argument are synonyms.
  Maybe we should eliminate some of those synonyms for the sake of clarity.
- Path and FileSet remove their duplicates by default, while Argument does not. This behavior
can be modified
  by the noduplicate attribute.
- Path and FileSet use File.pathSeparatorChar as their separator, while Argument uses space.
This behavior can
  be modified by the separator attribute. Note that a Property can also refer to one of those
type with a different
  separator without altering the object it refers to (separator is a "view" attribute, while
noduplicate is an intrisic
  attribute).
- The PathTest was already failing on Windows before I changed anything, because paths such
as "/a" would
  be translated into "c:\a". Since I don't find this behavior unreasonnable, I modified the
test to accept this.
  If the previous behavior is reinstated, all that is needed is to modifiy the PathTest.assertPathMatch()
method.
- I have added a test for Property and for NestedDataType.
- All the tests on built-in tasks succeed on my machine (W2K).
- I do not have any other optional components that JUnit. Code (in particular testing code)
in those tasks will
  probably need to be modified to take into account that the API to Path, FileSet and PatternSet
has changed .
- I have slightly updated the documentation, but I still need to give it more work.

TODO:
 - Make sure that optional tasks still compile and work.
 - Find a reasonable value for PatternSet.toString().
 - Figure out what a Property is allowed to refer to. For example, at this point, if a Property
refers to another
   Property that refers to another Property, its value is null (because it does not follow
references recursively).
- Maybe change Tasks so that their constructors and methods no longer use a Project parameter.
- If we allow universal reference, a Task then becomes a sort of DataType too.

Note on the patch: I could not get a recursive patch to work on my machine (W2K + cygwin 1.1.0).
jakarta-ant.zip will expand to a subset of the jakarta-ant directory structure with each directory
containing
new files (such as NestedDataType) and a patch file (dir.patch) that can be applied in that
directory to get
the other files.

Thank you.
Vincent.
  

Mime
View raw message