ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craeg Strong" <>
Subject RE: Not a FAQ? make-like build prerequisites
Date Mon, 12 Jul 2004 20:31:25 GMT
I guess I am missing something.   By saying something like

foo: bar
	do something

You are manually asserting that when foo is out of date with respect to
bar, something should be done, which usually (but not always) will end
up creating a new version of foo.  Dependset provides a way of
expressing the exact same dependency in XML.   

Dependset will automatically remove the dependent files if out of date.
Normally this will then trigger the files to be regenerated by some
other task.

When adapting ant to a new tool (the "do something" above), there is a
path that I follow:
Shell out -> macro -> custom task.

That is, I start out invoking the tool from the shell (basically no
integration), then code up a macro of some kind, and finally if the cost
vs benefit is there I code up a custom task.   The custom task often
includes logic for understanding dependencies (not regenerating targets
if sources are up to date with respect to them).

Once you have written your first custom task you will find it is very
easy to do and the incremental cost of coding additional tasks will
usually favor the approach.

If you are concerned about the effort it would take you to potentially
code up several new ant tasks to adapt to your particular toolset
yourself, you should inquire on the mailing list, check the archives,
and check the website to see if others have already done so.  Often I
find this is the case, and that others are willing to share their code
with me.  There is even talk of setting up a CPAN-like web-accessible
library of shared ant tasks to make this really easy.

Hope this helps,


> -----Original Message-----
> From: Kendall Shaw []
> Sent: Monday, July 12, 2004 12:46 PM
> To: Ant Users List
> Subject: Re: Not a FAQ? make-like build prerequisites
> Dominique Devienne wrote:
> > Ant has a different philosophy that make, and it requires a bit of
> to
> > 'get it' or do the mental shift compared to makefiles.
> >
> > That said, Peter Reilly developed in Ant-Contrib a task called
> <outofdate>
> > whose purpose is to emulate in Ant makefile-like dependencies
> files.
>  From tests I did with uptodate, examples I've seen of outofdate and
> dependset so far, and from what I gather from reading their
> descriptions, they seem to be used to manually code the build
> prerequisite logic yourself.
> The point for me of having a build tool is to avoid having to do this
> manual coding, otherwise I might as well just write scripts, and it
> becomes a question of which is a more appropriate scripting language
> this, ant or something else.
> Make exists, if what I've read is true, because people found it to be
> hassle to reptitively write the same logic in shell scripts, so make
> written, which takes a list of rules instead of a script which
> explicitely tests files.
> Of course, ant has other niceties, like filesets and extensibility.
>   still have to weigh the difficulties and benefits.
> It might make more sense for me to use make or another tool, to handle
> the build rules, and call ant from the rules, where that is useful.
> Kendall
> >>-----Original Message-----
> >>From: Craeg Strong []
> >>
> >>Have you looked at the dependset task?
> >>
> >>It was designed to fulfill requirements such as the ones you
> >>
> >>Cheers,
> >>
> >>--Craeg
> >>
> >>
> >>>-----Original Message-----
> >>>From: Kendall Shaw []
> >>>Sent: Saturday, July 10, 2004 6:21 PM
> >>>To:
> >>>Subject: Not a FAQ? make-like build prerequisites
> >>>
> >>>Hi, I'm relatively new to ant.
> >>>
> >>>For example, how can I code the equivalent of this makefile:
> >>>
> >>>all:
> >>>
> >>>
> >>>       something
> >>>
> >>> fdsa.ghi
> >>>       somethingelse fdsa.ghi
> >
> >
> >
> > To unsubscribe, e-mail:
> > For additional commands, e-mail:
> >
> >
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message