| How to avoid <antcall > with generic <script > target for subprojects? | How to avoid <antcall > with generic <script > target for subprojects? 2003-03-28 - By Andreas Ames
Dominique Devienne <DDevienne@(protected)> writes:
> I think you might want to use <subant> instead of scripting <ant> calls on a > set of directories... See: > > http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12368 > http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18391 > > --DD
Thanks a lot; this is what I was looking for.
However, there is a minor problem for my use case. I need to be able to specify an absolute filename as the antfile attribute. This means every subproject uses the same (given) antfile. In my case this will be the ${ant.file} of the superproject. All subproject specific settings are specified in a property file within the subproject's 'build' subfolder.
To be able to handle this with <subant> (and <ant>), without copying my antfile around, i need to patch the following:
- SubAnt.execute() and SubAnt.execute(file): the current code uses Ant.setAntfile to implicitly set the basedir of the subproject. I need to this explicitly by using the Ant.setDir method. I want to use java.io.File.isAbsolute() to distinguish between absolute and relative antfile values. I need to change the SubAnt.execute(File) interface to SubAnt.execute(File dir, String antfile). If antfile is a relative name the handling keeps as it is, if it is absolute, it is given to Ant.setAntfile unchanged.
- Ant.execute: my current ant version (1.5.1 as packaged on Debian) just uses FileUtils.resolveFile to combine the basedir and the name of the antfile unconditionally. I would change that to only combine them if java.io.File.isAbsolute(antFile) returns false. Otherwise I'd leave antFile as it is.
As you can see this would be no big deal. Before I actually do it I would like to ask some questions (not only to you Dominique but also to others):
- Would you consider such a 'feature' for SubAnt to be useful? Would the ant maintainers consider it to be useful for the Ant-task? If I understand FileUtils.resolveFile correctly, no existing antfiles should be broken by this change. But please note that I'm very new to ant.
- Should I send a patch to this list or should I use the bugtracking system?
- Against which ant version should I create a patch? Please note that I have no access to cvs (firewall issue).
TIA,
andreas
|
|
 |