ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wi...@msoft.com (Will Hartung)
Subject Re: [apply] and m4
Date Mon, 25 Jun 2001 20:23:52 GMT
If you're running on Unix, then just shroud the m4 command with a simple
script that gives it the capabilities you need.

e.g.

#!/bin/sh
m4 $1 > $$
mv $$ $2

Of course, another alternative, since m4 is GNU, and you can get the source,
is to "fix it"
:-).

(Mind you all of this doesn't mean you don't have valid questions about Ant,
which I cannot answer, but these ideas can at least get you moving forward.)

Regards,

Will Hartung
(willh@msoft.com)

----- Original Message -----
From: "Doug Morse" <morse@pobox.com>
To: <ant-user@jakarta.apache.org>
Sent: Monday, June 25, 2001 9:22 AM
Subject: [apply] and m4


> 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
> morse@pobox.com


Mime
View raw message