I'm converting a makefile, and we have lots of our own compilers that seem to do almost exactly the same thing as you describe (ours turn XML into Java source). Our original command lines for this also had us passing the package name as a param. But, I couldn't see an easy (or any?) way to do this easily in Ant, so I modified our compilers, to what I think is actually a better way. I now just pass a filename to the compiler. It turns that into an absolute File/path (i.e. in case it was passed as a relative path). I then just rip off the filename, and I'm left with the package name. Depending on your directory structure and so on, this may or may not be feasible for you, but that's what I wound up doing.
I'm hoping to eventually just turn our compilers into Ant tasks, but due to a few other factors, I can't do that nicely yet. -----Original Message----- From: John Mc Quillan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 29, 2002 12:23 PM To: [EMAIL PROTECTED] Subject: Accessing the individual files in the file list Is there a way in Ant to get at the individual files in the file list (the equivalent of $< or $@ in make)? I'll try to explain with the following snippet. This is generating java source from xml schema files. A command line parameter allows the package name for output to be defined. What I'd like to do is set the package name to the name of the input file. Can I do this with a script? How would I get the file name in a script? I tried using <source/> but I need it for the input filename and it cannot be used multiple times. <target name="sourcegen" depends="init"> <apply executable="java" dest="${gensrc}"> <arg line="org.exolab.castor.builder.SourceGenerator -f -package test -dest ${src} -i"/> <mapper type="glob" from="*.xsd" to="*.java"/> <fileset dir="${schema}"/> </apply> </target> Thanks John -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
