ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject AW: Getting a date into the date selector
Date Tue, 21 Sep 2004 06:38:57 GMT
Havent found anything to get store the modification date, so here is a
quick hack. Then use the stored value for the date selector.

Jan


<project>
    <scriptdef name="getdate" language="javascript">
        <attribute name="property"/>
        <attribute name="file"/>
        <![CDATA[
            prop    = attributes.get("property");
            file    = attributes.get("file");
            pattern = "MM/dd/yyyy HH:MM a";
            date = (new java.io.File(file)).lastModified();
            formatter = new java.text.SimpleDateFormat(pattern);
            project.setNewProperty(prop, formatter.format(date));
        ]]>
    </scriptdef>

    <getdate file="build.xml" property="date"/>
    <echo>build file modified on: ${date}</echo>
</project>



> -----Urspr√ľngliche Nachricht-----
> Von: Hobson, Neville [mailto:neville_hobson@mentorg.com]
> Gesendet am: Montag, 20. September 2004 16:59
> An: user@ant.apache.org
> Betreff: Getting a date into the date selector
> 
> I use the BuildNumber task to set a new build number when I perform a
> 'tag' task on my svn repository. The build number is saved in the
> build.number file.
> I later create a zip file containing any files that have changed since
> the tag was created - effectively a patch file.
> The fileset that is used to create the zip uses a <date> selector, but
> at present I have the date of the tag operation hardwired.
> What I would like to be able to do is to set the date for the date
> selector to the date of the last modification of the 
> build.number file.
> Any suggestions about how I might do this - or another way to 
> get to the
> same result?
>  
> Thank you,
>  
> Neville
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message