ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Gibble" <>
Subject Selectively copying versions of files
Date Tue, 07 Nov 2006 16:22:17 GMT

My apologies if this has been asked before, but I couldn't find anything related -- and it
seems like it might be a fairly common scenario.

Let's say I have a warehouse program that initializes itself by reading three configuration

This program runs a simulation and generates output showing the efficiency of the warehouse
with the given inputs.

Now let's say I want to package this program with a variety of pre-generated configurations:

	* The number of available vehicles (in vehicles.xml) is constant for each configuration --
say, 30
	* The number of personnel (in personnel.xml) varies by day, with Sunday = day0 and Saturday
= day6
	* The delivery locations (specified by locations.xml) vary between two specified configurations:
"East Coast" and "West Coast"

For example, here are the pre-generated configurations:
	day0 personnel, East Coast locations
	day1 personnel, East Coast locations
	day6 personnel, East Coast locations
	day0 personnel, West Coast locations
	day6 personnel, West Coast locations

To clarify, each "configuration" folder contains a version of the files vehicles.xml, personnel.xml
and locations.xml populated with the desired values.  Note that the number of vehicles was
not specified by the above configurations, since the default value of 30 is always used.

Rather than maintain multiple copies of the same file in each configuration folder (e.g. 14
copies of the same vehicles.xml), I was trying to use an Ant build script to copy the appropriate
files from one "source" location to the appropriate "destination" configuration folder.  So,
there is one "day0-personnel.xml" file, one "EastCoast-locations.xml", and one "vehicles.xml"
file (the default, containing 30 vehicles) that would be copied (and renamed when needed)
into the "Day 0 personnel, East Coast locations, 30 vehicles" configuration folder.

But here's an added wrinkle: in addition to the configurations mentioned above, there is one
more "special" configuration we want to include that uses a different number of vehicles:
	day0 personnel, East Coast locations, 25 vehicles

In this case, the build script would need to copy (and rename) "day0-personnel.xml", "EastCoast-locations.xml",
and "25-vehicles.xml".

Furthermore, there may be future requests for other specific configurations, whether it's
different vehicles, personnel (e.g. "New Year's Day personnel"), locations ("International
locations"), etc.

So in short: given a desired configuration, I want an Ant script that copies the MOST SPECIFIC
file that exists (e.g. 25-vehicles.xml).  If there is no specific file, then a more generic
version should be used (e.g. vehicles.xml).

Of course, I COULD hard-code configurations to copy specific input files, but I'm trying hard
to avoid that....

Any ideas would be greatly appreciated.

Join Excite! -
The most personalized portal on the Web!

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

View raw message