ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marius Scurtescu <mar...@multiactive.com>
Subject Re: TimeStamp dependent target execution
Date Fri, 07 Jul 2000 20:45:39 GMT
Stefan Bodewig wrote:
[...]
> We could even go wild here and provide some kind of pattern matching
> to find destination files corresponding to source files and run the
> transformation only for specific file, something like
> 
> <transform command="jade -t rtf -d mydocbookstyle.dsssl">
>   <src dir="documentation/docbook">
>     <include name="**/*.sgml" />
>   </src>
>   <dest dir="documentation/generated/rtf">
>     <include name="**/*.rtf" />
>   </dest>
>   <match src="*.sgml" dest="*.rtf" />
>   <!-- like Perl? <match pattern="/(.*)\.sgml/$1\.rtf/" /> -->
> </transform>
> 
> which is supposed to pick up each DocBook file that is newer than the
> previously generated RTF version and run Jade to make a more recent
> version from it.
> 
> The last part (pattern stuff) needs a bit of thought but the first
> implementation (transform + your obsolete semantics) seems to be
> straight forward.
> 
> Comments?
> 
> Stefan

Some more thoughts along these lines. Using a few implicit variables this
one-to-one matching can be implemented very elegantly like:

<transform command="compile ${src} ${dest}">
  <src dir="documentation/docbook">
    <include name="**/*.sgml" />
  </src>
  <dest dir="${folder}">
    <include name="**/${name}.rtf" />
  </dest>
</transform>

Where ${folder}, ${name}, ${src} and ${dest} have different value for every single
file matched by the <src ...> tag.

The whole process would work like:

1. When a file is matched by <src...> then ${folder}, ${name} and ${src} are
instantiated accordingly (file folder, file name without extension and complete file
name). 

2. <dest ..> will [try] match a file and will set ${dest}.

3. The command will be run using these vars.

4 Repeat with step 1 until there are files to be matched.

Of course it would be preferable to use a different syntax for variables to
avoid confusion with project wide properties.

This is very similar to the Perl example Stefan gave above. It just
avoids the regular expression syntax.

Marius

Mime
View raw message