You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "W. Sean Hennessy" <sh...@goldenhourdata.com> on 2003/06/07 04:44:55 UTC

example behavior of using ?

Getting frustrated after a reasonable effort at implementing
selectivity using ant-contrib's <outofdate> with <mapper>.
Given ${src.dir}/*.xml  ==> ${build.dir}/*.html

Three example test scenarios (A.1, A.2, B) exhibit unexpected behavior.
For each test run have included:
"Inputs:" corresponding to sourcefiles and targetfiles
"Results:" output of ant
"Expected files outofdate:"

Please have a look and point out where my of mapper is incorrect.

Regards,
Sean

<!-- example OTDMapTst.xml -->
<project name="OutadateTest" default="outadate.tgt.nm" basedir="..">
   <property name="src.doc.dir" value="${basedir}/1.doc"/>
   <property name="build.dir" value="${basedir}/build" />
   <property name="build.doc.dir" value="${build.dir}/1.doc" />
   <property name="tools.dir" value="C:/Tools" />

   <!-- required to reference ant-contrib tasks outofdate,foreach et al. -->
   <taskdef resource="net/sf/antcontrib/antcontrib.properties">
     <classpath>
       <pathelement
location="${tools.dir}/ant-contrib-0.3/lib/ant-contrib-0.3.jar" />
     </classpath>
   </taskdef>

   <patternset id="srcdoc.ptnset.id">
      <include name="**/*.xml"/>
   </patternset>

   <fileset id="srcdoc.fs.id" dir="${src.doc.dir}" >
      <patternset refid="srcdoc.ptnset.id"/>
   </fileset>

   <!-- Not working yet  -->
   <target name="outadate.tgt.nm"
      description="selective target execution for outofdate src/*xml against
corresponding build/*html">
      <outofdate
                outputsourcespath="outadate.tgt.outpt.srcpath"
                outputsources="outadate.tgt.outpt.srcs"
                outputtargets="outadate.tgt.outpt.tgts">
         <sourcefiles>
            <fileset refid="srcdoc.fs.id" />
         </sourcefiles>
         <!-- BEGIN COMMENT =================================
             For Tests (A.1 & TEST A.2) COMMENTED OUT
            group compare against one target
          END COMMENT ===================================== -->
         <targetfiles>
            <pathelement path="${build.dir}/index.html"/>
         </targetfiles>
         <!-- BEGIN COMMENT =================================
           PROBLEM
               mapper is sposed to be how one
               associates each sourcefile element with corresponding output
               eg. ${src.doc.dir}/filename.xml ==>
${build.doc.dir}/filename.html
               does not seem to work..?!
          END COMMENT ===================================== -->
          <mapper type="glob" from="${src.doc.dir}{$file.separator}*.xml"

to="${build.doc.dir}{$file.separator}*.html"/>
          <sequential>
            <echo
message="outadate.tgt.outpt.srcs=${outadate.tgt.outpt.srcs}"/>
            <echo
message="outadate.tgt.outpt.tgts=${outadate.tgt.outpt.tgts}"/>
         </sequential>
      </outofdate>
   </target>
</project>
<!-- EOF -->



======================================================
The test results:
======================================================
Test A.1  FAIL <!-- <targetfile  -->  Commented Out
1. file1.xml date < file1.html date
2. file2.xml date <> (no file2.html)
========================================
Inputs:
1. 06/06/2003  05:50p 1.doc\file1.xml
2. 04/04/2003  11:59a 1.doc\subdir\file2.xml

06/06/2003  05:34p build\index.html
06/06/2003  06:18p build\1.doc\file1.html

Result:
outadate.tgt.nm:
[outofdate] 1.doc\file1.xml
[outofdate] 1.doc\subdir\file2.xml

BUILD SUCCESSFUL

Expected files outofdate:
 1.doc\subdir\file2.xml  <== No Tgt!

======================================================
======================================================
Test A.2 FAIL <!-- <targetfile  -->  Commented Out
1. file1.xml date > file1.html date
2. file2.xml date <> (no file2.html)
========================================
Inputs:
06/06/2003  06:30p 1.doc\file1.xml  <<=== NEWER THAN TGT !
04/04/2003  11:59a 1.doc\subdir\file2.xml

06/06/2003  05:34p build\index.html
06/06/2003  06:18p build\1.doc\file1.html

Result:
outadate.tgt.nm:
[outofdate] 1.doc\file1.xml
[outofdate] 1.doc\subdir\file2.xml
BUILD SUCCESSFUL

Expected files outofdate:
 1.doc\subdir\file2.xml  <== No Tgt
 1.doc\file1.xml         <== Src newer than map Tgt

======================================================
Test B. FAIL <targetfile referencing index.html.
1. file1.xml date > file1.html date
2. file2.xml date <> (no file2.html)
========================================
Inputs:
06/06/2003  06:30p 1.doc\file1.xml
04/04/2003  11:59a 1.doc\subdir\file2.xml

06/06/2003  05:34p build\index.html
06/06/2003  06:18p build\1.doc\file1.html

Result:
outadate.tgt.nm:
[outofdate] 1.doc\file1.xml
[outofdate] 1.doc\subdir\file2.xml
Override ignored for property outadate.tgt.prp
     [echo]
outadate.tgt.outpt.srcs=C:\Wrk\WSean\Prj\SCM-Test\1.doc\file1.xml
     [echo]
outadate.tgt.outpt.tgts=C:\Wrk\WSean\Prj\SCM-Test\build\index.html

BUILD SUCCESSFUL
Expected files outofdate:
 1.doc\subdir\file2.xml  <== No Tgt
 1.doc\file1.xml         <== Src newer than map Tgt and index.html
<eom>



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


Re: example behavior of using ?

Posted by peter reilly <pe...@corvil.com>.
Opps,

Sorry, the dir attribute has been added to
<outofdate/> after the 0.3 release of ant-contrib.

You will need to get a cvs version.

Peter

On Monday 09 June 2003 17:07, W. Sean Hennessy wrote:
> Peter,
>
> Afraid the same is true as well for your example ( needed a little editing
> ) which faulted on verbose attribute also..
>
> [ begin file prilley.xml ]
> <project name="t" default="t" basedir="..">
>   <property name="build.dir" value="tstbuild"/>
>   <property name="src.dir" value="tstsrc"/>
>    <taskdef resource="net/sf/antcontrib/antcontrib.properties">
>      <classpath>
>        <pathelement
> location="C:/Tools/ant-contrib-0.3/lib/ant-contrib-0.3.jar" />
>      </classpath>
>    </taskdef>
>   <target name="i.nm">
>   <delete quiet="yes" dir="${src.dir}"/>
>   <delete quiet="yes" dir="${build.dir}"/>
>
>   <mkdir  dir="${src.dir}/acme"/>
>   <mkdir  dir="${build.dir}/acme"/>
>
>   <touch  file="${src.dir}/acme/1.xml"        millis="1000"/>
>   <touch  file="${build.dir}/acme/index.html" millis="2000"/>
>   <touch  file="${src.dir}/acme/2.xml"        millis="3000"/>
>   <touch  file="${build.dir}/acme/1.html"     millis="4000"/>
>   </target>
>   <target name="t" depends="i.nm">
>     <outofdate
>       outputsources="output.sources"
>       outputtargets="output.targets" >
>       <sourcefiles>
>         <fileset dir="${src.dir}" includes="**/*.xml"/>
>       </sourcefiles>
>       <targetfiles path="${build.dir}/index.html"/>
>       <mapper type="glob" dir="${src.dir}"
>               from="*.xml" to="${build.dir}/*.html"/>
>       <sequential>
>         <echo>sources ${output.sources}</echo>
>         <echo>targets ${output.targets}</echo>
>       </sequential>
>     </outofdate>
>   </target>
> </project>
> [ end file ]
> Build sequence for target `t' is [i.nm, t]
> Complete build sequence is [i.nm, t]
>
> i.nm:
>    [delete] Deleting directory C:\Wrk\WSean\Prj\SCM-Test\tstsrc
>    [delete] Deleting C:\Wrk\WSean\Prj\SCM-Test\tstsrc\acme\1.xml
>    [delete] Deleting C:\Wrk\WSean\Prj\SCM-Test\tstsrc\acme\2.xml
>    [delete] Deleting directory C:\Wrk\WSean\Prj\SCM-Test\tstsrc\acme
>    [delete] Deleting directory C:\Wrk\WSean\Prj\SCM-Test\tstsrc
>    [delete] Deleting directory C:\Wrk\WSean\Prj\SCM-Test\tstbuild
>    [delete] Deleting C:\Wrk\WSean\Prj\SCM-Test\tstbuild\acme\1.html
>    [delete] Deleting C:\Wrk\WSean\Prj\SCM-Test\tstbuild\acme\index.html
>    [delete] Deleting directory C:\Wrk\WSean\Prj\SCM-Test\tstbuild\acme
>    [delete] Deleting directory C:\Wrk\WSean\Prj\SCM-Test\tstbuild
>     [mkdir] Created dir: C:\Wrk\WSean\Prj\SCM-Test\tstsrc\acme
>     [mkdir] Created dir: C:\Wrk\WSean\Prj\SCM-Test\tstbuild\acme
>     [touch] Creating C:\Wrk\WSean\Prj\SCM-Test\tstsrc\acme\1.xml
>     [touch] Creating C:\Wrk\WSean\Prj\SCM-Test\tstbuild\acme\index.html
>     [touch] Creating C:\Wrk\WSean\Prj\SCM-Test\tstsrc\acme\2.xml
>     [touch] Creating C:\Wrk\WSean\Prj\SCM-Test\tstbuild\acme\1.html
>
> t:
>
> BUILD FAILED
> file:C:/Wrk/WSean/Prj/SCM-Test/4.bin/prilley.xml:24: The <mapper> data type
> doesn't support the "dir" attribute.
> 	at
> org.apache.tools.ant.IntrospectionHelper.setAttribute(IntrospectionHelper.j
>a va:422)
> 	at org.apache.tools.ant.ProjectHelper.configure(ProjectHelper.java:306)
> 	at
> org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable
>. java:242)
> 	at
> org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable
>. java:211)
>
> -----Original Message-----
> From: peter reilly [mailto:peter.reilly@corvil.com]
> Sent: Monday, June 09, 2003 8:38 AM
> To: Ant Users List
> Subject: Re: example behavior of <outofdate> using <mapper>?
>
> On Monday 09 June 2003 16:09, W. Sean Hennessy wrote:
> > No sorry, "The <mapper> data type doesn't support the "dir" attribute"
>
> The <mapper> sub-element in <outofdate> is a sub-class of ant's
> mapper type. It supports the "dir" attribute to allow use of
> the path type for <sourcefiles/>. A path may consisit
> of a number of file sets, each with its own "dir".
>
> Please try the build script I sent, it should work
> with the mod for windows should below.
>
> Cheers,
>
> Peter
>
> > and already tried both forms of ${file.separator} and "/" on windows.
> >
> > -----Original Message-----
> > From: peter reilly [mailto:peter.reilly@corvil.com]
> > Sent: Monday, June 09, 2003 1:23 AM
> > To: Ant Users List
> > Subject: Re: example behavior of <outofdate> using <mapper>?
> >
> > On Monday 09 June 2003 09:18, peter reilly wrote:
> > >       <mapper type="glob" dir="src"
> > >               from="*.xml" to="${build.dir}/*.html"/>
> >
> > Opps, this should be:
> >       <mapper type="glob" dir="src"
> >               from="*.xml" to="${build.dir}${file.separator}*.html"/>
> >
> > Note: I have not tested this on windows ;-)
> >
> > Cheers,
> > Peter
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org


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


RE: example behavior of using ?

Posted by "W. Sean Hennessy" <sh...@goldenhourdata.com>.
Peter,

Afraid the same is true as well for your example ( needed a little editing )
which faulted on verbose attribute also..

[ begin file prilley.xml ]
<project name="t" default="t" basedir="..">
  <property name="build.dir" value="tstbuild"/>
  <property name="src.dir" value="tstsrc"/>
   <taskdef resource="net/sf/antcontrib/antcontrib.properties">
     <classpath>
       <pathelement
location="C:/Tools/ant-contrib-0.3/lib/ant-contrib-0.3.jar" />
     </classpath>
   </taskdef>
  <target name="i.nm">
  <delete quiet="yes" dir="${src.dir}"/>
  <delete quiet="yes" dir="${build.dir}"/>

  <mkdir  dir="${src.dir}/acme"/>
  <mkdir  dir="${build.dir}/acme"/>

  <touch  file="${src.dir}/acme/1.xml"        millis="1000"/>
  <touch  file="${build.dir}/acme/index.html" millis="2000"/>
  <touch  file="${src.dir}/acme/2.xml"        millis="3000"/>
  <touch  file="${build.dir}/acme/1.html"     millis="4000"/>
  </target>
  <target name="t" depends="i.nm">
    <outofdate
      outputsources="output.sources"
      outputtargets="output.targets" >
      <sourcefiles>
        <fileset dir="${src.dir}" includes="**/*.xml"/>
      </sourcefiles>
      <targetfiles path="${build.dir}/index.html"/>
      <mapper type="glob" dir="${src.dir}"
              from="*.xml" to="${build.dir}/*.html"/>
      <sequential>
        <echo>sources ${output.sources}</echo>
        <echo>targets ${output.targets}</echo>
      </sequential>
    </outofdate>
  </target>
</project>
[ end file ]
Build sequence for target `t' is [i.nm, t]
Complete build sequence is [i.nm, t]

i.nm:
   [delete] Deleting directory C:\Wrk\WSean\Prj\SCM-Test\tstsrc
   [delete] Deleting C:\Wrk\WSean\Prj\SCM-Test\tstsrc\acme\1.xml
   [delete] Deleting C:\Wrk\WSean\Prj\SCM-Test\tstsrc\acme\2.xml
   [delete] Deleting directory C:\Wrk\WSean\Prj\SCM-Test\tstsrc\acme
   [delete] Deleting directory C:\Wrk\WSean\Prj\SCM-Test\tstsrc
   [delete] Deleting directory C:\Wrk\WSean\Prj\SCM-Test\tstbuild
   [delete] Deleting C:\Wrk\WSean\Prj\SCM-Test\tstbuild\acme\1.html
   [delete] Deleting C:\Wrk\WSean\Prj\SCM-Test\tstbuild\acme\index.html
   [delete] Deleting directory C:\Wrk\WSean\Prj\SCM-Test\tstbuild\acme
   [delete] Deleting directory C:\Wrk\WSean\Prj\SCM-Test\tstbuild
    [mkdir] Created dir: C:\Wrk\WSean\Prj\SCM-Test\tstsrc\acme
    [mkdir] Created dir: C:\Wrk\WSean\Prj\SCM-Test\tstbuild\acme
    [touch] Creating C:\Wrk\WSean\Prj\SCM-Test\tstsrc\acme\1.xml
    [touch] Creating C:\Wrk\WSean\Prj\SCM-Test\tstbuild\acme\index.html
    [touch] Creating C:\Wrk\WSean\Prj\SCM-Test\tstsrc\acme\2.xml
    [touch] Creating C:\Wrk\WSean\Prj\SCM-Test\tstbuild\acme\1.html

t:

BUILD FAILED
file:C:/Wrk/WSean/Prj/SCM-Test/4.bin/prilley.xml:24: The <mapper> data type
doesn't support the "dir" attribute.
	at
org.apache.tools.ant.IntrospectionHelper.setAttribute(IntrospectionHelper.ja
va:422)
	at org.apache.tools.ant.ProjectHelper.configure(ProjectHelper.java:306)
	at
org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.
java:242)
	at
org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.
java:211)

-----Original Message-----
From: peter reilly [mailto:peter.reilly@corvil.com]
Sent: Monday, June 09, 2003 8:38 AM
To: Ant Users List
Subject: Re: example behavior of <outofdate> using <mapper>?


On Monday 09 June 2003 16:09, W. Sean Hennessy wrote:
> No sorry, "The <mapper> data type doesn't support the "dir" attribute"

The <mapper> sub-element in <outofdate> is a sub-class of ant's
mapper type. It supports the "dir" attribute to allow use of
the path type for <sourcefiles/>. A path may consisit
of a number of file sets, each with its own "dir".

Please try the build script I sent, it should work
with the mod for windows should below.

Cheers,

Peter

> and already tried both forms of ${file.separator} and "/" on windows.
>
> -----Original Message-----
> From: peter reilly [mailto:peter.reilly@corvil.com]
> Sent: Monday, June 09, 2003 1:23 AM
> To: Ant Users List
> Subject: Re: example behavior of <outofdate> using <mapper>?
>
> On Monday 09 June 2003 09:18, peter reilly wrote:
> >       <mapper type="glob" dir="src"
> >               from="*.xml" to="${build.dir}/*.html"/>
>
> Opps, this should be:
>       <mapper type="glob" dir="src"
>               from="*.xml" to="${build.dir}${file.separator}*.html"/>
>
> Note: I have not tested this on windows ;-)
>
> Cheers,
> Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org


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




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


Re: example behavior of using ?

Posted by peter reilly <pe...@corvil.com>.
On Monday 09 June 2003 16:09, W. Sean Hennessy wrote:
> No sorry, "The <mapper> data type doesn't support the "dir" attribute"

The <mapper> sub-element in <outofdate> is a sub-class of ant's
mapper type. It supports the "dir" attribute to allow use of
the path type for <sourcefiles/>. A path may consisit
of a number of file sets, each with its own "dir".

Please try the build script I sent, it should work
with the mod for windows should below.

Cheers,

Peter

> and already tried both forms of ${file.separator} and "/" on windows.
>
> -----Original Message-----
> From: peter reilly [mailto:peter.reilly@corvil.com]
> Sent: Monday, June 09, 2003 1:23 AM
> To: Ant Users List
> Subject: Re: example behavior of <outofdate> using <mapper>?
>
> On Monday 09 June 2003 09:18, peter reilly wrote:
> >       <mapper type="glob" dir="src"
> >               from="*.xml" to="${build.dir}/*.html"/>
>
> Opps, this should be:
>       <mapper type="glob" dir="src"
>               from="*.xml" to="${build.dir}${file.separator}*.html"/>
>
> Note: I have not tested this on windows ;-)
>
> Cheers,
> Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org


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


RE: example behavior of using ?

Posted by "W. Sean Hennessy" <sh...@goldenhourdata.com>.
No sorry, "The <mapper> data type doesn't support the "dir" attribute"
and already tried both forms of ${file.separator} and "/" on windows.

-----Original Message-----
From: peter reilly [mailto:peter.reilly@corvil.com]
Sent: Monday, June 09, 2003 1:23 AM
To: Ant Users List
Subject: Re: example behavior of <outofdate> using <mapper>?


On Monday 09 June 2003 09:18, peter reilly wrote:
>       <mapper type="glob" dir="src"
>               from="*.xml" to="${build.dir}/*.html"/>

Opps, this should be:
      <mapper type="glob" dir="src"
              from="*.xml" to="${build.dir}${file.separator}*.html"/>

Note: I have not tested this on windows ;-)

Cheers,
Peter

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




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


Re: example behavior of using ?

Posted by peter reilly <pe...@corvil.com>.
On Monday 09 June 2003 09:18, peter reilly wrote:
>       <mapper type="glob" dir="src"
>               from="*.xml" to="${build.dir}/*.html"/>

Opps, this should be:
      <mapper type="glob" dir="src"
              from="*.xml" to="${build.dir}${file.separator}*.html"/>

Note: I have not tested this on windows ;-)

Cheers,
Peter

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


RE: example behavior of using ?

Posted by "W. Sean Hennessy" <sh...@goldenhourdata.com>.
The directory is specified by refid to the following fileset:

   <fileset id="srcdoc.fs.id" dir="${src.doc.dir}" >
      <patternset refid="srcdoc.ptnset.id"/>
   </fileset>

-----Original Message-----
From: peter reilly [mailto:peter.reilly@corvil.com]
Sent: Monday, June 09, 2003 1:18 AM
To: Ant Users List
Subject: Re: example behavior of <outofdate> using <mapper>?


My doc on outofdate is not the best when using mapper.
The core bit missing from your build file is the "dir" attribute
to the mapper sub-element of outofdate.
mapper in "outofdate" needs to be told the directory that
the from files are relative to.

A simplified example:

<project name="t" default="t">
  <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
  <property name="build.dir" value="build"/>
  <delete quiet="yes" dir="src"/>
  <delete quiet="yes" dir="build"/>
  <mkdir  dir="src/acme"/>
  <mkdir  dir="build/acme"/>

  <touch  file="src/acme/1.xml"        millis="1000"/>
  <touch  file="build/acme/index.html" millis="2000"/>
  <touch  file="src/acme/2.xml"        millis="3000"/>
  <touch  file="build/acme/1.html"     millis="4000"/>

  <target name="t">
    <outofdate
      outputsources="output.sources"
      outputtargets="output.targets"
      verbose="true">
      <sourcefiles>
        <fileset dir="src" includes="**/*.xml"/>
      </sourcefiles>
      <targetfiles path="${build.dir}/index.html"/>
      <mapper type="glob" dir="src"
              from="*.xml" to="${build.dir}/*.html"/>
      <sequential>
        <echo>sources ${output.sources}</echo>
        <echo>targets ${output.targets}</echo>
      </sequential>
    </outofdate>
  </target>
</project>

And the output:
Buildfile: /home/preilly/proj/learning/out/build.xml
Deleting directory /home/preilly/proj/learning/out/src
Deleting directory /home/preilly/proj/learning/out/build
Created dir: /home/preilly/proj/learning/out/src/acme
Created dir: /home/preilly/proj/learning/out/build/acme
Creating /home/preilly/proj/learning/out/src/acme/1.xml
Creating /home/preilly/proj/learning/out/build/acme/index.html
Creating /home/preilly/proj/learning/out/src/acme/2.xml
Creating /home/preilly/proj/learning/out/build/acme/1.html

t:
SourceFile /home/preilly/proj/learning/out/src/acme/1.xml outofdate with
regard to /home/preilly/proj/learning/out/build/index.html
SourceFile /home/preilly/proj/learning/out/src/acme/2.xml outofdate with
regard to /home/preilly/proj/learning/out/build/index.html
SourceFile /home/preilly/proj/learning/out/src/acme/2.xml outofdate with
regard to /home/preilly/proj/learning/out/build/acme/2.html
sources /home/preilly/proj/learning/out/src/acme/2.xml
/home/preilly/proj/learning/out/src/acme/1.xml
targets /home/preilly/proj/learning/out/build/acme/2.html
/home/preilly/proj/learning/out/build/index.html

On Saturday 07 June 2003 03:44, W. Sean Hennessy wrote:
> Getting frustrated after a reasonable effort at implementing
> selectivity using ant-contrib's <outofdate> with <mapper>.
> Given ${src.dir}/*.xml  ==> ${build.dir}/*.html
>
> Three example test scenarios (A.1, A.2, B) exhibit unexpected behavior.
> For each test run have included:
> "Inputs:" corresponding to sourcefiles and targetfiles
> "Results:" output of ant
> "Expected files outofdate:"
>
> Please have a look and point out where my of mapper is incorrect.
>
> Regards,
> Sean
>
> <!-- example OTDMapTst.xml -->
> <project name="OutadateTest" default="outadate.tgt.nm" basedir="..">
>    <property name="src.doc.dir" value="${basedir}/1.doc"/>
>    <property name="build.dir" value="${basedir}/build" />
>    <property name="build.doc.dir" value="${build.dir}/1.doc" />
>    <property name="tools.dir" value="C:/Tools" />
>
>    <!-- required to reference ant-contrib tasks outofdate,foreach et al.
> --> <taskdef resource="net/sf/antcontrib/antcontrib.properties">
>      <classpath>
>        <pathelement
> location="${tools.dir}/ant-contrib-0.3/lib/ant-contrib-0.3.jar" />
>      </classpath>
>    </taskdef>
>
>    <patternset id="srcdoc.ptnset.id">
>       <include name="**/*.xml"/>
>    </patternset>
>
>    <fileset id="srcdoc.fs.id" dir="${src.doc.dir}" >
>       <patternset refid="srcdoc.ptnset.id"/>
>    </fileset>
>
>    <!-- Not working yet  -->
>    <target name="outadate.tgt.nm"
>       description="selective target execution for outofdate src/*xml
> against corresponding build/*html">
>       <outofdate
>                 outputsourcespath="outadate.tgt.outpt.srcpath"
>                 outputsources="outadate.tgt.outpt.srcs"
>                 outputtargets="outadate.tgt.outpt.tgts">
>          <sourcefiles>
>             <fileset refid="srcdoc.fs.id" />
>          </sourcefiles>
>          <!-- BEGIN COMMENT =================================
>              For Tests (A.1 & TEST A.2) COMMENTED OUT
>             group compare against one target
>           END COMMENT ===================================== -->
>          <targetfiles>
>             <pathelement path="${build.dir}/index.html"/>
>          </targetfiles>
>          <!-- BEGIN COMMENT =================================
>            PROBLEM
>                mapper is sposed to be how one
>                associates each sourcefile element with corresponding
output
>                eg. ${src.doc.dir}/filename.xml ==>
> ${build.doc.dir}/filename.html
>                does not seem to work..?!
>           END COMMENT ===================================== -->
>           <mapper type="glob" from="${src.doc.dir}{$file.separator}*.xml"
>
> to="${build.doc.dir}{$file.separator}*.html"/>
>           <sequential>
>             <echo
> message="outadate.tgt.outpt.srcs=${outadate.tgt.outpt.srcs}"/>
>             <echo
> message="outadate.tgt.outpt.tgts=${outadate.tgt.outpt.tgts}"/>
>          </sequential>
>       </outofdate>
>    </target>
> </project>
> <!-- EOF -->
>
>
>
> ======================================================
> The test results:
> ======================================================
> Test A.1  FAIL <!-- <targetfile  -->  Commented Out
> 1. file1.xml date < file1.html date
> 2. file2.xml date <> (no file2.html)
> ========================================
> Inputs:
> 1. 06/06/2003  05:50p 1.doc\file1.xml
> 2. 04/04/2003  11:59a 1.doc\subdir\file2.xml
>
> 06/06/2003  05:34p build\index.html
> 06/06/2003  06:18p build\1.doc\file1.html
>
> Result:
> outadate.tgt.nm:
> [outofdate] 1.doc\file1.xml
> [outofdate] 1.doc\subdir\file2.xml
>
> BUILD SUCCESSFUL
>
> Expected files outofdate:
>  1.doc\subdir\file2.xml  <== No Tgt!
>
> ======================================================
> ======================================================
> Test A.2 FAIL <!-- <targetfile  -->  Commented Out
> 1. file1.xml date > file1.html date
> 2. file2.xml date <> (no file2.html)
> ========================================
> Inputs:
> 06/06/2003  06:30p 1.doc\file1.xml  <<=== NEWER THAN TGT !
> 04/04/2003  11:59a 1.doc\subdir\file2.xml
>
> 06/06/2003  05:34p build\index.html
> 06/06/2003  06:18p build\1.doc\file1.html
>
> Result:
> outadate.tgt.nm:
> [outofdate] 1.doc\file1.xml
> [outofdate] 1.doc\subdir\file2.xml
> BUILD SUCCESSFUL
>
> Expected files outofdate:
>  1.doc\subdir\file2.xml  <== No Tgt
>  1.doc\file1.xml         <== Src newer than map Tgt
>
> ======================================================
> Test B. FAIL <targetfile referencing index.html.
> 1. file1.xml date > file1.html date
> 2. file2.xml date <> (no file2.html)
> ========================================
> Inputs:
> 06/06/2003  06:30p 1.doc\file1.xml
> 04/04/2003  11:59a 1.doc\subdir\file2.xml
>
> 06/06/2003  05:34p build\index.html
> 06/06/2003  06:18p build\1.doc\file1.html
>
> Result:
> outadate.tgt.nm:
> [outofdate] 1.doc\file1.xml
> [outofdate] 1.doc\subdir\file2.xml
> Override ignored for property outadate.tgt.prp
>      [echo]
> outadate.tgt.outpt.srcs=C:\Wrk\WSean\Prj\SCM-Test\1.doc\file1.xml
>      [echo]
> outadate.tgt.outpt.tgts=C:\Wrk\WSean\Prj\SCM-Test\build\index.html
>
> BUILD SUCCESSFUL
> Expected files outofdate:
>  1.doc\subdir\file2.xml  <== No Tgt
>  1.doc\file1.xml         <== Src newer than map Tgt and index.html
> <eom>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org


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



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


Re: example behavior of using ?

Posted by peter reilly <pe...@corvil.com>.
My doc on outofdate is not the best when using mapper.
The core bit missing from your build file is the "dir" attribute
to the mapper sub-element of outofdate.
mapper in "outofdate" needs to be told the directory that
the from files are relative to.

A simplified example:

<project name="t" default="t">
  <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
  <property name="build.dir" value="build"/>
  <delete quiet="yes" dir="src"/>
  <delete quiet="yes" dir="build"/>
  <mkdir  dir="src/acme"/>
  <mkdir  dir="build/acme"/>

  <touch  file="src/acme/1.xml"        millis="1000"/>
  <touch  file="build/acme/index.html" millis="2000"/>
  <touch  file="src/acme/2.xml"        millis="3000"/>
  <touch  file="build/acme/1.html"     millis="4000"/>

  <target name="t">
    <outofdate 
      outputsources="output.sources"
      outputtargets="output.targets"
      verbose="true">
      <sourcefiles>
        <fileset dir="src" includes="**/*.xml"/>
      </sourcefiles>
      <targetfiles path="${build.dir}/index.html"/>
      <mapper type="glob" dir="src"
              from="*.xml" to="${build.dir}/*.html"/>
      <sequential>
        <echo>sources ${output.sources}</echo>
        <echo>targets ${output.targets}</echo>
      </sequential>
    </outofdate>
  </target>
</project>

And the output:
Buildfile: /home/preilly/proj/learning/out/build.xml
Deleting directory /home/preilly/proj/learning/out/src
Deleting directory /home/preilly/proj/learning/out/build
Created dir: /home/preilly/proj/learning/out/src/acme
Created dir: /home/preilly/proj/learning/out/build/acme
Creating /home/preilly/proj/learning/out/src/acme/1.xml
Creating /home/preilly/proj/learning/out/build/acme/index.html
Creating /home/preilly/proj/learning/out/src/acme/2.xml
Creating /home/preilly/proj/learning/out/build/acme/1.html

t:
SourceFile /home/preilly/proj/learning/out/src/acme/1.xml outofdate with 
regard to /home/preilly/proj/learning/out/build/index.html
SourceFile /home/preilly/proj/learning/out/src/acme/2.xml outofdate with 
regard to /home/preilly/proj/learning/out/build/index.html
SourceFile /home/preilly/proj/learning/out/src/acme/2.xml outofdate with 
regard to /home/preilly/proj/learning/out/build/acme/2.html
sources /home/preilly/proj/learning/out/src/acme/2.xml 
/home/preilly/proj/learning/out/src/acme/1.xml
targets /home/preilly/proj/learning/out/build/acme/2.html 
/home/preilly/proj/learning/out/build/index.html

On Saturday 07 June 2003 03:44, W. Sean Hennessy wrote:
> Getting frustrated after a reasonable effort at implementing
> selectivity using ant-contrib's <outofdate> with <mapper>.
> Given ${src.dir}/*.xml  ==> ${build.dir}/*.html
>
> Three example test scenarios (A.1, A.2, B) exhibit unexpected behavior.
> For each test run have included:
> "Inputs:" corresponding to sourcefiles and targetfiles
> "Results:" output of ant
> "Expected files outofdate:"
>
> Please have a look and point out where my of mapper is incorrect.
>
> Regards,
> Sean
>
> <!-- example OTDMapTst.xml -->
> <project name="OutadateTest" default="outadate.tgt.nm" basedir="..">
>    <property name="src.doc.dir" value="${basedir}/1.doc"/>
>    <property name="build.dir" value="${basedir}/build" />
>    <property name="build.doc.dir" value="${build.dir}/1.doc" />
>    <property name="tools.dir" value="C:/Tools" />
>
>    <!-- required to reference ant-contrib tasks outofdate,foreach et al.
> --> <taskdef resource="net/sf/antcontrib/antcontrib.properties">
>      <classpath>
>        <pathelement
> location="${tools.dir}/ant-contrib-0.3/lib/ant-contrib-0.3.jar" />
>      </classpath>
>    </taskdef>
>
>    <patternset id="srcdoc.ptnset.id">
>       <include name="**/*.xml"/>
>    </patternset>
>
>    <fileset id="srcdoc.fs.id" dir="${src.doc.dir}" >
>       <patternset refid="srcdoc.ptnset.id"/>
>    </fileset>
>
>    <!-- Not working yet  -->
>    <target name="outadate.tgt.nm"
>       description="selective target execution for outofdate src/*xml
> against corresponding build/*html">
>       <outofdate
>                 outputsourcespath="outadate.tgt.outpt.srcpath"
>                 outputsources="outadate.tgt.outpt.srcs"
>                 outputtargets="outadate.tgt.outpt.tgts">
>          <sourcefiles>
>             <fileset refid="srcdoc.fs.id" />
>          </sourcefiles>
>          <!-- BEGIN COMMENT =================================
>              For Tests (A.1 & TEST A.2) COMMENTED OUT
>             group compare against one target
>           END COMMENT ===================================== -->
>          <targetfiles>
>             <pathelement path="${build.dir}/index.html"/>
>          </targetfiles>
>          <!-- BEGIN COMMENT =================================
>            PROBLEM
>                mapper is sposed to be how one
>                associates each sourcefile element with corresponding output
>                eg. ${src.doc.dir}/filename.xml ==>
> ${build.doc.dir}/filename.html
>                does not seem to work..?!
>           END COMMENT ===================================== -->
>           <mapper type="glob" from="${src.doc.dir}{$file.separator}*.xml"
>
> to="${build.doc.dir}{$file.separator}*.html"/>
>           <sequential>
>             <echo
> message="outadate.tgt.outpt.srcs=${outadate.tgt.outpt.srcs}"/>
>             <echo
> message="outadate.tgt.outpt.tgts=${outadate.tgt.outpt.tgts}"/>
>          </sequential>
>       </outofdate>
>    </target>
> </project>
> <!-- EOF -->
>
>
>
> ======================================================
> The test results:
> ======================================================
> Test A.1  FAIL <!-- <targetfile  -->  Commented Out
> 1. file1.xml date < file1.html date
> 2. file2.xml date <> (no file2.html)
> ========================================
> Inputs:
> 1. 06/06/2003  05:50p 1.doc\file1.xml
> 2. 04/04/2003  11:59a 1.doc\subdir\file2.xml
>
> 06/06/2003  05:34p build\index.html
> 06/06/2003  06:18p build\1.doc\file1.html
>
> Result:
> outadate.tgt.nm:
> [outofdate] 1.doc\file1.xml
> [outofdate] 1.doc\subdir\file2.xml
>
> BUILD SUCCESSFUL
>
> Expected files outofdate:
>  1.doc\subdir\file2.xml  <== No Tgt!
>
> ======================================================
> ======================================================
> Test A.2 FAIL <!-- <targetfile  -->  Commented Out
> 1. file1.xml date > file1.html date
> 2. file2.xml date <> (no file2.html)
> ========================================
> Inputs:
> 06/06/2003  06:30p 1.doc\file1.xml  <<=== NEWER THAN TGT !
> 04/04/2003  11:59a 1.doc\subdir\file2.xml
>
> 06/06/2003  05:34p build\index.html
> 06/06/2003  06:18p build\1.doc\file1.html
>
> Result:
> outadate.tgt.nm:
> [outofdate] 1.doc\file1.xml
> [outofdate] 1.doc\subdir\file2.xml
> BUILD SUCCESSFUL
>
> Expected files outofdate:
>  1.doc\subdir\file2.xml  <== No Tgt
>  1.doc\file1.xml         <== Src newer than map Tgt
>
> ======================================================
> Test B. FAIL <targetfile referencing index.html.
> 1. file1.xml date > file1.html date
> 2. file2.xml date <> (no file2.html)
> ========================================
> Inputs:
> 06/06/2003  06:30p 1.doc\file1.xml
> 04/04/2003  11:59a 1.doc\subdir\file2.xml
>
> 06/06/2003  05:34p build\index.html
> 06/06/2003  06:18p build\1.doc\file1.html
>
> Result:
> outadate.tgt.nm:
> [outofdate] 1.doc\file1.xml
> [outofdate] 1.doc\subdir\file2.xml
> Override ignored for property outadate.tgt.prp
>      [echo]
> outadate.tgt.outpt.srcs=C:\Wrk\WSean\Prj\SCM-Test\1.doc\file1.xml
>      [echo]
> outadate.tgt.outpt.tgts=C:\Wrk\WSean\Prj\SCM-Test\build\index.html
>
> BUILD SUCCESSFUL
> Expected files outofdate:
>  1.doc\subdir\file2.xml  <== No Tgt
>  1.doc\file1.xml         <== Src newer than map Tgt and index.html
> <eom>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org


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