ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris <ch...@ooc2000.com>
Subject Source questions (mostly with ProjectHelper.java)
Date Tue, 31 Dec 2002 16:34:24 GMT
(I got a rejection notice on this so I'm resending -- my apologies if 
somehow it's being received twice)

I'm working on a little command line tool that uses Ant. I've gotten a 
basic tool working, but I've been going over the Ant source code a little, 
and there are a few questions I have about possible improvement . . .

1) It would appear that a real workhorse method is 
ProjectHelper.configureProject(Project, File). This method handles 
FileNotFoundException by dumping a stack trace. In general, it seems to me 
that utility, third party methods that handle files should almost never 
consume IOExceptions, but rather should propagate them, since the 
controlling app will have its own way of dealing with these exceptions.

2) Project doesn't have any methods for removing targets.

3) Project *does* have an addOrReplaceTarget() method, which can be of help 
in reloading a build file. However, ProjectHelperImpl doesn't use this 
method, so any attempt to reload a buildfile throws a bunch of "Duplicate 
Target" exceptions.

I suppose 3) could be handled easily by writing my own impl of 
ProjectHelper, that differs only in that it uses addOrReplaceTarget(). But 
is there any reason why ProjectHelperImpl itself shouldn't be modified to 
do this? With 1), I'd have to change ProjectHelper, and I'd probably have 
to since to modify the code so configureProject() throws an exception would 
break existing code. As for 2), there's not a lot that can be done -- 
without a removeTarget() method, there's no such thing as a reusable 
project. I suppose I could write my own Project class, and maybe that 
wouldn't be so bad since what a Project mostly gives you is a collection of 
Targets, and it's the Targets that do the real work.

I was wondering what thoughts were, on context of the intent and culture of 
the Ant development effort. By the way, this is my first foray into the 
'dev' list of an open source effort, so I apologize for any faux pas I'm 
certain to have made and equally certain to commit in the future.

Keep up the good work,
Chris


--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message