The only thing I can think of off-hand would be to have a little in-house
tool you execute instead that just runs 'm4' and does the redirect. So
your <apply> would look something like:
<target name="create_triggers">
<apply executable="runm4" dir="../triggers" dest="../triggers"
failonerror="true">
<srcfile/>
<targetfile/>
<fileset dir="../triggers" includes="*.m4"/>
<mapper type="glob" from="*.m4" to="*.sql"/>
</apply>
</target>
If you don't have to worry about it being portable beyond Unix, it could
just be a little shell-script that does 'm4 $1 > $2' (if you want some
feedback, add an 'echo "Processing $1..."' or some such).
Diane
--- Doug Morse <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am trying to use Ant to execute all m4 scripts in a directory to
> automated
> the creation of SQL scripts (triggers). The m4 scripts work just fine.
> However, for some *unfathomable* reason, GNU m4 does *not* have any way
> *whatsoever* (i.e., no syntax for it, no command line options for it) to
> write its output anywhere other than standard output (stdout). Ugh.
> So,
> the following does not work:
>
> <target name="create_triggers">
> <apply executable="m4" dir="../triggers" dest="../triggers"
> failonerror="true">
> <fileset dir="../triggers" includes="*.m4"/>
> <mapper type="glob" from="*.m4" to="*.sql"/>
> </apply>
> </target>
>
> because the output gets written to stdout. I've tried the following as
> well:
>
> <target name="create_triggers">
> <apply executable="m4" dir="../triggers" dest="../triggers"
> failonerror="true">
> <srcfile/>
> <arg line=" > "/>
> <targetfile/>
> <fileset dir="../triggers" includes="*.m4"/>
> <mapper type="glob" from="*.m4" to="*.sql"/>
> </apply>
> </target>
>
> in an attempt to get Ant to redirect the output to the targetfile, but
> this
> doesn't work either in that the ">" character just gets treated as a
> filename by m4, as does the targetfile:
>
> [apply] /usr/bin/m4: >: No such file or directory
> [apply] /usr/bin/m4: Users_A_Audit_U01.sql: No such file or
> directory
>
> Ant is probably ensuring that the commands it executes do not use
> redirection (as it should, IMHO). However, this has me in bit of a
> quandary.
> I could use the "output" parameter of the "apply" command, but this
> would
> then mean I would need a separate "apply" for each file I want to
> process
> (which pretty much defeats the purpose of using "apply").
>
> What alternatives do I have? I am going to perhaps have to write a Task
> subclass to get the behavior I need? Is there some other, easier way to
> deal with this issue?
>
> Any and all help greatly appreciated! My apologies in advance for
> troubling
> you all with this, in that I realize that the problem is really with
> m4's
> idiotic insistence on writing to stdout rather than anything wrong with
> Ant.
>
> Thanks!
> Doug Morse
> [EMAIL PROTECTED]
=====
([EMAIL PROTECTED])
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/