ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "S I" <xia...@hotmail.com>
Subject RE: AINASL! Help with Parsing Files with Ant
Date Thu, 21 Apr 2005 00:46:35 GMT
Sorry, got pulled away all the day on a broken build.

Thank you for your help. That worked. :)

I have one more question please.  I got all the parts to work, however 
crued! Now I'm working on the date piece

I now modified my file as follows:

--------------------------
<?xml version="1.0"?>

<project name="NextBuldNum" default="buildnum" basedir=".">

<property name="sys.date" value="date" />
<property name="sys.time" value="time" />

********************************************
I AM LOST HERE NOW: The exec line by itself works but how do I get the 
result of the date.exe back into here? With Args?

<target name="timedate">
<exec executable="C:/cygwin/bin/date.exe `+%a %D %r`" />
<arg line="/c dir"/>
</exec>

</target>
********************************************


<target name="buildnum">

<buildnumber file="mybuild.number"/>

<echo>build#:${build.number}</echo>

<echo file="verstamp1.txt" append="false">[Version]</echo>
<echo file="verstamp1.txt" append="true">${line.separator}</echo>


<echo file="verstamp1.txt" append="true">Version=5.0</echo>
<echo file="verstamp1.txt" append="true">${line.separator}</echo>

<echo file="verstamp1.txt" append="true">Build=${build.number}</echo>
<echo file="verstamp1.txt" append="true">${line.separator}</echo>

<echo file="verstamp1.txt" append="true">Date=${date}</echo>


</target>
</project>

-----------expected output---------
<!-- [Version] -->
<!-- Version=n.nn -->  Dictated by marketing; a constant for now
<!-- Build=nnn -->
<!-- Date=Wed 04/13/05 05:08:30 PM -->
-------------------------

----Original Message Follows----
From: "Dominique Devienne" <DDevienne@lgc.com>
Reply-To: "Ant Users List" <user@ant.apache.org>
To: "Ant Users List" <user@ant.apache.org>
Subject: RE: AINASL! Help with Parsing Files with Ant
Date: Wed, 20 Apr 2005 13:08:13 -0500
MIME-Version: 1.0
Received: from mail.apache.org ([209.237.227.199]) by mc7-f30.hotmail.com 
with Microsoft SMTPSVC(6.0.3790.211); Wed, 20 Apr 2005 11:08:39 -0700
Received: (qmail 58830 invoked by uid 500); 20 Apr 2005 18:08:35 -0000
Received: (qmail 58397 invoked by uid 99); 20 Apr 2005 18:08:33 -0000
Received: pass (hermes.apache.org: local policy)
Received: from junior.lgc.com (HELO junior.lgc.com) (134.132.72.99)  by 
apache.org (qpsmtpd/0.28) with ESMTP; Wed, 20 Apr 2005 11:08:32 -0700
Received: from lgchvw02.landmark.lgc.com (lgchvw02.lgc.com 
[134.132.93.108])by junior.lgc.com (8.11.7/8.11.3) with SMTP id 
j3KI8Qu20166for <user@ant.apache.org>; Wed, 20 Apr 2005 13:08:26 -0500 (CDT)
Received: from 134.132.72.99 by lgchvw02.landmark.lgc.com (InterScan E-Mail 
VirusWall NT); Wed, 20 Apr 2005 13:08:19 -0500
Received: from HOUEXCH903.landmark.lgc.com (houexch903 [134.132.167.43])by 
junior.lgc.com (8.11.7/8.11.3) with ESMTP id j3KI8LN20152for 
<user@ant.apache.org>; Wed, 20 Apr 2005 13:08:21 -0500 (CDT)
Received: from HOUEXCH902.landmark.lgc.com ([134.132.167.38]) by 
HOUEXCH903.landmark.lgc.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 20 
Apr 2005 13:08:14 -0500
X-Message-Info: JGTYoYF78jHBtJd27ft/tzMmo9mYeb8JdSZo9zWlKF4=
Mailing-List: contact user-help@ant.apache.org; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:user-unsubscribe@ant.apache.org>
List-Subscribe: <mailto:user-subscribe@ant.apache.org>
List-Help: <mailto:user-help@ant.apache.org>
List-Post: <mailto:user@ant.apache.org>
List-Id: "Ant Users List" <user.ant.apache.org>
Delivered-To: mailing list user@ant.apache.org
X-ASF-Spam-Status: No, hits=0.0 required=10.0tests=
X-Spam-Check-By: apache.org
X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0
Content-class: urn:content-classes:message
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Thread-Topic: AINASL! Help with Parsing Files with Ant
Thread-Index: AcVF0e6MBN2rEjHOT7G1nFYix5tUlAAASDYQ
X-OriginalArrivalTime: 20 Apr 2005 18:08:14.0991 (UTC) 
FILETIME=[EC0231F0:01C545D3]
X-Virus-Checked: Checked
Return-Path: user-return-49816-xiamak=hotmail.com@ant.apache.org

 > This is how my file should look like at anytime or rather build+1
 >
 > ---------- content of target file [version.txt] --------------
 > [Version]
 > Version=5.0
 > Build=555
 > Date=Wed 04/13/05 05:08:30 PM
 > -------------------------------------------------------

Your problem is that this is not a .properties file, which have
a very specific format and semantic. If you maintained 2 files,
one a real property file with the same info, and another in your
desired format, you should be able to do what you want.

- CVS update both files, version.properties and version.txt
- Manipulate version.properties with <propertyfile>.
- Load the properties (with <property file="">) from the
   updated version.properties
- Simply <echo> your update version.txt file

   <echo file="version.txt">
[Version]
Version=${Version}
Build=${Build}
Date=${Date}
</echo>

You may have to prefix properties when re-loading them,
since Ant properties are immutable.

There are other ways to do this with regular expressions
and the tasks that use them, but I think the dual file
approach above is the simplest, and closest to what you tried.

--DD

---------------------------------------------------------------------
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


Mime
View raw message