Adjusts a text file to local.
It is possible to refine the set of files that are being adjusted. This can be done with the includes, includesfile, excludes, excludesfile and defaultexcludes attributes. With the includes or includesfile attribute you specify the files you want to have included by using patterns. The exclude or excludesfile attribute is used to specify the files you want to have excluded. This is also done with patterns. And finally with the defaultexcludes attribute, you can specify whether you want to use default exclusions or not. See the section on directory based tasks, on how the inclusion/exclusion of files works, and how to write patterns.
This task forms an implicit FileSet and
supports all attributes of <fileset>
(dir
becomes srcdir
) as well as the nested
<include>
, <exclude>
and
<patternset>
elements.
Attribute | Description | Required |
srcDir | Where to find the files to be fixed up. | Yes |
destDir | Where to place the corrected files. Defaults to srcDir (replacing the original file) | No |
includes | comma separated list of patterns of files that must be included. All files are included when omitted. | No |
includesfile | the name of a file. Each line of this file is taken to be an include pattern | No |
excludes | comma separated list of patterns of files that must be excluded. No files (except default excludes) are excluded when omitted. | No |
excludesfile | the name of a file. Each line of this file is taken to be an exclude pattern | No |
defaultexcludes | indicates whether default excludes should be used or not ("yes"/"no"). Default excludes are used when omitted. | No |
cr | Specifies how carriage return (CR) characters are to
be handled. Valid values for this property are:
Note: Unless this property is specified as "asis", extra CR characters which do not precede a LF will be removed. |
No |
tab | Specifies how tab characters are to be handled. Valid
values for this property are:
Note: Unless this property is specified as "asis", extra spaces and tabs after the last non-whitespace character on the line will be removed. |
No |
tablength | The number of characters a TAB stop corresponds to. Must be a positive power of 2, default for this parameter is 8. | No |
eof | Specifies how DOS end of file (control-Z) characters are
to be handled. Valid values for this property are:
|
No |
<fixcrlf srcdir="${src}" cr="remove" eof="remove" includes="**/*.sh" />
Removes carriage return and eof characters from the shell scripts. Tabs and spaces are left as is.
<fixcrlf srcdir="${src}" cr="add" includes="**/*.bat" />
Ensures that there are carriage return characters prior to evey line feed. Tabs and spaces are left as is. EOF characters are left alone if run on DOS systems, and are removed if run on Unix systems.
<fixcrlf srcdir="${src}" tabs="add" includes="**/Makefile" />
Adds or removes CR characters to match local OS conventions, and converts spaces to tabs when appropriate. EOF characters are left alone if run on DOS systems, and are removed if run on Unix systems. Many versions of make require tabs prior to commands.
<fixcrlf srcdir="${src}" tabs="remove" includes="**/README*" />
Adds or removes CR characters to match local OS conventions, and converts all tabs to spaces. EOF characters are left alone if run on DOS systems, and are removed if run on Unix systems. You never know what editor a user will use to browse README's.
Copyright © 2000,2001 Apache Software Foundation. All rights Reserved.