JAVA_build_ant_FixCRLF
Description
Adjusts a text file to local conventions.
The set of files to be adjusted can be refined with the includes, includesfile, excludes, excludesfile and defaultexcludes attributes. Patterns provided through the includes or includesfile attributes specify files to be included. Patterns provided through the exclude or excludesfile attribute specify files to be excluded. Additionally, default exclusions can be specified with the defaultexcludes attribute. See the section on directory-based tasks, for details of file inclusion/exclusion patterns and their usage.
This task forms an implicit FileSet and supports most attributes of <fileset>
(dir
becomes srcdir
) as well as the nested <include>
, <exclude>
and <patternset>
elements.
The output file is only written if it is a new file, or if it differs from the existing file. This prevents spurious rebuilds based on unchanged files which have been regenerated by this task.
Since Apache Ant 1.7, this task can be used in a filterchain.
Parameters
Attribute | Description | Required | |
As Task | As Filter | ||
srcDir | Where to find the files to be fixed up. | One of these | |
file | Name of a single file to fix. Since Ant 1.7 | ||
destDir | Where to place the corrected files. Defaults to srcDir (replacing the original file). | No | |
includes | comma- or space-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- or space-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 | |
encoding | The encoding of the files. | No; defaults to default JVM encoding. | |
outputencoding | The encoding to use when writing the files. Since Ant 1.7 | No; defaults to the value of the encoding attribute. | |
preservelastmodified | Whether to preserve the last modified date of source files. Since Ant 1.6.3 | No; default is false | |
eol | Specifies how end-of-line (EOL) characters are to be handled. The EOL characters are CR, LF and the pair CRLF. Valid values for this property are:
Default is based on the platform on which you are running this task. For Unix platforms (including Mac OS X), the default is "lf". For DOS-based systems (including Windows), the default is "crlf". For Mac environments other than OS X, the default is "cr". This is the preferred method for specifying EOL. The "cr" attribute (see below) is now deprecated. N.B.: One special case is recognized. The three characters CR-CR-LF are regarded as a single EOL. Unless this property is specified as "asis", this sequence will be converted into the specified EOL type. |
No | |
cr | Deprecated. Specifies how CR characters are to be handled at end-of-line (EOL). Valid values for this property are:
Default is based on the platform on which you are running this task. For Unix platforms, the default is "remove". For DOS based systems (including Windows), the default is "add". N.B.: One special case is recognized. The three characters CR-CR-LF are regarded as a single EOL. Unless this property is specified as "asis", this sequence will be converted into the specified EOL type. |
No | |
javafiles | Used only in association with the "tab" attribute (see below), this boolean attribute indicates whether the fileset is a set of java source files ("yes"/"no"). Defaults to "no". See notes in section on "tab". | No | |
tab | Specifies how tab characters are to be handled. Valid values for this property are:
Default for this parameter is "asis". N.B.: When the attribute "javafiles" (see above) is "true", literal TAB characters occurring within Java string or character constants are never modified. This functionality also requires the recognition of Java-style comments. N.B.: There is an incompatibility between this and the previous version in the handling of white space at the end of lines. This version does not remove trailing whitespace on lines. |
No | |
tablength | TAB character interval. Valid values are between 2 and 80 inclusive. The 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:
Default is based on the platform on which you are running this task. For Unix platforms, the default is remove. For DOS based systems (including Windows), the default is asis. |
No | |
fixlast | Whether to add a missing EOL to the last line of a processed file. Ignored if EOL is asis. Since Ant 1.6.1 |
No; default is true |
Examples
<fixcrlf srcdir="${src}" includes="**/*.sh"
eol="lf" eof="remove" />
Replaces EOLs with LF characters and removes eof characters from the shell scripts. Tabs and spaces are left as is.
<fixcrlf srcdir="${src}"
includes="**/*.bat" eol="crlf" />
Replaces all EOLs with cr-lf pairs in the batch files. 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}"
includes="**/Makefile" tab="add" />
Sets EOLs according to local OS conventions, and converts sequences of spaces and tabs to the minimal set of spaces and tabs which will maintain spacing within the line. Tabs are set at 8 character intervals. 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}" includes="**/*.java"
tab="remove" tablength="3"
eol="lf" javafiles="yes" />
Converts all EOLs in the included java source files to a single LF. Replace all TAB characters except those in string or character constants with spaces, assuming a tab width of 3. If run on a unix system, any CTRL-Z EOF characters at the end of the file are removed. On DOS/Windows, any such EOF characters will be left untouched.
<fixcrlf srcdir="${src}"
includes="**/README*" tab="remove" />
Sets EOLs according to local OS conventions, and converts all tabs to spaces, assuming a tab width of 8. 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 READMEs.
refer : https://ant.apache.org/manual/Tasks/fixcrlf.html / http://sepp.oetiker.ch/ant-1.6.5-rp/manual/api/org/apache/tools/ant/taskdefs/FixCRLF.html
JAVA_build_ant_FixCRLF的更多相关文章
随机推荐
- java.io.FileNotFoundException: /exapp/hadoop/name/current/VERSION (Permission denied)
http://blog.csdn.net/blackiez/article/details/8570395
- P0口上拉电阻选择
如果是驱动led,那么用1K左右的就行了.如果希望亮度大一些,电阻可减小,最小不要小于200欧姆,否则电流太大:如果希望亮度小一些,电阻可增大,增加到多少呢,主要看亮度情况,以亮度合适为准,一般来说超 ...
- Delphi 自带的 Base64 编解码函数
今天帮别人解决一个关于 Base64 编解码的问题,竟然发现 Delphi 自带了 Base64 编解码的单元,叫 EncdDecd,这名字很拗口而且不直观,估计这是一直很少人关注和知道的原因. 这个 ...
- qt-solutions提供了8个开源项目
其实这是官方提供的源代码,至于为什么会另建项目,而没有整合到QT项目里去,我猜可能有2个原因: 1. 这几个项目本身不完善,并且也不是QT项目的核心,因此没有必要花精力去完善 2. 一定程度上可以维护 ...
- 实现QQslidingMenu侧滑效果学习笔记
声明:只是自己的学习笔记,所以,只作为博友的参考,不喜勿喷 实现思路: 自定义继承HorizontalScrollView的控件 项目github地址: https://github.com/ysno ...
- 求一个数组中第K小的数
面试南大夏令营的同学说被问到了这个问题,我的第一反应是建小顶堆,但是据他说用的是快排的方法说是O(n)的时间复杂度, 但是后来经过我的考证,这个算法在最坏的情况下是O(n^2)的,但是使用堆在一般情况 ...
- CURD
CURD是一个数据库技术中的缩写词,一般的项目开发的各种参数的基本功能都是CURD. 它代表创建(Create).更新(Update).读取(Read)和删除(Delete)操作. CURD 定义了用 ...
- localStrorage、 sessionStorage 、cookie
HTML5中增加了两种全新数据存储方式:Web Storage和Web SQL Database. 前者可用于临时或永久保存客户端的少量数据:后者是客户端本地化的一套数据库系统,可将大量数 ...
- Android编程之ActivityManager: Segmentation fault
今天运行代码时,出现了一个不能运行的故障问题:ActivityManager: Segmentation fault 是的,这个原因网上有诸多解释:包名不能是中文或者非法字符,或者重启新的avd来解决 ...
- SURF特征
了解了SIFT特征后,来学习SURF特征. 虽说是SIFT的一个变种,可是跟SIFT还是有差别的 差别有例如以下: 1.尺度空间的构建(近似)不同. 2.同意尺度空间多层图像同一时候被处理 3.特征点 ...