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的更多相关文章
随机推荐
- VCRedist.exe静默安装方法(转)
INNO setup 制作安装包 的时候,发布VC++运行时 [Run]Filename: {app}vcredist_x86.exe; Parameters: /q; WorkingDir: {t ...
- 客户端把rsyslog重启,就会发送全部日志 --待研究
客户端: uat-web02:/var/log/nginx# echo "scan-cccc21231">>scan.log uat-web02:/var/log/ng ...
- 【剑指offer】面试题24:二叉搜索树的后序遍历序列
题目: 输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果.如果是则输出Yes,否则输出No.假设输入的数组的任意两个数字都互不相同. 思路: 递归 注意,主要就是假定数组为空时结果为fa ...
- scroll pagination.js数据重复加载、分页问题
scroll pagination.js数据重复加载.分页问题 解决办法 参考资料: http://blog.csdn.net/dyw442500150/article/details/1753242 ...
- MongoDB的数据类型
最近在写一个lua的MongoDB模块.MongoDB版本3.2,lua则是5.3.1.底层以C++来写,再把函数暴露给lua调用.但是在lua中打印结果时,发现了些奇怪的现象.首先,数据库中的内容: ...
- Jetty监控线程使用情况的配置
Jetty监控线程使用情况配置 第一步,配置xml文件 jetty-monitor.xml 参数说明: threads: 线程池中的线程 busyThreads: 使用中的线程 idleThreads ...
- lesson5:Condition的原理分析及demo展示
Condition 将 Object 监视器方法(wait,notify,和notifyAll)分解成截然不同的对象,以便通过将这些对象与任意Lock实现组合使用,为每个对象提供多个等待 set(wa ...
- Gulp 简单的开发环境搭建
//获取gulp //require()是 node (CommonJS)中获取模块的语法 var gulp=require('gulp'); //获取gulp-concat模块(用于合并文件):np ...
- zeptoJS:如何像jQuery一样,让滚动变得优雅?
利用jQuery的animate() 方法,我们很容易实现滚动条的平滑滚动效果: $(function() { $('#top').click( function (e) { $('html, bod ...
- [Polymer] Custom Elements: Styling
Code: <dom-module id="business-card"> <template> <div class="card" ...