XiaoKL

Android.Tools.Ant

ant

1. ant手册翻译

ant手册翻译是一项大工程!!!!!!

ant在线手册的链接好不明确。

 

2. ant 支持for循环

安装ant-contrib Ref[1.1]. 要在ant的build.xml脚本中支持,参考链接Ref[1.2]。

下面的build.xml是遍历txt文件,将每一行进行输出的ant脚本。Ref[1.3]

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <project name="android_rules" default="iterate">
 3 
 4 <taskdef resource="net/sf/antcontrib/antlib.xml"/>
 5 
 6 <target name="iterate">
 7     <loadfile property="lines" srcFile="CopyRes.txt">
 8         <filterchain>
 9             <filterreader classname="org.apache.tools.ant.filters.StripLineBreaks">
10                   <param name="linebreaks" value="\n"/>
11             </filterreader>
12         </filterchain>
13     </loadfile>
14 
15     <for list="${lines}" param="line">
16          <sequential>
17             <echo>@{line}</echo>
18         </sequential>
19     </for>
20 
21 </target>
22 
23 </project>

 

 


 

Reference

1. ant-contrib

1.1 http://ant-contrib.sourceforge.net

1.2 http://ant-contrib.sourceforge.net/tasks/index.html

1.3 http://stackoverflow.com/questions/5087929/how-to-iterate-over-the-file-content-using-ant-script

2. ant 工程主页

http://ant.apache.org/

Running Apache Ant

Command Line

Running Ant as a background process on Unix(-like) systems

Running Ant via Java

 

Properties

Built-in Properties

PropertyHelpers

Property Expansion

$$ Expansion

Nesting of Braces

Expanding a "Property Name"

If/Unless Attributes

 

Filter

 

 

Typedef

Adds a task or a data type definition to the current project such that this new type or task can

be used in the current project. 

FileSet

A FileSet is a group of files. These files can be found in a directory tree starting in a base directory

and are matched by patterns taken from a number of PatternSets and Selectors

Task

http://ant.apache.org/manual/Tasks/

http://ant.apache.org/manual/Tasks/conditions.html

http://ant-contrib.sourceforge.net/tasks/tasks/index.html

FilterSet

http://ant.apache.org/manual/Types/filterset.html 

FilterSets are groups of filters. Filters can be defined as token-value pairs or be read in from a file.

FilterSets can appear inside tasks that support this feature or at the same level as <target> - i.e., as children of <project>.

FilterChains and FilterReaders

http://ant.apache.org/manual/Types/filterchain.html

   
   
   
   
   
   
   
   
   
   
   
   

posted on 2014-12-14 00:18  XiaoKL  阅读(214)  评论(0编辑  收藏  举报

导航