ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Morse <mo...@pobox.com>
Subject Specifying N:1 mappings between source and target files
Date Mon, 02 Jul 2001 14:54:15 GMT
Hi,

I have what I think is a simple need but I unfortunately cannot figure out
the correct way to setup the build file to accomplish my goal.  Essentially,
I want to use the Replace feature of Ant to replace the tokens in a file in
a template directory as it the target file.  The problem is that there is
not a 1:1 mapping between the source file and the target files, but rather a
2:1 mapping.  For example, I have a directory structure like:

T01_Audit_I01.properties
T02_Audit_I01.properties
T03_Audit_I01.properties
templates/Audit_I01.template

Basically, I want Ant to convert each of the ".properties" files into a
".sql" file by using the templates/Audit_I01.template file as a template and
replacing tokens based on the content of the respective ".properties" file.
So, after processing the directory should look like:

T01_Audit_I01.properties
T01_Audit_I01.sql
T02_Audit_I01.properties
T02_Audit_I01.sql
T03_Audit_I01.properties
T03_Audit_I01.sql
templates/Audit_I01.template

But I can't seem to figure out how to tell Ant to do this.  It seems like
the Replace command is the way to go, but I am unclear on how to convey this
2:1 sourcefile/targetfile mapping to Ant.  In particular, I don't want to
have to modified build.xml every time that I add a new pair of
template/properties; rather, I want Ant to operate at the directory level by
scanning the directory structure and then taking the appropriate actions.
Perhaps one way is to specified the source template filename as a property
in the properties file itself?  That would work great, but I am unclear as
to how to tell Ant to do that.

Any and all help most appreciate!  This seems to me like a simple task, but
I am having quite some difficulty in figuring out how to get Ant to do this.

Thanks!
Doug

Mime
View raw message