ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: PropertyFile.java ?
Date Tue, 17 Oct 2000 16:14:59 GMT
--- Stefan Bodewig <bodewig@bost.de> wrote:
> I'm not sure I understand the difference between changing the property
> in the file and overwriting the file with one that has the new
> value.

Well, there's the issue of being able to deal individually with the
properties that get written to it, rather than having to keep them all in
some big <echo>. Also, <propertyfile> (yea, I lower-cased the "f" --
seemed inconsistent having it be upper-case) has a date functionality, in
the form of yyyy/mm/dd hh:ss, which is something <tstamp> doesn't provide.
It also has increment and decrement functionality. And it handles putting
a comment-block at the top of the file.

So, for example, my target that gen's the SanityState.java file can deal
with setting only the "sanity" property in the state file, since that's
the only one it's concerned with. On the other hand, my "build" target can
deal with setting the "builddate" and "buildnum" properties (and which I
won't need to provide a <script> task to put together). Other targets will
deal with only setting other properties that concern them. This way, the
state properties that targets set are directly connected to the targets
themselves, and I don't need to have some other target whose sole purpose
is to just keep writing out all the properties the state file contains,
and I won't need to keep maintaining the list of all the state properties,
whenever new ones are added or old ones changed, off in that separate
target.

Anyway, it's just coming in very handy for me, so I thought I'd at least
offer it back out to everyone else. BTW: I have switched to using Nico's
version -- it's cleaner in the way it deals with writing out the
properties to the file. Its format is:
    <propertyfile file="${state.file}" comment="${header}">
      <entry key="product.build.number" type="int"  operation="+" />
      <entry key="product.build.date" type="date" operation="now" />
      <entry key="product.name" type="string" value="${prod}"/>
    </propertyfile>
I did make a few minor changes to it, like changing "message" to be
"comment", since that seemed clearer (and I changed the code to not have
that be called copyrightMessage, since it isn't limited to holding just
copyright information), etc. One thing that does need to still happen for
it is the logging stuff needs to be upgraded to the way that's done now.

Diane



=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf!  It's FREE.
http://im.yahoo.com/

Mime
View raw message