ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Stevens <latch...@gmail.com>
Subject Re: Extending path
Date Mon, 07 Jun 2010 21:04:09 GMT
Anyone? Stefan?

On Fri, Jun 4, 2010 at 11:52 AM, Jon Stevens <latchkey@gmail.com> wrote:
> 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-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message