You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by ph...@cactus.ca on 2001/05/16 15:25:24 UTC

Defining function target

Hi,

I have the same rules that has to be applied on each directory (I'm
generating docs from stylebook)

I have one that checks if anything changed in that directory since the last
time and another that does the work which is to replace some string (change
the DTD location) and then and generate a book.

What I would like is something like

bool CheckBook(dir,outputdir);

bool GenerateBook(dir,outputdir,replace_from,replace_to);   

foreach directory starting from xdocs
   CheckBook(directory,"html/"+directory)
   GenerateBook(directory,"html/"+directory, "[../]*DTD" , "/DTD")


{note that [../]* is a regexp, not sure to what level ant has that, seems to
be only the path stuff that has some level of regexp}

The directory structure looks like
	xdocs
	xdocs/DTD
	xdocs/root
	xdocs/root/design
	xdocs/projects
	xdocs/projects/timesheet
	xdocs/projects/sinbad
	xdocs/groups
	xdocs/groups/alpha
	xdocs/groups/beta

each directory has a bunch of xml files that together will form a book in
html, i.e. see how Cocoon does it's documentation for an example of how to
use stylebook for only a single directory.

I tried all the variations of antcall to be able to do something like the
above. It never worked, I could set a parameter, but it was not setting it
globally. I ended up creating a build.xml file in each directory which
generates the book for the current directory and then calls the build.xml in
all the child directories based on the manual editing I do on each build.xml
file.

It doesn't seem clean to me, is there another way ?  Anyway, the way I have
things setup right now, I would almos gain by using something like
Makefile.am which contains the directory dependant information and have
another tool the generates the build.xml files for each subdirectory.

Phil

PS If I'm not clear enough, let me know :)