You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by D Sledge <va...@yahoo.com> on 2004/11/01 21:11:26 UTC

using mappers

Here's the scenario:

File A is the source file for files X, Y, and Z.  How do I set up my uptodate element so that it
checks to see if X, Y, and Z are up to date?  I've tried using a composite mapper, but ant keeps
telling me that <uptodate> doesn't support a nested composite mapper.

Thanks,

D


		
_______________________________
Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now. 
http://messenger.yahoo.com

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


Re: using mappers

Posted by Matt Benson <gu...@yahoo.com>.
--- D Sledge <va...@yahoo.com> wrote:

> Found the culprit!  Don't use the "dir" and "file"
> attributes simultaneously in the <srcfiles>
> element.
> 
>       <srcfiles dir="${src.dir}" file="A"/>
> 
> Change it to:
> 
>       <srcfiles file="${src.dir}/A"/>
> 
Actually, <srcfiles dir="${src.dir}" includes="A" />
would have been the correct way historically, but the
file attribute was added fairly recently to simplify
specification of a single file.  And someone (I?)
should have noticed that you used file instead of
includes.  In this case I am guessing the single-file
fileset resolved to ${basedir}/A , which was not
present, therefore did not map to any target files
which were therefore up to (or at least not out of)
date.  Cute.

> and all is well in the realm of D Sledge.
> 
> Thanks a million for your help!
> 
No problem.

> D Sledge
> 
-Matt


		
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


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


Re: using mappers

Posted by D Sledge <va...@yahoo.com>.
Found the culprit!  Don't use the "dir" and "file" attributes simultaneously in the <srcfiles>
element.

      <srcfiles dir="${src.dir}" file="A"/>

Change it to:

      <srcfiles file="${src.dir}/A"/>

and all is well in the realm of D Sledge.

Thanks a million for your help!

D Sledge


		
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


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


Re: using mappers

Posted by Matt Benson <gu...@yahoo.com>.
--- D Sledge <va...@yahoo.com> wrote:
> Wait... so if a target file doesn't exist ("XA" for
> instance), it's considered up to date?
> 
No, the example I'm working with is structured a
little differently from yours, but I wanted to go
ahead and get the merge problem out of the way.

> Here's what I've tried so far with no success. 
> and scenario III (switched to mergemappers):
>    <uptodate property="isUpToDate">
>       <srcfiles dir="${src.dir}" file="A"/>
>       <mapper>
>          <mergemapper to="X"/>
>          <mergemapper to="Y"/>
>          <mergemapper to="Z"/>
>       </mapper>
>    </uptodate>

And this doesn't work?  I have this complete
buildfile:

<project default="foo">

  <uptodate property="bar">
    <srcfiles file="A" />
    <mapper>
      <mergemapper to="X" />
      <mergemapper to="Y" />
      <mergemapper to="Z" />
    </mapper>
  </uptodate>

  <echo>bar=${bar}</echo>

  <target name="foo" unless="bar">
    <echo>Target files are out of date</echo>
  </target>
</project>

And it seems to work as you wish.  I also noticed that
on the example you posted earlier, your <echo> tag
wasn't closed, which means the example wouldn't have
worked as posted.  Maybe you should double-check the
case on your "isUpToDate" and little things like that.
 If you still can't find it, I'll be around tomorrow.

-Matt


		
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


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


Re: using mappers

Posted by D Sledge <va...@yahoo.com>.
--- Matt Benson <gu...@yahoo.com> wrote:
> I created a self-contained buildfile to test this and
> have noticed a problem when I ran ant with debug
> logging.  You should be using a merge mapper for this
> example; the glob mapper isn't behaving as you expect
> when you specify from with ONLY "*", or to without any
> "*".  It was mapping "A" to "XA" for example, not to
> "X" as you wished.

Wait... so if a target file doesn't exist ("XA" for instance), it's considered up to date?

> Not sure if this qualifies as a
> bug or not; the answer is probably "almost."  Again,
> switch those to merge mappers for this example and see
> where that gets you.

Here's what I've tried so far with no success.  Scenario II (without the from attribute):

   <uptodate property="isUpToDate">
      <srcfiles dir="${src.dir}" file="A"/>
      <mapper>
         <globmapper to="X"/>
         <globmapper to="Y"/>
         <globmapper to="Z"/>
      </mapper>
   </uptodate>

and scenario III (switched to mergemappers):

   <uptodate property="isUpToDate">
      <srcfiles dir="${src.dir}" file="A"/>
      <mapper>
         <mergemapper to="X"/>
         <mergemapper to="Y"/>
         <mergemapper to="Z"/>
      </mapper>
   </uptodate>

I'm getting the same results each time.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: using mappers

Posted by Matt Benson <gu...@yahoo.com>.
--- D Sledge <va...@yahoo.com> wrote:
(a bunch of stuff)

I created a self-contained buildfile to test this and
have noticed a problem when I ran ant with debug
logging.  You should be using a merge mapper for this
example; the glob mapper isn't behaving as you expect
when you specify from with ONLY "*", or to without any
"*".  It was mapping "A" to "XA" for example, not to
"X" as you wished.  Not sure if this qualifies as a
bug or not; the answer is probably "almost."  Again,
switch those to merge mappers for this example and see
where that gets you.

-Matt


		
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


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


Re: using mappers

Posted by D Sledge <va...@yahoo.com>.
--- Matt Benson <gu...@yahoo.com> wrote:
> --- D Sledge <va...@yahoo.com> wrote:
> > It might be good to show what I have so far:
> >    <uptodate property="isUpToDate">
> >       <srcfiles dir="${src.dir}" file="A"/>
> >       <mapper>
> >          <globmapper from="*" to="X"/>
> >          <globmapper from="*" to="Y"/>
> >          <globmapper from="*" to="Z"/>
> >       </mapper>
> >    </uptodate>
> 
> Looks pretty good so far.  What is the exact error
> message?

Now that I've replaced the composite mapper with a regular one there isn't an error message, but
neither is that echo task being executed:

   <target name="message" unless="isUpToDate">
      <echo message="File A has been modified more recently than files X, Y, and/or Z.">
   </target>

This is what I get for the output:

$ ant message
Buildfile: build.xml

message:

BUILD SUCCESSFUL
Total time: 1 second


		
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


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


Re: using mappers

Posted by Matt Benson <gu...@yahoo.com>.
--- D Sledge <va...@yahoo.com> wrote:
> It might be good to show what I have so far:
>    <uptodate property="isUpToDate">
>       <srcfiles dir="${src.dir}" file="A"/>
>       <mapper>
>          <globmapper from="*" to="X"/>
>          <globmapper from="*" to="Y"/>
>          <globmapper from="*" to="Z"/>
>       </mapper>
>    </uptodate>

Looks pretty good so far.  What is the exact error
message?

-Matt


		
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


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


Re: using mappers

Posted by D Sledge <va...@yahoo.com>.
--- Matt Benson <gu...@yahoo.com> wrote:
> --- D Sledge <va...@yahoo.com> wrote:
> > File A is the source file for files X, Y, and Z. 
> > How do I set up my uptodate element so that it
> > checks to see if X, Y, and Z are up to date?  I've
> > tried using a composite mapper, but ant keeps
> > telling me that <uptodate> doesn't support a nested
> > composite mapper.
> 
> What version of Ant are you using?  Without my
> testing, know that a plain <mapper> with nested mapper
> elements of any type is implicitly a
> <compositemapper>, as well.

It might be good to show what I have so far:



   <uptodate property="isUpToDate">
      <srcfiles dir="${src.dir}" file="A"/>
      <mapper>
         <globmapper from="*" to="X"/>
         <globmapper from="*" to="Y"/>
         <globmapper from="*" to="Z"/>
      </mapper>
   </uptodate>

   <target name="message" unless="isUpToDate">
      <echo message="File A has been modified more recently than files X, Y, and/or Z.">
   </target>

If I modify file A just before running ant, it should execute the echo task.


		
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


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


Re: using mappers

Posted by D Sledge <va...@yahoo.com>.
--- Matt Benson <gu...@yahoo.com> wrote:
> --- D Sledge <va...@yahoo.com> wrote:
> > File A is the source file for files X, Y, and Z. 
> > How do I set up my uptodate element so that it
> > checks to see if X, Y, and Z are up to date?  I've
> > tried using a composite mapper, but ant keeps
> > telling me that <uptodate> doesn't support a nested
> > composite mapper.
> 
> What version of Ant are you using?  Without my
> testing, know that a plain <mapper> with nested mapper
> elements of any type is implicitly a
> <compositemapper>, as well.

Ant version 1.6.2


		
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


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


Re: using mappers

Posted by Matt Benson <gu...@yahoo.com>.
--- D Sledge <va...@yahoo.com> wrote:
> File A is the source file for files X, Y, and Z. 
> How do I set up my uptodate element so that it
> checks to see if X, Y, and Z are up to date?  I've
> tried using a composite mapper, but ant keeps
> telling me that <uptodate> doesn't support a nested
> composite mapper.

What version of Ant are you using?  Without my
testing, know that a plain <mapper> with nested mapper
elements of any type is implicitly a
<compositemapper>, as well.

HTH,
Matt


		
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


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