apache ant suggestions needed to solve problem

S

scott bell

Problem statement:

We have a simple tcl script, and it takes a set number of params as
input (argv). Usually 1-10 params.

The script builds some objects.

We have these params as named value pairs in a property file. We clone
the property files for each objects we want created.

However, we want to run the script once for every property file that
exists, and we want to use ant.

We want to dynamically, load all the property files, and recognise...by
their name..what task they relate to, and then pass each one,
individually to that task.

How do we do this? any help is appraicted.

there is a whole mix here of subant, filesets, macrodefs..and I need to
get a structure...otherwise i am lost.
 
R

Roedy Green

However, we want to run the script once for every property file that
exists, and we want to use ant.

Here is how I generate my ant scripts. Some of these ideas may apply
to what you want to do.

I generate all my ant Scripts from Java. The reasons are:

1. they are perfectly consistent.

2. if there is a bug, it is everywhere. I thus find it more easily
and correct it in only one place.

3. as I learn better ways of doing things, I can in one place update
all my scripts.

4. the end results are perfectly formatted, perfectly spelled, and
perfectly consistent with my current notion of best possible.


My technique runs something like this:

1. for a given case I hand write a script and experiment to get it
just the way I want.

2. I then run it through http://mindprod.com/applets/quoter.html to
convert it into java strings, i.e. a tiny java program that would
generate the script 100% as is.

3. I then search and replace strings of the form
xxxx with " + name + "
This inserts macro variables in place of specific names.

4. I then add other logic to make it clever.

5. I then turn it loose on the real world, see where what I have does
not quite cover the necessities. I add things to cover the odd cases.

6. Where something seems particularly one-off I invented an include
mechanism more straight-forward than ant's to let me include custom
script for a particular case. At various points it looks for the
existing of customising files and including them if they exist.

7. The generated scripts have nothing in them to indicate their
mechanical origin. The clues are the zealous commenting, the
consistency and the perfect formatting. They are just as readable as
hand-generated ones.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top