ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: Apply task and missing directories
Date Wed, 21 Jul 2004 14:27:14 GMT
> From: Nicolas Girard []
> Hi all,
> i'm trying to automate the generation of png images from dia diagrams.
> The idea is to regularly update a cvs sandbox ; then, if one .dia file
> is newer than the associated .png file, i'd just like to launch dia
> using the 'apply' task.
> Here's a subset of the script:
>   <target name="GenerateImagesFromDiaDiagrams">
>       <mkdir dir="${}"/>
>       <apply executable="dia" dest="${}">
>         <arg value="-e"/>
>         <targetfile/>
>         <srcfile/>
>         <fileset dir="${}" includes="**/*.dia"/>
>         <mapper type="glob" from="*.dia" to="*.png"/>
>       </apply>
>   </target>
> As you can see, I'd like the .png images to be generated into the
> directory, which is different from the directory
> where the srcfiles remain.
> Here's my problem: when dealing with, say file
> '${}/a/b/test.dia', I get an error message because the output
> directory '${}/a/b/' doesn't exist.
> So far I couldn't find an elegant way of creating the missing output
> directory before the external program is launched.
> Do you have an idea on how to achieve this ?

Interesting. Sounds like you could do it with Ant-Contrib's <for> which can
accept a <fileset> to iterate on (I think), then <dirname> to extract the
directory, then Ant-Contrib's <propertyregexp> to simulate the mapper, then
<mkdir> to create the re-parented directory name.

Another option might be to use Ant-Contrib's <outofdate> with your fileset
as source file, and a mapper that extracts either the target .png file, or
if possible directly the target directory of the .png, and then does a <for>
over these directories. In theory, we'd loop only over the directory you
need to add, by extracting the out-of-date target files (with <outofdate>
allows you to do).

The last option is to write a <script>, which wouldn't be very difficult.

A long time ago, I proposed (and used coded) allowing to pass a <dirset> to
<mkdir>, but this wasn't accepted. If <mkdir> accepted a <dirset>, with
nested mapper, then you'd have a ready made solution ;-)

None of the above has been tested. Just my thoughts on what I'd try in your
shoes. --DD

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message