Bug 18715 - [PATCH] <subant> to specify basedir to <ant>
Summary: [PATCH] <subant> to specify basedir to <ant>
Status: RESOLVED FIXED
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.5.3
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: 1.6
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-04 16:23 UTC by Andreas Ames
Modified: 2005-03-20 17:06 UTC (History)
3 users (show)



Attachments
patch against SubAnt.java, revision 1.1 (3.97 KB, patch)
2003-04-04 16:26 UTC, Andreas Ames
Details | Diff
slightly modified version of the patch proposed by Andreas Ames (6.62 KB, patch)
2003-05-16 10:59 UTC, Antoine Levy-Lambert
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Ames 2003-04-04 16:23:25 UTC
The patch applies to revision 1.1 of SubAnt.java in the cvs repository. 
 
It tries to achieve the following: 
 
* adds 'output' attribute to <subant> (directly corresponding to <ant>'s attribute of the 
same name) 
* includes Gus Heck's patch (see 
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18391) 
* fixes small bug with removal of 'target' attribute's default value 
(getOwningTarget().getName()) (removal occured on addition to cvs) 
* specifies now 'dir' attribute to delegated <ant> (under certain circumstances, see 
below) 
 
If the currently processed element of the 'buildpath' attribute is a filename, the original 
behaviour is preserved.  But if the current element is a directoryname, the behaviour is 
as follows: 
 
* If the 'antfile' attribute is an absolute filename, then the following settings are given to 
<ant>: 
 
- dir=current element of 'buildpath' 
- antfile = the value of <subant>'s 'antfile' attribute 
 
* If 'antfile' is not absolute (i.e. when the default value is used), the following settings 
apply to <ant>: 
 
- dir=current element of 'buildpath' 
- antfile = the absolute filename that results when <subant>'s 'antfile' value is resolved 
against the current element of 'buildpath'. 
 
To specify absolute filenames as the 'antfile' attribute to <ant> (which is not 
documented, AFAICT) is possible because of the (also undocumented) behaviour of 
FileUtils.resolveFile(file, filename), that it returns File(filename) if filename is absolute.  
The check for absoluteness seems to be platform dependent.  It would be nice, if the 
maintainers could state, whether this behaviour will be preserved (i.e. setting absolute 
filenames to <ant>'s 'antfile'). 
 
For a short discussion about (and a rationale to) this patch, see 
http://marc.theaimsgroup.com/?t=104876704900001&r=1&w=2.  Please note that I've 
found no easy way to preserve full backwards compatibility as I've stated too rashly in 
my mail.
Comment 1 Andreas Ames 2003-04-04 16:26:25 UTC
Created attachment 5648 [details]
patch against SubAnt.java, revision 1.1
Comment 2 Antoine Levy-Lambert 2003-05-16 10:59:01 UTC
Created attachment 6381 [details]
slightly modified version of the patch proposed by Andreas Ames
Comment 3 Antoine Levy-Lambert 2003-05-16 11:02:40 UTC
I would prefer to create a specific attribute to support what Andreas Ames wants 
to do. I call it "genericantfile".
I guess that you want to have as base dir in the sub builds the directory of the 
current iteration in the dirset, so I have added an ant.setDir(directory) in 
this case.
Let me know if this is OK.
Comment 4 Antoine Levy-Lambert 2003-05-21 07:33:54 UTC
Code submitted, with an embryo of testcase and updated doc
will be in the next nightly build
I am closing the bug report for now; reopen it if there are any issues. reopen 
Comment 5 Antoine Levy-Lambert 2003-05-21 07:36:12 UTC
*** Bug 18391 has been marked as a duplicate of this bug. ***
Comment 6 Dominique Devienne 2003-05-21 14:08:54 UTC
I'm -1 to ignoremissingbuildfile. Useless code/doc for something that's more 
naturally addressed by a fileset. This is turning Ant into Perl, where there's 
more than one way to do something, which is far for ideal to say the least in 
this case. This is an invalid use case, as opposed to genericAntFile. --DD
Comment 7 Antoine Levy-Lambert 2003-05-21 21:32:46 UTC
I will remove ignoremissingbuildfile tomorrow. Sorry for the trouble.
Comment 8 Antoine Levy-Lambert 2003-05-26 07:06:43 UTC
ignoremissingbuildfiles has been removed in CVS on 2003/05/22 07:27:50 (SubAnt.
java revision 1.4)
I am marking this bug report as resolved again.