Hi all,

Been a long long time since I've been around these parts, so apologies
if this has been covered before.

What I'd like to do is be able to add a couple of attributes to the
<file> element that lives in a <filelist> and then get access to those
attributes in my Task. I've mucked around for the last couple hours on
seeing how I could extend the existing ant code to make this happen
and it really doesn't seem easily possible.

For example:

    <path id="filelist.classpath">
        <myfilelist dir="${lib.dir}">
            <file name="${ant.jar}" src="thesrc" scope="run" />
            <file name="svntask.jar" src="svntasksrc" scope="compile" />
        </myfilelist>
    </path>

<myTask>
    <classpath refid="foo" />
</myTask>

Thus, in MyTask.java, I have:

    private List<Path> classpaths = new ArrayList<Path>();

    public void addClasspath(Path classpath) {
        classpaths.add(classpath);
    }

This works fine.

However, since there is no way to access the Union within a Path, I'm
kind of stuck cause I can't access the actual myfilelist objects to
get out my additional attributes. I could implement my own Path
object, but that is kind of a pain as I've already had to copy/paste
the source code for FileList.

I guess, ideally, Ant would be a lot more extensible if all of the
private fields had getter/setters and internally those getter/setters
were used instead of direct access. This would allow me to more easily
extend the existing Ant objects.

What I'm trying to accomplish is the ability to define a <path> within
Ant and then be able to pass that to a Task that I wrote that can
generate the Eclipse .classpath and .launch files. The task will be
smart about looking at the scope (run/compile) as well as pointing to
the source for the jar file.

Thoughts?

jon

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

Reply via email to