Hi

I use ant as a process control tool but have tried to keep my targets close to the ant model. I do use some looping over a set of files but only where it is truly needed. I try hard to use the depends and if/unless constructs to control the execution of targets. I have avoided using antcall or any of the other transfer of control targets.

I have very successfully used import for the purpose of breaking up a large file. It can be used at multiple levels which is even better. For example:
a.xml can import b.xml
b.xml can import c.xml and d.xml
c.xml can import ...

This allows you to group targets according to their purpose so that related targets can be kept together. I find that targets can be used across the files without regard to where they exist as long as you make sure the import comes before any reference to the target. I believe this is a matter of physical positioning rather than logical positioning but I have not tried it to any great extent. In other words make sure you import the file containing the target before it is referenced in the file doing the import.

Don't get carried away with the depth of the structure as it can get mind boggling to remember where you put the target you need to work on. I would recommend no more than 3 levels deep, but, that is a matter of personal preference.

I ended up with 9 files. The main file contains only a target to echo a usage statement in case the user tries to run the targets with the wrong parameters and an import for the file that contains the main set of targets. The file containing the main set of targets imports other files that contain supporting targets and the file that contains all the macros used in the tasks.

I also use the import task to support a method of local extensions of the process by importing a file that can contain extension targets or override targets for the process. If this file does not exist ant just ignores it and goes on - no complaints. If the file exists the targets in it are available for use.

HTH Bill

Z W wrote:
Hi

I'm using Ant as a scripting tool much like a shell script to do various
tasks of a project, not for a build purpose.
I like to get opinions from the gurus here about this.

I have various tasks written in a single build file. However, this file has
become very large.
I like to break this file up into multiple files, putting different targets
into various build files,
much like breaking a single large C file into multiple files.

What's the best approach to this while minimizing script
rewriting/maintainability ? (using antcall, import or something else)

Thanks


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to