The IniFileTask
is inspired by the Ant-Contrib IniFile
and can be used to build and edit .ini files. Unlike the Ant equivalent, it can also read values from different
sections of an .ini file and set the retrieved values to specified properties.
Table C.45: Attributes
Name | Type | Description | Default | Required |
---|---|---|---|---|
dest | string | The name of the .ini file to write to. If not specified, the source file will be modified instead. | none | No |
haltOnError | boolean | Should the build fail when problems occur? | false | No |
source | string | The name of the .ini file to read from. If not specified, the dest file will be used instead. | none | No |
get
Use to read a value from a specific key and section of an .ini file
Table C.46: Attributes
Name | Type | Description | Default | Required |
---|---|---|---|---|
default | String | Value to return if section, property or value are not set | n/a | No |
section | String | Name of the section. | n/a | Yes |
property | String | Name of the key, in the specified section, to read | n/a | Yes |
outputproperty | String | Name of the property to set the value to | n/a | Yes |
remove
Use to remove either a specific key or section from an .ini file
Table C.47: Attributes
Name | Type | Description | Default | Required |
---|---|---|---|---|
section | String | Name of the section. | n/a | Yes |
property | String | Name of the key to remove. If not specified the entire section is removed. | n/a | No |
set
Use to set a key in a section to a specific value
Table C.48: Attributes
Name | Type | Description | Default | Required |
---|---|---|---|---|
section | String | Name of the section. | n/a | Yes |
property | String | Name of the key/property. | n/a | Yes |
operation | String | The operation to perform on the existing value, which must be numeric. Possible values are "+" and "-", which add and subtract 1, respectively from the existing value. If the value doesn't already exist, the set is not performed, triggering an error. | n/a | No |
value | String | The new value for the property. | n/a | No, if operation is specified. |
<inifile haltonerror="no" dest="${project.basedir}/application/configs/application.ini"> <set section="production" property="buildTimestamp" value="${DSTAMP}${TSTAMP}" /> <set section="production" property="buildNumber" operation="+" /> <remove section="development : staging" /> </inifile>