ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Glick <Jesse.Gl...@netbeans.com>
Subject Re: [PATCH] Use EnumeratedAttribute in <zip whenempty="..."/>
Date Fri, 09 Mar 2001 14:41:40 GMT
Stefan Bodewig wrote:
> 
> David Rees <d.rees.l@usa.net> wrote:
> 
> > Just to be clear, the reason I am asking is to understand the
> > "usecases" I need to consider when working on Ant code . I didn't
> > mean to imply it was a bad idea.
> 
> That was my impression as well, maybe my answer was a little short.

That was why I was trying to just deprecate the method, yes.

> It's not that uncommon for a task to reuse another task. <touch> is
> "abused" in several places for example. If somebody has written a
> custom task that uses Zip.java directly (or via project.createTask)
> he/she'd be better aware of this change.

And it's unfortunate that there does not seem to be a better way for tasks to
reuse other tasks. My project's build system has several custom tasks that mix
and match pieces from Ant standard tasks, but it seems dangerous (and
supporting more than one Ant release at once usually means resorting to
reflection). Ideally I would like to be able to use a simple interface akin to
IntrospectionHelper, e.g.:

public void execute() throws BuildException {
    IndirectTask t = project.createTaskIndirectly("zip");
    t.set("whenempty", "ignore");
    t.set("zipfile", "${foo}/foo.zip");
    IndirectElement e = t.create("fileset");
    e.set("dir", "src");
    // one step to configure it, initialize,
    // set location & parent, & execute:
    t.execute(this);
}

So that the code only relies on the XML-like structure of the tasks, not the
Java-level API.

-Jesse

-- 
Jesse Glick   <mailto:Jesse.Glick@netbeans.com>
NetBeans, Open APIs  <http://www.netbeans.org/>
tel (+4202) 3300-9161 Sun Micro x49161 Praha CR

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


Mime
View raw message