ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "W. Sean Hennessy" <shenne...@goldenhourdata.com>
Subject example behavior of <outofdate> using <mapper>?
Date Sat, 07 Jun 2003 02:44:55 GMT
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


Mime
View raw message