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 Wed, 09 Jun 2010 06:11:23 GMT
http://code.google.com/p/sweetened/source/browse/#svn/trunk/src/com/googlecode/sweetened/typedef

http://code.google.com/p/sweetened/source/browse/trunk/example.xml

The above is what I have so far, and it works pretty well, but isn't
beautiful. It was kind of ugly since I had to implement my own <path>,
<filelist> and <file> elements by extending the existing ones (as you
can see from the example.xml, I just prefixed them with a 's' (ie:
<spath>) and doing some hackery to make it all work. Especially in the
way that the <sfile> element is initialized (see the need to call
this.setFile() in SweetenedFileResource.setName()).

Basically, all I want to do is be able to add a couple attributes to a
<file> element and then get access to those attributes in my Task. I
also want the container for those <file> elements to be able to be
passed as a refid into a <classpath>.

It looks like ResourceDecorator is 1.8 only and since this needs to
work in Eclipse, I'm stuck in 1.7.x land for now. I guess I could add
that class to my own code, but I'm not entirely sure how it works from
your description. If you could provide some examples, that would be
great. At this point, my head is spinning from all the layers of
abstraction in ant.

All in all, I think I'm onto some new ant functionality here that is
really useful. If you are like me and you don't like Maven, Ivy just
doesn't work right (has anyone actually tried the examples in the
documentation?) and Gradle is just too slow, this is a good
alternative to being able to specify your dependencies in your ant
build file and then use those to produce your Eclipse .classpath and
launch config files. All I want is something simple and fast and just
works. =)

thanks,

jon


On Tue, Jun 8, 2010 at 7:14 AM, Stefan Bodewig <bodewig@apache.org> wrote:
> On 2010-06-04, Jon Stevens wrote:
>
>> 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 seen you've already taken on Matt's Resource advice.  You may want
> to look into org.apache.tools.ant.types.resources.ResourceDecorator
> which wraps itself around a different Resource (specified as a nested
> element inside a build file) and forwards all "normal" methods to the
> wrapped Resource.
>
> You'd only need to implement setters for your additional attributes and
> should be done.
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>

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


Mime
View raw message