Hi Matt,

Using Resources/ResourceCollections is definitely better than what I
had tried before. After a bit more wrangling today and I think I've
got what I wanted. Thanks for the feedback.

jon


On Mon, Jun 7, 2010 at 2:18 PM, Matt Benson <gudnabr...@gmail.com> wrote:
> I'm not sure what filelist has that you need to begin with...
> sequence?  You might be better off creating a resource type that
> decorates another resource to add the attributes you need, i.e. adding
> 'scope' to some file-based resource.  Then you could create those
> directly, or implement a resource collection to transform the
> resources of some other resource collection to your new resource type.
>  This approach is probably your best best because then your resources
> should be usable by whatever other tasks know how to deal with
> filesystem-based resources.
>
> HTH,
> Matt
>
> On 6/7/10, Jon Stevens <latch...@gmail.com> wrote:
>> Anyone? Stefan?
>>
>> On Fri, Jun 4, 2010 at 11:52 AM, Jon Stevens <latch...@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-unsubscr...@ant.apache.org
>> For additional commands, e-mail: dev-h...@ant.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
> For additional commands, e-mail: dev-h...@ant.apache.org
>
>

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

Reply via email to