ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject RE: ant problem under cygwin and questions from a wanna-be Makefile convert
Date Thu, 17 Oct 2002 05:12:59 GMT
--- Ralf Hauser <ralfhauser@gmx.ch> wrote:
> a little summary
> > Can I use "?" inside ant? Or is there only mapper regex?
> Diane (holtdl@yahoo.com) directed me to
> http://jakarta.apache.org/ant/manual/CoreTypes/mapper.html

I didn't think I did, but if I did, I didn't mean to. I meant to direct
you the the "Directory-based Tasks" section:
  http://jakarta.apache.org/ant/manual/dirtasks.html

> > 3) how to show the content of a fileset?
> Diane says: <pathconvert> it to a property and <echo> the property.
[snip]
> but I get the error:
> build.xml:14: Unexpected element "pathconvert" ??

<pathconvert> needs to be inside a <target>.

> > i) if there is a *.??.m4 file, run m4 on that file and create the
> > corresponding *.??.html output file unless it exists already
> Diane: See the last example on the Apply task page in the doc.
> http://jakarta.apache.org/ant/manual/CoreTasks/apply.html
> ----
> This works with a batch script to circumvent the missing stdout
> redirection in ant or the missing ouputfile spec of gnu m4

Yeah, didn't know 'm4' didn't let you specify an output file -- guess it
expects you to be piping the output somewhere. Anyway, to avoid the batch
script, you could use the ant-contrib <foreach> and <if> tasks instead --
for example:
  <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>

  <target name="doM4">
    <foreach target="runm4" param="m4.in">
      <fileset dir="${basedir}" includes="m4files/*.??.m4"/>
    </foreach>
  </target>

  <target name="runm4">
    <basename property="base.m4.in" file="${m4.in}" suffix=".m4"/>
    <dirname property="m4.dir" file="${m4.in}"/>
    <property name="m4.out" location="${m4.dir}/${base.m4.in}.html"/>
    <uptodate property="html.isUpToDate"
       targetfile="${m4.out}" srcfile="${m4.in}"/>
    <if>
      <isset property="html.isUpToDate"/>
    <then>
      <echo>${m4.out} is up-to-date.</echo>
    </then>
    <else>
      <echo>Processing ${base.m4.in}.m4 ...</echo>
      <exec executable="m4" output=${m4.out}>
        <arg value="-P"/>
      </exec>
    </else>
    </if>
  </target>

Note: You will need to be running 1.5.1 to get the bug-fixed <basename>.

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message