You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Andrey Grishin <AG...@everest-jsc.com.ua> on 2004/05/12 17:00:28 UTC

uptodate question

Hi!
I use <uptodate> tag to compare timestamps of sql files in two direcories

   <target name="checkUptodate">
      <property name="src" location="../backup/db"/>
      <property name="target" location="db"/>
      <uptodate property="checkUptodate.dbUptodate">
         <srcfiles dir="${src}" includes="*.sql" />
         <mapper type="glob" from="*.sql" to="${target}/*.sql"/>
      </uptodate>
      <echo message="checkUptodate.dbUptodate result: ${checkUptodate.dbUptodate}" />
  </target>

${checkUptodate.dbUptodate} is true is sql files in target directory are more recent OR HAVE THE SAME timestamp as those in source directory. 
Ant documentation says that: "By default, the value of the property is set to true if the timestamp of the target file(s) is more recent than the timestamp of the corresponding source file(s)."

Can I have <uptodate> tag returning "false" is timestamps are equal?

I use Ant 1.6.1 on Linux RedHat 8.0, J2SDK 1.4.0_01

Thanks in advance, Andrey Grishin.

RE: uptodate question

Posted by "Mani G. Iyer" <iy...@rcn.com>.
Audrey:
Is it possible that you are seeing the modified times in seconds only?
Could it be that the milliseconds might still be more recent on the .sql
files?  
Thanks
Mani


-----Original Message-----
From: Andrey Grishin [mailto:AGrishin@everest-jsc.com.ua] 
Sent: Wednesday, May 12, 2004 11:00 AM
To: user@ant.apache.org
Subject: uptodate question

Hi!
I use <uptodate> tag to compare timestamps of sql files in two
direcories

   <target name="checkUptodate">
      <property name="src" location="../backup/db"/>
      <property name="target" location="db"/>
      <uptodate property="checkUptodate.dbUptodate">
         <srcfiles dir="${src}" includes="*.sql" />
         <mapper type="glob" from="*.sql" to="${target}/*.sql"/>
      </uptodate>
      <echo message="checkUptodate.dbUptodate result:
${checkUptodate.dbUptodate}" />
  </target>

${checkUptodate.dbUptodate} is true is sql files in target directory are
more recent OR HAVE THE SAME timestamp as those in source directory. 
Ant documentation says that: "By default, the value of the property is
set to true if the timestamp of the target file(s) is more recent than
the timestamp of the corresponding source file(s)."

Can I have <uptodate> tag returning "false" is timestamps are equal?

I use Ant 1.6.1 on Linux RedHat 8.0, J2SDK 1.4.0_01

Thanks in advance, Andrey Grishin.



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


Using filtersets in Copy. Controlling timestamp

Posted by Pawanraj Sadhwani <pa...@elitecore.com>.
Hi all,

I am merging 2 files in ant, using a filterset.

The resultant file is created with current time-date as timestamp..
I want to set the timestamp of the new created file as the latest timestamp
between the two files merged i.e if file1 is new, use that timestamp, if
file2 is new use its timestamp

How do i do this?

Pawan


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


RE: uptodate question

Posted by "Oleg S. Estekhin" <ol...@yandex.ru>.
Hi

Try this:

<uptodate property="checkUptodate.dbUptodate">
          <srcfiles dir="${src}" includes="*.sql" />
          <mapper type="glob" from="*.sql" to="${target}/*.sql"/>
</uptodate>
<property name="checkUptodate.dbUptodate" value="false"/>


If some property was set to some value then it can not be changed after
that.

So if "uptodate" task set the property, then "property" task will not change
it.

If uptodate task didn't set the property, then "property" task will set it.
But it will make this property useless in the target "if" or "unless"
attributes cause they check if property is set (to any value, "false"
included).

> -----Original Message-----
> From: Andrey Grishin [mailto:AGrishin@everest-jsc.com.ua]
> Sent: Wednesday, May 12, 2004 7:00 PM
> To: user@ant.apache.org
> Subject: uptodate question
>
>
> Hi!
> I use <uptodate> tag to compare timestamps of sql files in two direcories
>
>    <target name="checkUptodate">
>       <property name="src" location="../backup/db"/>
>       <property name="target" location="db"/>
>       <uptodate property="checkUptodate.dbUptodate">
>          <srcfiles dir="${src}" includes="*.sql" />
>          <mapper type="glob" from="*.sql" to="${target}/*.sql"/>
>       </uptodate>
>       <echo message="checkUptodate.dbUptodate result:
> ${checkUptodate.dbUptodate}" />
>   </target>
>
> ${checkUptodate.dbUptodate} is true is sql files in target
> directory are more recent OR HAVE THE SAME timestamp as those in
> source directory.
> Ant documentation says that: "By default, the value of the
> property is set to true if the timestamp of the target file(s) is
> more recent than the timestamp of the corresponding source file(s)."
>
> Can I have <uptodate> tag returning "false" is timestamps are equal?
>
> I use Ant 1.6.1 on Linux RedHat 8.0, J2SDK 1.4.0_01
>
> Thanks in advance, Andrey Grishin.


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


Re: uptodate question

Posted by Peter Reilly <pe...@corvil.com>.
Mani G. Iyer wrote:

>Andrey:
>You are right.  If the timestamps are equal then it is set to true.  I
>think it should be set to false.  I tried the <outofdate> task from
>Ant-contrib and that behaves the same way too.  Is it a documentation
>defect or a  design defect? 
>  
>
For <outofdate> this would a documention defect.
outofdate attempts to mimic make's idea of outofdateness.

 > make c
cc     c.c   -o c
 > make c
make: `c' is up to date.
 > touch c c.c
 > make
make: `c' is up to date.
 >

Peter

>Mani
>
>
>-----Original Message-----
>From: Andrey Grishin [mailto:AGrishin@everest-jsc.com.ua] 
>Sent: Wednesday, May 12, 2004 11:00 AM
>To: user@ant.apache.org
>Subject: uptodate question
>
>Hi!
>I use <uptodate> tag to compare timestamps of sql files in two
>direcories
>
>   <target name="checkUptodate">
>      <property name="src" location="../backup/db"/>
>      <property name="target" location="db"/>
>      <uptodate property="checkUptodate.dbUptodate">
>         <srcfiles dir="${src}" includes="*.sql" />
>         <mapper type="glob" from="*.sql" to="${target}/*.sql"/>
>      </uptodate>
>      <echo message="checkUptodate.dbUptodate result:
>${checkUptodate.dbUptodate}" />
>  </target>
>
>${checkUptodate.dbUptodate} is true is sql files in target directory are
>more recent OR HAVE THE SAME timestamp as those in source directory. 
>Ant documentation says that: "By default, the value of the property is
>set to true if the timestamp of the target file(s) is more recent than
>the timestamp of the corresponding source file(s)."
>
>Can I have <uptodate> tag returning "false" is timestamps are equal?
>
>I use Ant 1.6.1 on Linux RedHat 8.0, J2SDK 1.4.0_01
>
>Thanks in advance, Andrey Grishin.
>
>
>
>---------------------------------------------------------------------
>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: uptodate question

Posted by "Mani G. Iyer" <iy...@rcn.com>.
Andrey:
You are right.  If the timestamps are equal then it is set to true.  I
think it should be set to false.  I tried the <outofdate> task from
Ant-contrib and that behaves the same way too.  Is it a documentation
defect or a  design defect? 

Mani


-----Original Message-----
From: Andrey Grishin [mailto:AGrishin@everest-jsc.com.ua] 
Sent: Wednesday, May 12, 2004 11:00 AM
To: user@ant.apache.org
Subject: uptodate question

Hi!
I use <uptodate> tag to compare timestamps of sql files in two
direcories

   <target name="checkUptodate">
      <property name="src" location="../backup/db"/>
      <property name="target" location="db"/>
      <uptodate property="checkUptodate.dbUptodate">
         <srcfiles dir="${src}" includes="*.sql" />
         <mapper type="glob" from="*.sql" to="${target}/*.sql"/>
      </uptodate>
      <echo message="checkUptodate.dbUptodate result:
${checkUptodate.dbUptodate}" />
  </target>

${checkUptodate.dbUptodate} is true is sql files in target directory are
more recent OR HAVE THE SAME timestamp as those in source directory. 
Ant documentation says that: "By default, the value of the property is
set to true if the timestamp of the target file(s) is more recent than
the timestamp of the corresponding source file(s)."

Can I have <uptodate> tag returning "false" is timestamps are equal?

I use Ant 1.6.1 on Linux RedHat 8.0, J2SDK 1.4.0_01

Thanks in advance, Andrey Grishin.



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