You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Jeremy Mawson <je...@qsipayments.com> on 2000/08/22 12:00:57 UTC
[PATCH] PropertyFile task.
PropertyFile task uses java.util.Properties to modify integer, String and
Date settings in a property file.
The following is an example of it's usage:
<target name="testPropertyFiles">
<property
name="COPYRIGHT_MESSAGE"
value="Copyright 2000 Coporation inc\\This file does some of
this\\and some of that" />
<propertyFile key="Int" type="int" operation="=" value="681"
file="test.txt" />
<propertyFile key="IntInc" type="int" operation="+" file="test.txt" />
<propertyFile key="IntDec" type="int" operation="-" file="test.txt" />
<propertyFile key="NeverDate" type="date" operation="never"
file="test.txt" />
<propertyFile key="StringEquals" type="string" value="testValue"
file="test.txt" />
<propertyFile key="NowDate" type="date" operation="now"
file="test.txt" message ="${COPYRIGHT_MESSAGE}" />
</target>
The propertyFile task must have:
key, type, file
Other parameters are:
operation, value, message
Parameter values:
operation:
"=" (set -- default)
"-" (dec)
"+" (inc)
"now" (date and time)
"never" (empty string)
type:
"int"
"date"
"string"
String property types can only use the "=" operation
Date property types can only use the "never" or "now" operations
Int property types can only use the "=", "-" or "+" operations
The message property is used for the property file header, with "\\" being
a newline delimiter charater. (This should be '\n' but I couldn't quite get
it right).
Source attached.
Jeremy