Link to home
Start Free TrialLog in
Avatar of lfrohman
lfrohman

asked on

using ant for non-compiling

In MS windows, I have a set of source files that I convert to another format using a .bat file and then combine into a single file.
I would like to be able to reprocess by only converting the source files that changed, and then combining the files. This seems
really similar to how ant processes javac, but I don't know how to make this work for .bat files instead. How would I create
an ant build.xml to do this?
for example, I have
aaa.txt
bbb.txt
ccc.txt
...
zzz.txt
using convert.bat on each separate file, I create
aaa.out
bbb.out
ccc.out
...
zzz.out
then
copy aaa.out+bbb.out+ccc.out+...+zzz.out myfile
but I only want to convert.bat the .txt files that have changed, so
that if the ggg.out timestamp is after the ggg.txt timestamp, just
use ggg.out.
 
Avatar of valipotor
valipotor

Hi

On native Unix systems, you should be able to run shell scripts directly. On systems running a Unix-type shell (for example, Cygwin on Windows) execute the (command) shell instead - cmd  for batch files, sh for shell scripts - then pass the batch file or shell script (plus any arguments to the script) as a single command, using the /c or -c switch, respectively. See the above section  for example <exec> tasks executing sh. For batch files, use something like:

<exec dir="." executable="cmd" os="Windows NT">
  <arg line="/c test.bat"/>
</exec>


Use properties. Using ant -Dname=value lets you define values for properties on the Ant command line. These properties can then be used within your build file as any normal property: ${name} will put in value.

If you have more questions, read here:

valipotor
Avatar of lfrohman

ASKER

valipotor,
     This doesn't help me at all, I already know how to call a .bat file, the problem is how
to call the batch file on all the input files, but only if they have a newer timestamp.
ASKER CERTIFIED SOLUTION
Avatar of KnightFire
KnightFire

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial