ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Jack" <aj...@TrySybase.com>
Subject RE: Custom Path/FileSet types
Date Tue, 03 Jun 2003 17:37:56 GMT

peter reilly [mailto:peter.reilly@corvil.com] wrote:

	I'll attempt to answer some of these.

Thanks, I appreciate that.

	First there is a big difference beween path and fileset.
	Path is a lot nicer to use, and can hold more
	files but fileset is used by more
	tasks that path.

Ok, thanks for that insight.

	Second, do not do things in the constructor - an empty
	constructor is best. Use set/add methods to set/add things.

Yup, works for me, I try to have lightweight constructors (and especially
none w/ content that throws exception that I might want to catch), I'll go
w/ empty...


	>
	> 1) Does what I am doing make sense as types verses tasks? What are the
pros
	> and cons of each?

	It depends....,  It may be usefull to be both. In your case it looks like
	it should be a datatype.

If I go down to DataType, aren't I cutting myself off from this being passed
into existing tasks?

	> 3) I suspect I'll have a singleton factory (of sorts) to create my
	> constructs. That entity will probably want some per VM or per project
	> configuration (or perhaps not a real singleton). I see I can access the
	> project, so  I can access properties, but are there helpers for per
project
	> instances? Do I need to roll my own?

	You should not use a singleton factory. A number of <typedefs/> should
	be enough.

Not sure I follow that, but then I probably mis-explained my intentions (or
just plain used the wrong word). Making an analogy --- I see the things I
create as 'File Handles', and I need to create a 'File Sub-System' to create
them (and that is heavier weight.) I need to configure that once (knowledge
of remote repositories, etc) and then these "file references" can be
found/downloaded/reference much easier. That clearer? Any concept like that
exist?

	> 4) How ought I handle logging? Can types log? Logging seems attached to
the
	> Task, not ProjectComponent. If not, how might user tasks report debugging
	> information for types?

	A project componet has a setProject(Project) method that gets called when
ant
	creates the object. Use project#log() for logging.

Doh, didn't see logging down there.

	> 5) If I create a custom FileSet (say) can I add it to anything that takes
a
	> FileSet (because I am a sub-class) or does the "container" need to
	> understand the XML tag? I.e. can I add <mypathelement to <classpath?

	There is work ongoing that will allow you to do this. In fact in the
current
	nightly build there is initial support for adding custom paths to the path.

I am game for nightly, can you elaborate?

Thanks for your help.

regards

Adam


Mime
View raw message