----- Original Message -----
From: "stephan beal" <[EMAIL PROTECTED]>
> On Saturday 23 March 2002 14:49, Erik Hatcher wrote:
> > -1 to both approaches, as they both just seem unnecessary.  Why not just
> > use the Commandline/Environment/Execute classes that AbstractCvsTask
> > currently uses in its execute() method?  There are several Ant tasks
that
> > execute command-line utilities in this manner and we should stick with
that
> > pattern.
>
> i don't agree. The problem is that ExecTask has a lot of code to handle
the
> actually running of the command, and i *really* hate duplicating any code
> longer than about one line long. Without either subclassing or opening up
the
> API i've gotta duplicate a lot of code, which adds to maintenance.

I don't understand why you can't just encapsulate an ExecTask in the code
you're working on and use it.  Call the setters just like happens when
<exec> is encountered in build.xml.  What exactly is inaccessible to you?

> > It seems with a little refactoring of AbstractCvsTask ("extract method"
> > refactoring on stuff in execute() for example) that you'd accomplish
what
> > you need by reusing the existing execute code there.
>
> i'd still have to duplicate code from ExecTask if i want to implement the
> command line args in a way which is consistent with the other objects. Go
> look at ExecTask and you'll see that the thing has practically only
protected
> methods. If they are made public then this object can be used as a generic
> proxy for running any external commands. Seems silly to re-implement that
> behaviour somewhere else.

There is not a whole lot of code in ExecTask.  What exactly are you trying
to re-use?  There is nothing preventing you from saying:

    ExecTask execTask = project.createTask("exec");
    execTask.set<whatever>, etc.
    execTask.execute()

I just don't (personally) like the idea of creating tasks as nested members
all that much - just "feels" odd to me for some reason.

So, what precisely is the bottleneck in what you're attempting?

    Erik



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to