Hi Stefan.
Stefan Bodewig wrote:
On Wed, 10 Oct 2001, Jason Brittain <[EMAIL PROTECTED]> wrote:
After some debugging and looking through the code I found that the Available task does not do file pattern matching when using the file attribute.
True, and I'm not sure whether it should.
What is the usecase for this? When is it enough to know that a file matching a certain pattern exists?
This requires a bit of background..
In our case, CollabNet has a new build system that uses Ant as the top-level build tool, and what it does is build lots of packages that may be taken from many open source projects. Each of these packages are from their own development team that are usually in no way controlled by us. Most of them include their own Ant or Make build systems. Our goals are:
1) To get them to all build together as one big project. 2) To get them to depend on and use each other. 3) To be able to easily add and remove packages when we need to. 4) To be able to use more than one version of each package in the same big project whenever that's necessary. 5) To make it so we don't need to hard-code the package names/dirs into the top-level Ant build file, nor way they build. We do not want to have to edit the top-level build file every time we add/remove a package! For instance, we want to be able to add a package and have the top-level build file find it and build it automatically.
FYI we have 100% of that working already, and we use it and like it.
Each package is stored in the source tree as an archive.. *.tar.gz files that are either archived releases (example: velocity-1.2.rc1.zip) or archived snapshots (example: relay-20010408.tar.gz). Either way they need to be uncompressed, possibly patched, then built, etc.. In order to achieve as much of #5 above as we could, our top-level build system takes care of the unpacking and patching, and the way it finds out if there are archives to unpack is:
<available file="*.tar.gz" filepath="${component.src.dir}"/>or
<available file="*.tar" filepath="${component.src.dir}"/>or
<available file="*.zip" filepath="${component.src.dir}"/>etc.
Because we can do this, our build system makes it easy to integrate new packages, and is written so that if a package has particular unpacking/patching needs, the individual package's own build file can choose to unpack/patch in its own different way. But, most unpack and patch in the same way and will simply use the top-level build file's automation. Now, I could have written a different custom Ant task to auto-find the archive files instead, but it was such a small change to the Available task, and I thought that this feature may be useful to others. So, I am going out of my way to contribute this feature into Ant because I think it could help solve lots of problems in a simple way.
As for other uses, setting properties based on the presence of files of a particular pattern may save some folks the chore of writing and maintaining a custom Ant task that does just that. If they don't know the exact filename to expect, or the files are named to fit a known pattern, even asterisk pattern matching may do the trick. Someone could write a build file that conditionally runs a target when files of a particular pattern are present. I'll bet many people have needed this, but haven't spoken up to the list about it.
Again, I'd just be thrilled if this made it into the Ant 1.4.1 (final) release.
It would be a new feature and therefore couldn't be included in a bugfix release.
Yes, it's a new feature, and I agree.. So I now request that you commit it to the 1.5 branch.
-- Jason Brittain <jasonb(at)collab(dot)net> CollabNet http://www.collab.net
