ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Nehren" <nehr...@earthlink.net>
Subject runtime task attributes modification
Date Fri, 15 Aug 2003 00:12:00 GMT
Hi guys.
 
I am writing a task that will iterate thorough all the sub-directories
in a directory and executing a certain number of tasks. I could not find
any task out there that does that. There are a few complication with
this task and wanted to get some input and/or advice.
 
I want to be able to support a certain number of tasks like javac, ant,
jar, etc. Since Properties are immutable I cannot use them to identify
the current dir so I use an identifier for relative paths in my task
assignable as an attribute,  for example relpathid="@@@". So, if I have
a javac task where srcDir="@@@/src", during the execute of my task  I
will replace the @@@ with the subdirectory name in the current
iteration. I will do that for every attribute in the task that
identifies paths. 
 
The problem I am having is that for, example in javac there is no way (
that I could find) to completely replace the srcDir, but only to add to
it. What I ended up doing was create a brand new javac task and copying
all the attributes, with the path modification over and then performing
the new task. I have only done javac right now but I suspect that I will
find other tasks like that and will end up writing a bunch of code for
each task I want to support. 
 
It started dawning on me that maybe, the modification of tasks
attributes at runtime is something that might not really be encouraged.
Is that so? Is there a way around this problem? I see that for destDir
javac uses files so that can be replaced but this is not the case for
paths.
 
What do you think about the idea overall? I have a simpler version that
only supports the ant task, and we use it in various places. Isn't this
something that could be useful to everybody?
 
Please, anybody who cares to comment, please do so.
 
Thanks a lot,
 
 
Daniel Nehren

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message