From b9421dc80af485591a9c50cc8921f912e0def11e Mon Sep 17 00:00:00 2001
From: Ashlee Young
- An antlib file is an xml file with a root element of "antlib".
- Antlib's elements are Apache Ant definition tasks - like
- Taskdef
- or any Ant task that extends
-
- The current set of declarations bundled with Ant that do this are:
-
- A group of tasks and types may be defined together in an antlib
- file. For example the file sample.xml contains the following:
-
- It defines two types or tasks, if and scriptpathmapper.
- This antlib file may be used in a build script as follows:
-
- The other attributes of
- The definitions may then be used as follows:
-
- The name space URIs with the pattern antlib:java package
- are given special treatment.
-
- When Ant encounters a element with a namespace URI with this pattern, it
- will check to see if there is a resource of the name antlib.xml in
- the package directory in the default classpath.
-
- For example, assuming that the file antcontrib.jar has been placed
- in the directory ${ant.home}/lib and it contains the resource
- net/sf/antcontrib/antlib.xml which has all antcontrib's definitions
- defined, the following build file will automatically load the antcontrib
- definitions at location HERE:
-
- The requirement that the resource is in the default classpath
- may be removed in future versions of Ant.Antlib
-
-
- Description
- org.apache.tools.ant.taskdefs.AntlibDefinition
.
-
-
-
-<?xml version="1.0"?>
-<antlib>
- <typedef name="if" classname="org.acme.ant.If"/>
- <typedef name="scriptpathmapper"
- classname="org.acme.ant.ScriptPathMapper"
- onerror="ignore"/>
- <macrodef name="print">
- <attribute name="file"/>
- <sequential>
- <concat taskname="print">
- <fileset dir="." includes="@{file}"/>
- </concat>
- </sequential>
- </macrodef>
-</antlib>
-
-
-
-
-<typedef file="sample.xml"/>
-
- <typedef>
may be used as well.
- For example, assuming that the sample.xml is in a jar
- file sample.jar also containing the classes, the
- following build fragment will define the if and scriptpathmapper
- tasks/types and place them in the namespace uri samples:/acme.org.
-
-
-
-<typedef resource="org/acme/ant/sample.xml"
- uri="samples:/acme.org"/>
-
-
-
-
-
-
-<sample:if valuetrue="${props}" xmlns:sample="samples:/acme.org">
- <sample:scriptpathmapper language="beanshell">
- some bean shell
- </sample:scriptpathmapper>
-</sample:if>
-
- Antlib namespace
-
-
-
-<project default="deletetest" xmlns:antcontrib="antlib:net.sf.antcontrib">
- <macrodef name="showdir">
- <attribute name="dir"/>
- <sequential>
- <antcontrib:shellscript shell="bash"> <!-- HERE -->
- ls -Rl @{dir}
- </antcontrib:shellscript>
- </sequential>
- </macrodef>
-
- <target name="deletetest">
- <delete dir="a" quiet="yes"/>
- <mkdir dir="a/b"/>
- <touch file="a/a.txt"/>
- <touch file="a/b/b.txt"/>
- <delete>
- <fileset dir="a"/>
- </delete>
- <showdir dir="a"/>
- </target>
-</project>
-
-
- If you want to separate the antlib from your local Ant installation, e.g. because you - want to hold that jar in your projects SCM system, you have to specify a classpath, so - that Ant could find that jar. The best solution is loading the antlib with <taskdef>. -
--- - - - --<project xmlns:antcontrib="antlib:net.sf.antcontrib"> - <taskdef uri="antlib:net.sf.antcontrib" - resource="net/sf/antcontrib/antlib.xml" - classpath="path/to/ant-contrib.jar"/> - - <target name="iterate"> - <antcontrib:for param="file"> - <fileset dir="."/> - <sequential> - <echo message="- @{file}"/> - </sequential> - </antcontrib:for> - </target> -</project> --
- Definitions defined in antlibs may be used in antlibs. However
- the namespace that definitions are placed in are dependent on
- the <typedef>
that uses the antlib. To deal with this
- problem, the definitions are placed in the namespace URI ant:current
- for the duration of the antlib execution.
- For example the following antlib defines the task <if>
, the
- type <isallowed>
and a macro
- <ifallowed>
that makes use of the task and type:
-
-- - --<antlib xmlns:current="ant:current"> - <taskdef name="if" classname="org.acme.ant.If"/> - <typedef name="isallowed" classname="org.acme.ant.Isallowed"/> - <macrodef name="ifallowed"> - <attribute name="action"/> - <element name="do"/> - <sequential> - <current:if> - <current:isallowed test="@{action}"/> - <current:then> - <do/> - </current:then> - </current:if> - </sequential> - </macrodef> -</antlib> --
- Antlibs may make use of other antlibs. -
-
- As the names defined in the antlib are in the namespace uri as
- specified by the calling <typedef>
or by automatic element
- resolution, one may reuse names from core ant types and tasks,
- provided the caller uses a namespace uri. For example, the
- following antlib may be used to define defaults for various
- tasks:
-
---<antlib xmlns:antcontrib="antlib:net.sf.antcontrib"> - <presetdef name="javac"> - <javac deprecation="${deprecation}" - debug="${debug}"/> - </presetdef> - <presetdef name="delete"> - <delete quiet="yes"/> - </presetdef> - <presetdef name="shellscript"> - <antcontrib:shellscript shell="bash"/> - </presetdef> -</antlib> --
- This may be used as follows: -
--- - - - - - diff --git a/framework/src/ant/apache-ant-1.9.6/manual/Types/assertions.html b/framework/src/ant/apache-ant-1.9.6/manual/Types/assertions.html deleted file mode 100644 index e168969f..00000000 --- a/framework/src/ant/apache-ant-1.9.6/manual/Types/assertions.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - --<project xmlns:local="localpresets"> - <typedef file="localpresets.xml" uri="localpresets"/> - <local:shellscript> - echo "hello world" - </local:shellscript> -</project> --
-The assertions type enables or disables the Java 1.4 assertions feature,
-on a whole Java program, or components of a program. It can be used
-in <java>
and
-<junit>
to add extra validation to code.
-
-
-Assertions are covered in the -Java SE documentation, -and the -Java Language Specification. - -
-The key points to note are that a java.lang.AssertionError -is thrown when an assertion fails, and that the facility is only available -on Java 1.4 and later. To enable assertions one must set source="1.4" -(or later) in <javac> when the source is being compiled, and -that the code must contain assert statements to be tested. The -result of such an action is code that neither compiles or runs on earlier -versions of Java. For this reason Apache Ant itself currently contains no assertions. -
- -When assertions are enabled (or disabled) in a task through nested -assertions elements, the class loader or command line is modified with the -appropriate options. This means that the JVM executed must be a Java 1.4 -or later JVM, even if there are no assertions in the code. Attempting to -enable assertions on earlier VMs will result in an "Unrecognized option" -error and the JVM will not start. - -
-
- - -
-Attribute | -Description | -Required | -
enableSystemAssertions | -Flag to turn system assertions on or off. | -No; default is "unspecified" | -
-When system assertions have been neither enabled nor disabled, then -the JVM is not given any assertion information - the default action of the - current JVMs is to disable system assertions. -
-Note also that there is no apparent documentation for what parts of the -JRE come with useful assertions. - -
-Enable assertions in portions of code. -If neither a package nor class is specified, assertions are turned on in all (user) code. -
-Attribute | -Description | -Required | -
class | -The name of a class on which to enable assertions. | -No | -
package | -- The name of a package in which to enable assertions on all classes. (Includes subpackages.) - Use "..." for the anonymous package. - | -No | -
-Disable assertions in portions of code. - -
-Attribute | -Description | -Required | -
class | -The name of a class on which to disable assertions. | -No | -
package | -- The name of a package in which to disable assertions on all classes. (Includes subpackages.) - Use "..." for the anonymous package. - | -No | -
- -Because assertions are disabled by default, it only makes sense to disable -assertions where they have been enabled in a parent package. - - -
-<assertions> - <enable/> -</assertions> -- -
-<assertions> - <enable class="Test"/> -</assertions> -- -
-<assertions> - <enable package="org.apache"/> -</assertions> -- -
-<assertions enableSystemAssertions="true"> - <enable package="org.apache"/> - <disable package="org.apache.tools.ant"/> - <enable class="org.apache.tools.ant.Main"/> -</assertions> -- -
-<assertions enableSystemAssertions="false"> - <enable package="..."/> -</assertions> -- - -
-<assertions id="project.assertions"> - <enable package="org.apache.test"/> -</assertions> - -<assertions refid="project.assertions"/> -- - - - diff --git a/framework/src/ant/apache-ant-1.9.6/manual/Types/classfileset.html b/framework/src/ant/apache-ant-1.9.6/manual/Types/classfileset.html deleted file mode 100644 index 6145d979..00000000 --- a/framework/src/ant/apache-ant-1.9.6/manual/Types/classfileset.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - -
A classfileset is a specialized type of fileset which, given a set of -"root" classes, will include all of the class files upon which the -root classes depend. This is typically used to create a jar with all of the -required classes for a particular application. -
--classfilesets are typically used by reference. They are declared with an -"id" value and this is then used as a reference where a normal fileset -is expected. -
-
-This type requires the BCEL
library.
-
The class fileset support the following attributes in addition -to those supported by the -standard fileset: -
- -Attribute | -Description | -Required | -
rootclass | -A single root class name | -No | -
-When more than one root class is required, multiple nested <root>
elements
-may be used
-
Attribute | -Description | -Required | -
classname | -The fully qualified name of the root class | -Yes | -
-A root fileset is used to add a set of root classes from a fileset. In this case the entries in
-the fileset are expected to be Java class files. The name of the Java class is determined by the
-relative location of the classfile in the fileset. So, the file
-org/apache/tools/ant/Project.class
corresponds to the Java class
-org.apache.tools.ant.Project
.
- --<classfileset id="reqdClasses" dir="${classes.dir}"> - <root classname="org.apache.tools.ant.Project"/> -</classfileset> -
This example creates a fileset containing all the class files upon which the
-org.apache.tools.ant.Project
class depends. This fileset could
-then be used to create a jar.
-
- --<jar destfile="minimal.jar"> - <fileset refid="reqdClasses"/> -</jar> -
- --<classfileset id="reqdClasses" dir="${classes.dir}"> - <rootfileset dir="${classes.dir}" includes="org/apache/tools/ant/Project*.class"/> -</classfileset> -
This example constructs the classfileset using all the class with names starting with Project -in the org.apache.tools.ant package
- - - - - - diff --git a/framework/src/ant/apache-ant-1.9.6/manual/Types/custom-programming.html b/framework/src/ant/apache-ant-1.9.6/manual/Types/custom-programming.html deleted file mode 100644 index 96bade33..00000000 --- a/framework/src/ant/apache-ant-1.9.6/manual/Types/custom-programming.html +++ /dev/null @@ -1,415 +0,0 @@ - - - - - -- Custom components are conditions, selectors, filters and other - objects that are defined outside Apache Ant core. -
-- In Ant 1.6 custom conditions, selectors and filters has - been overhauled. -
-- It is now possible to define custom conditions, selectors and filters - that behave like Ant Core components. - This is achieved by allowing datatypes defined in build scripts - to be used as custom components if the class of the datatype - is compatible, or has been adapted by an adapter class. -
-- The old methods of defining custom components are still supported. -
-- A custom component is a normal Java class that implements a particular - interface or extends a particular class, or has been adapted to the - interface or class. -
-- It is exactly like writing a - custom task. - One defines attributes and nested elements by writing setter - methods and add methods. -
-
- After the class has been written, it is added to the ant system
- by using <typedef>
.
-
- Custom conditions are datatypes that implement
- org.apache.tools.ant.taskdefs.condition.Condition
.
- For example a custom condition that returns true if a
- string is all upper case could be written as:
-
-- --package com.mydomain; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.taskdefs.condition.Condition; - -public class AllUpperCaseCondition implements Condition { - private String value; - - // The setter for the "value" attribute - public void setValue(String value) { - this.value = value; - } - - // This method evaluates the condition - public boolean eval() { - if (value == null) { - throw new BuildException("value attribute is not set"); - } - return value.toUpperCase().equals(value); - } -} --
- Adding the condition to the system is achieved as follows: -
----<typedef - name="alluppercase" - classname="com.mydomain.AllUpperCaseCondition" - classpath="${mydomain.classes}"/> --
- This condition can now be used wherever a Core Ant condition - is used. -
----<condition property="allupper"> - <alluppercase value="THIS IS ALL UPPER CASE"/> -</condition> --
- Custom selectors are datatypes that implement
- org.apache.tools.ant.types.selectors.FileSelector
.
-
There is only one method required.
- public boolean isSelected(File basedir, String filename,
- File file)
.
- It returns true
- or false depending on whether the given file should be
- selected or not.
-
- An example of a custom selection that selects filenames ending - in ".java" would be: -
----package com.mydomain; -import java.io.File; -import org.apache.tools.ant.types.selectors.FileSelector; -public class JavaSelector implements FileSelector { - public boolean isSelected(File b, String filename, File f) { - return filename.toLowerCase().endsWith(".java"); - } -} --
- Adding the selector to the system is achieved as follows: -
----<typedef - name="javaselector" - classname="com.mydomain.JavaSelector" - classpath="${mydomain.classes}"/> --
- This selector can now be used wherever a Core Ant selector - is used, for example: -
--- --<copy todir="to"> - <fileset dir="src"> - <javaselector/> - </fileset> -</copy> --
- One may use
- org.apache.tools.ant.types.selectors.BaseSelector
,
- a convenience class that provides reasonable default
- behaviour.
- It has some predefined behaviours you can take advantage
- of. Any time you encounter a problem when setting attributes or
- adding tags, you can call setError(String errmsg) and the class
- will know that there is a problem. Then, at the top of your
- isSelected()
method call validate()
and
- a BuildException will be thrown with the contents of your error
- message. The validate()
method also gives you a
- last chance to check your settings for consistency because it
- calls verifySettings()
. Override this method and
- call setError()
within it if you detect any
- problems in how your selector is set up.
-
- To write custom selector containers one should extend
- org.apache.tools.ant.types.selectors.BaseSelectorContainer
.
- Implement the
- public boolean isSelected(File baseDir, String filename, File file)
- method to do the right thing. Chances are you'll want to iterate
- over the selectors under you, so use
- selectorElements()
to get an iterator that will do
- that.
-
- For example to create a selector container that will select files - if a certain number of contained selectors select, one could write - a selector as follows: -
----public class MatchNumberSelectors extends BaseSelectorContainer { - private int number = -1; - public void setNumber(int number) { - this.number = number; - } - public void verifySettings() { - if (number < 0) { - throw new BuildException("Number attribute should be set"); - } - } - public boolean isSelected(File baseDir, String filename, File file) { - validate(); - int numberSelected = 0; - for (Enumeration e = selectorElements(); e.hasNextElement();) { - FileSelector s = (FileSelector) e.nextElement(); - if (s.isSelected(baseDir, filename, file)) { - numberSelected++; - } - } - return numberSelected == number; - } -} --
- To define and use this selector one could do: -
----<typedef name="numberselected" - classname="com.mydomain.MatchNumberSelectors"/> -... -<fileset dir="${src.path}"> - <numberselected number="2"> - <contains text="script" casesensitive="no"/> - <size value="4" units="Ki" when="more"/> - <javaselector/> - </numberselected> -</fileset> --
- The custom selector -
-- The custom selector was the pre ant 1.6 way of defining custom selectors. - This method is still supported for backward compatibility. -
-You can write your own selectors and use them within the selector
- containers by specifying them within the <custom>
tag.
To create a new Custom Selector, you have to create a class that
- implements
- org.apache.tools.ant.types.selectors.ExtendFileSelector
.
- The easiest way to do that is through the convenience base class
- org.apache.tools.ant.types.selectors.BaseExtendSelector
,
- which provides all of the methods for supporting
- <param>
tags. First, override the
- isSelected()
method, and optionally the
- verifySettings()
method. If your custom
- selector requires parameters to be set, you can also override
- the setParameters()
method and interpret the
- parameters that are passed in any way you like. Several of the
- core selectors demonstrate how to do that because they can
- also be used as custom selectors.
Once that is written, you include it in your build file by using
- the <custom>
tag.
-
Attribute | -Description | -Required | -
classname | -The name of your class that implements
- org.apache.tools.ant.types.selectors.FileSelector .
- |
- Yes | -
classpath | -The classpath to use in order to load the - custom selector class. If neither this classpath nor the - classpathref are specified, the class will be - loaded from the classpath that Ant uses. - | -No | -
classpathref | -A reference to a classpath previously - defined. If neither this reference nor the - classpath above are specified, the class will be - loaded from the classpath that Ant uses. - | -No | -
Here is how you use <custom>
to
- use your class as a selector:
-
- - --<fileset dir="${mydir}" includes="**/*"> - <custom classname="com.mydomain.MySelector"> - <param name="myattribute" value="myvalue"/> - </custom> -</fileset> -
The core selectors that can also be used as custom selectors - are
- -org.apache.tools.ant.types.selectors.ContainsSelector
- org.apache.tools.ant.types.selectors.DateSelector
- org.apache.tools.ant.types.selectors.DepthSelector
- org.apache.tools.ant.types.selectors.FilenameSelector
- org.apache.tools.ant.types.selectors.SizeSelector
- Here is the example from the Depth Selector section rewritten
- to use the selector through <custom>
.
- --<fileset dir="${doc.path}" includes="**/*"> - <custom classname="org.apache.tools.ant.types.selectors.DepthSelector"> - <param name="max" value="1"/> - </custom> -</fileset> -
Selects all files in the base directory and one directory below - that.
- -
- Custom filter readers selectors are datatypes that implement
- org.apache.tools.ant.types.filters.ChainableReader
.
-
There is only one method required.
- Reader chain(Reader reader)
.
- This returns a reader that filters input from the specified
- reader.
-
- For example a filterreader that removes every second character - could be: -
----public class RemoveOddCharacters implements ChainableReader { - public Reader chain(Reader reader) { - return new BaseFilterReader(reader) { - int count = 0; - public int read() throws IOException { - while (true) { - int c = in.read(); - if (c == -1) { - return c; - } - count++; - if ((count % 2) == 1) { - return c; - } - } - } - } - } -} --
- For line oriented filters it may be easier to extend
- ChainableFilterReader
an inner class of
- org.apache.tools.ant.filters.TokenFilter
.
-
- For example a filter that appends the line number could be -
--- - --public class AddLineNumber extends ChainableReaderFilter { - private void lineNumber = 0; - public String filter(String string) { - lineNumber++; - return "" + lineNumber + "\t" + string; - } -} --
Allows for a description of the project to be specified that
-will be included in the output of the ant ‑projecthelp
-command.
(none)
--<description> -This buildfile is used to build the Foo subproject within -the large, complex Bar project. -</description> -- - - - - diff --git a/framework/src/ant/apache-ant-1.9.6/manual/Types/dirset.html b/framework/src/ant/apache-ant-1.9.6/manual/Types/dirset.html deleted file mode 100644 index 0434e9c2..00000000 --- a/framework/src/ant/apache-ant-1.9.6/manual/Types/dirset.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - -
A DirSet is a group of directories. These directories 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. -
-PatternSets can be specified as nested
-<patternset>
elements. In addition, DirSet holds
-an implicit PatternSet and supports the nested
-<include>
, <includesfile>
,
-<exclude>
and <excludesfile>
-elements of <patternset>
directly, as well as
-<patternset>
's attributes.
Selectors are available as nested elements within the DirSet.
-If any of the selectors within the DirSet do not select the directory, it
-is not considered part of the DirSet. This makes a DirSet
-equivalent to an <and>
selector container.
Attribute | -Description | -Required | -
dir | -The root of the directory tree of this DirSet. | -Yes | -
includes | -A comma- or space-separated list of patterns of directories that - must be included; all directories are included when omitted. | -No | -
includesfile | -The name of a file; each line of this file is - taken to be an include pattern. - Note: if the file is empty and there are no other - patterns defined for the fileset, all directories will be included. - | -No | -
excludes | -A comma- or space-separated list of patterns of directories that - must be excluded; no directories are excluded when omitted. | -No | -
excludesfile | -The name of a file; each line of this file is - taken to be an exclude pattern. | -No | -
casesensitive | -Specifies whether case-sensitivity should be applied
- (true |yes |on or
- false |no |off ). |
- No; defaults to true. | -
followsymlinks | -Shall symbolic links be followed? Defaults to - true. See fileset's documentation. | -No | -
erroronmissingdir | -- Specify what happens if the base directory does not exist. - If true a build error will happen, if false, the dirset - will be ignored/empty. - Defaults to true. - Since Apache Ant 1.7.1 (default is true for backward compatibility - reasons.) - | -No | -
--<dirset dir="${build.dir}"> - <include name="apps/**/classes"/> - <exclude name="apps/**/*Test*"/> -</dirset> -
Groups all directories named classes
found under the
-apps
subdirectory of ${build.dir}
, except those
-that have the text Test
in their name.
--<dirset dir="${build.dir}"> - <patternset id="non.test.classes"> - <include name="apps/**/classes"/> - <exclude name="apps/**/*Test*"/> - </patternset> -</dirset> -
Groups the same directories as the above example, but also establishes
-a PatternSet that can be referenced in other
-<dirset>
elements, rooted at a different directory.
--<dirset dir="${debug_build.dir}"> - <patternset refid="non.test.classes"/> -</dirset> -
Groups all directories in directory ${debug_build.dir}
,
-using the same patterns as the above example.
--<dirset id="dirset" dir="${workingdir}"> - <present targetdir="${workingdir}"> - <mapper type="glob" from="*" to="*/${markerfile}" /> - </present> -</dirset> -
Selects all directories somewhere under ${workingdir}
-which contain a ${markerfile}
.
Utility type that represents either an available "Optional Package" - (formerly known as "Standard Extension") as described in the manifest - of a JAR file, or the requirement for such an optional package.
-Note that this type
-works with extensions as defined by the "Optional Package" specification.
- For more information about optional packages, see the document
-Optional Package Versioning in the documentation bundle for your
-Java2 Standard Edition package, in file
-guide/extensions/versioning.html
or the online
-
-Package Versioning documentation.
The extension type supports the following attributes: -
- -Attribute | -Description | -Required | -
extensionName | -The name of extension | -yes | -
specificationVersion | -The version of extension specification (Must be in - dewey decimal aka dotted decimal notation. 3.2.4) | -no | -
specificationVendor | -The specification vendor | -no | -
implementationVersion | -The version of extension implementation (Must be in - dewey decimal aka dotted decimal notation. 3.2.4) | -no | -
implementationVendor | -The implementation vendor | -no | -
implementationVendorId | -The implementation vendor ID | -no | -
implementationURL | -The url from which to retrieve extension. | -no | -
- --<extension id="e1" - extensionName="MyExtensions" - specificationVersion="1.0" - specificationVendor="Peter Donald" - implementationVendorID="vv" - implementationVendor="Apache" - implementationVersion="2.0" - implementationURL="http://somewhere.com/myExt.jar"/> -
Fully specific extension object.
- -- --<extension id="e1" - extensionName="MyExtensions" - specificationVersion="1.0" - specificationVendor="Peter Donald"/> -
Extension object that just species the specification details.
- - - - - - diff --git a/framework/src/ant/apache-ant-1.9.6/manual/Types/extensionset.html b/framework/src/ant/apache-ant-1.9.6/manual/Types/extensionset.html deleted file mode 100644 index f38c1ed1..00000000 --- a/framework/src/ant/apache-ant-1.9.6/manual/Types/extensionset.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - -Utility type that represents a set of Extensions.
-Note that this type
-works with extensions as defined by the "Optional Package" specification.
- For more information about optional packages, see the document
-Optional Package Versioning in the documentation bundle for your
-Java2 Standard Edition package, in file
-guide/extensions/versioning.html
or online at
-
-Package Versioning documentation.
Extension object to add to set.
- -FileSets all files contained - contained within set that are jars and implement an extension are added - to extension set.
- -All files contained contained within set that are jars and implement - an extension are added to extension set. However the extension information - may be modified by attributes of libfileset
- -- - - - - - diff --git a/framework/src/ant/apache-ant-1.9.6/manual/Types/filelist.html b/framework/src/ant/apache-ant-1.9.6/manual/Types/filelist.html deleted file mode 100644 index 57c981d3..00000000 --- a/framework/src/ant/apache-ant-1.9.6/manual/Types/filelist.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - --<extension id="e1" - extensionName="MyExtensions" - specificationVersion="1.0" - specificationVendor="Peter Donald" - implementationVendorID="vv" - implementationVendor="Apache" - implementationVersion="2.0" - implementationURL="http://somewhere.com/myExt.jar"/> - -<libfileset id="lfs" - includeUrl="true" - includeImpl="false" - dir="tools/lib"> - <include name="*.jar"/> -</libfileset> - -<extensionSet id="exts"> - <libfileset dir="lib"> - <include name="*.jar"/> - </libfileset> - <libfileset refid="lfs"/> - <extension refid="e1"/> -</extensionSet> - -
FileLists are explicitly named lists of files. Whereas FileSets -act as filters, returning only those files that exist in the file -system and match specified patterns, FileLists are useful for -specifying files that may or may not exist. Multiple files are -specified as a list of files, relative to the specified directory, -with no support for wildcard expansion (filenames with wildcards will be -included in the list unchanged). -FileLists can appear inside tasks that support this feature or as stand-alone -types. -
-Attribute | -Description | -Required | -
dir | -The base directory of this FileList. | -Yes | -
files | -The list of file names. This is a list of - file name separated by whitespace, or by commas. | -- Yes, unless there is a nested file element | -
- This represents a file name. The nested element allows filenames containing - white space and commas. -
-Since Apache Ant 1.6.2
-Attribute | -Description | -Required | -
name | -The name of the file. | -Yes | -
- --<filelist - id="docfiles" - dir="${doc.src}" - files="foo.xml,bar.xml"/> -
The files ${doc.src}/foo.xml
and
-${doc.src}/bar.xml
. Note that these files may not (yet)
-actually exist.
-
- --<filelist - id="docfiles" - dir="${doc.src}" - files="foo.xml - bar.xml"/> -
Same files as the example above.
- -- --<filelist refid="docfiles"/> -
Same files as the example above.
- -- --<filelist - id="docfiles" - dir="${doc.src}"> - <file name="foo.xml"/> - <file name="bar.xml"/> -</filelist> -
Same files as the example above.
- - - - - - diff --git a/framework/src/ant/apache-ant-1.9.6/manual/Types/fileset.html b/framework/src/ant/apache-ant-1.9.6/manual/Types/fileset.html deleted file mode 100644 index 9a7c7d71..00000000 --- a/framework/src/ant/apache-ant-1.9.6/manual/Types/fileset.html +++ /dev/null @@ -1,186 +0,0 @@ - - - - - - -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. -
PatternSets can be specified as nested
-<patternset>
elements. In addition, FileSet holds
-an implicit PatternSet and supports the nested
-<include>
, <includesfile>
,
-<exclude>
and <excludesfile>
-elements of PatternSet directly, as well as PatternSet's
-attributes.
Selectors are available as nested elements within the FileSet.
-If any of the selectors within the FileSet do not select the file, the
-file is not considered part of the FileSet. This makes a FileSet
-equivalent to an <and>
selector container.
Attribute | -Description | -Required | -
dir | -the root of the directory tree of this FileSet. | -Either dir or file must be specified | -
file | -shortcut for specifying a single-file fileset | -|
defaultexcludes | -indicates whether default excludes should be used or not
- (yes | no ); default excludes are used when omitted. |
- 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. - Note: if the file is empty and there are no other - patterns defined for the fileset, all files will be included. - |
- 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 | -
casesensitive | -Must the include and exclude patterns be treated in a case sensitive way? - Defaults to true. | -No | -
followsymlinks | -Shall symbolic links be followed? Defaults to - true. See the note below. | -No | -
erroronmissingdir | -- Specify what happens if the base directory does not exist. - If true a build error will happen, if false, the fileset - will be ignored/empty. - Defaults to true. - Since Apache Ant 1.7.1 (default is true for backward compatibility - reasons.) - | -No | -
Note: All files/directories for which -the canonical path is different from its path are considered symbolic -links. On Unix systems this usually means the file really is a -symbolic link but it may lead to false results on other -platforms.
- ---<fileset dir="${server.src}" casesensitive="yes"> - <include name="**/*.java"/> - <exclude name="**/*Test*"/> -</fileset> -
Groups all files in directory ${server.src}
that are Java
-source files and don't have the text Test
in their
-name.
--<fileset dir="${server.src}" casesensitive="yes"> - <patternset id="non.test.sources"> - <include name="**/*.java"/> - <exclude name="**/*Test*"/> - </patternset> -</fileset> -
Groups the same files as the above example, but also establishes
-a PatternSet that can be referenced in other
-<fileset>
elements, rooted at a different directory.
--<fileset dir="${client.src}" > - <patternset refid="non.test.sources"/> -</fileset> -
Groups all files in directory ${client.src}
, using the
-same patterns as the above example.
--<fileset dir="${server.src}" casesensitive="yes"> - <filename name="**/*.java"/> - <filename name="**/*Test*" negate="true"/> -</fileset> -
Groups the same files as the top example, but using the
-<filename>
selector.
--<fileset dir="${server.src}" casesensitive="yes"> - <filename name="**/*.java"/> - <not> - <filename name="**/*Test*"/> - </not> -</fileset> -
Groups the same files as the previous example using a combination of the
-<filename>
selector and the <not>
-selector container.
--<fileset dir="src" includes="main/" /> -
Selects all files in src/main (e.g. src/main/Foo.java or -src/main/application/Bar.java).
- - - - - - diff --git a/framework/src/ant/apache-ant-1.9.6/manual/Types/filterchain.html b/framework/src/ant/apache-ant-1.9.6/manual/Types/filterchain.html deleted file mode 100644 index 4de10ea3..00000000 --- a/framework/src/ant/apache-ant-1.9.6/manual/Types/filterchain.html +++ /dev/null @@ -1,1739 +0,0 @@ - - - - - - -
-
-cat foo|head -n10|grep blee > bar
-
-Apache Ant was not flexible enough. There was no way for the
-<copy>
task to do something similar. If you wanted
-the <copy>
task to get the first 10 lines, you would have
-had to create special attributes:
-
-<copy file="foo" tofile="bar" head="10" contains="blee"/>
-
-The obvious problem thus surfaced: Ant tasks would not be able -to accommodate such data transformation attributes as they would -be endless. The task would also not know in which order these -attributes were to be interpreted. That is, must the task execute the -contains attribute first and then the head attribute or vice-versa? -What Ant tasks needed was a mechanism to allow pluggable filter (data -transformer) chains. Ant would provide a few filters for which there -have been repeated requests. Users with special filtering needs -would be able to easily write their own and plug them in.
-
-The solution was to refactor data transformation oriented
-tasks to support FilterChains. A FilterChain is a group of
-ordered FilterReaders. Users can define their own FilterReaders
-by just extending the java.io.FilterReader class. Such custom
-FilterReaders can be easily plugged in as nested elements of
-<filterchain>
by using <filterreader>
elements.
-
-Example: -
- -Ant provides some built-in filter readers. These filter readers -can also be declared using a syntax similar to the above syntax. -However, they can be declared using some simpler syntax also.-<copy file="${src.file}" tofile="${dest.file}"> - <filterchain> - <filterreader classname="your.extension.of.java.io.FilterReader"> - <param name="foo" value="bar"/> - </filterreader> - <filterreader classname="another.extension.of.java.io.FilterReader"> - <classpath> - <pathelement path="${classpath}"/> - </classpath> - <param name="blah" value="blee"/> - <param type="abra" value="cadabra"/> - </filterreader> - </filterchain> -</copy> -
-Example: -
-is equivalent to: --<loadfile srcfile="${src.file}" property="src.file.head"> - <filterchain> - <headfilter lines="15"/> - </filterchain> -</loadfile> -
- -The following built-in tasks support nested-<loadfile srcfile="${src.file}" property="src.file.head"> - <filterchain> - <filterreader classname="org.apache.tools.ant.filters.HeadFilter"> - <param name="lines" value="15"/> - </filterreader> - </filterchain> -</loadfile> -
<filterchain>
elements.Attribute | -Description | -Required | -
classname | -The class name of the filter reader. | -Yes | -
-
<filterreader>
supports <classpath>
and <param>
-as nested elements. Each <param>
element may take in the following
-attributes - name, type and value.
--The following FilterReaders are supplied with the default -distribution. - -
- This filters basic constants defined in a Java Class, - and outputs them in lines composed of the format name=value. - This filter uses the bcel library to understand the Java Class file. - See Library Dependencies. -
-
- Important: - This filter is different from most of the other filters. - Most of the filters operate on a sequence of characters. - This filter operates on the sequence of bytes that makes up - a class. However the bytes arrive to the filter as a sequence - of characters. This means that one must be careful on the - choice of character encoding to use. Most encoding lose information - on conversion from an arbitrary sequence of bytes to characters - and back again to bytes. In particular the usual default - character encodings (CP152 and UTF-8) do. - For this reason, since Ant 1.7, the character - encoding ISO-8859-1 is used to convert from characters back to - bytes, so one has to use this encoding for reading the java - class file. -
- -This loads the constants from a Java class file as Ant properties, -prepending the names with a prefix. - --<loadproperties srcfile="foo.class" encoding="ISO-8859-1"> - <filterchain> - <classconstants/> - </filterchain> -</loadproperties> -
--<loadproperties srcfile="build/classes/org/acme/bar.class" - encoding="ISO-8859-1"> - <filterchain> - <classconstants/> - <prefixlines prefix="ini."/> - </filterchain> -</loadproperties> -
-This filter converts its input by changing all non US-ASCII characters -into their equivalent unicode escape backslash u plus 4 digits.
- -since Ant 1.6
- -- -Convenience method: --<loadproperties srcfile="non_ascii_property.properties"> - <filterchain> - <filterreader classname="org.apache.tools.ant.filters.EscapeUnicode"/> - </filterchain> -</loadproperties> -
- --<loadproperties srcfile="non_ascii_property.properties"> - <filterchain> - <escapeunicode/> - </filterchain> -</loadproperties> -
-If the data contains data that represents Ant -properties (of the form ${...}), that is substituted -with the property's actual value. -
-
- -Convenience method: --<echo - message="All these moments will be lost in time, like teardrops in the ${weather}" - file="loadfile1.tmp" - /> -<property name="weather" value="rain"/> -<loadfile property="modifiedmessage" srcFile="loadfile1.tmp"> - <filterchain> - <filterreader classname="org.apache.tools.ant.filters.ExpandProperties"/> - </filterchain> -</loadfile> -
- --<echo - message="All these moments will be lost in time, like teardrops in the ${weather}" - file="loadfile1.tmp" - /> -<property name="weather" value="rain"/> -<loadfile property="modifiedmessage" srcFile="loadfile1.tmp"> - <filterchain> - <expandproperties/> - </filterchain> -</loadfile> -
As of Ant 1.8.3, a nested - PropertySet can be specified: - -
- --<property name="weather" value="rain"/> -<loadfile property="modifiedmessage" srcFile="loadfile1.tmp"> - <filterchain> - <expandproperties> - <propertyset> - <propertyref name="weather" /> - </propertyset> - </expandproperties> - </filterchain> -</loadfile> -
Parameter Name | -Parameter Value | -Required | -
lines | -Number of lines to be read.
- Defaults to "10" A negative value means that all lines are - passed (useful with skip) |
- No | -
skip | -Number of lines to be skipped (from the beginning). - Defaults to "0" | -No | -
-
- -Convenience method: --<loadfile srcfile="${src.file}" property="src.file.head"> - <filterchain> - <filterreader classname="org.apache.tools.ant.filters.HeadFilter"> - <param name="lines" value="15"/> - </filterreader> - </filterchain> -</loadfile> -
- -This stores the first 15 lines, skipping the first 2 lines, of the supplied data -in the property src.file.head. (Means: lines 3-17) --<loadfile srcfile="${src.file}" property="src.file.head"> - <filterchain> - <headfilter lines="15"/> - </filterchain> -</loadfile> -
- -See the testcases for more examples (src\etc\testcases\filters\head-tail.xml in the -source distribution). - --<loadfile srcfile="${src.file}" property="src.file.head"> - <filterchain> - <headfilter lines="15" skip="2"/> - </filterchain> -</loadfile> -
Parameter Type | -Parameter Value | -Required | -
contains | -Substring to be searched for. | -Yes | -
negate | -Whether to select - non-matching lines only. Since Ant 1.7 | -No | -
-
foo
and
-bar
.
-- -Convenience method: --<filterreader classname="org.apache.tools.ant.filters.LineContains"> - <param type="contains" value="foo"/> - <param type="contains" value="bar"/> -</filterreader> -
- -Negation: --<linecontains> - <contains value="foo"/> - <contains value="bar"/> -</linecontains> -
-or --<filterreader classname="org.apache.tools.ant.filters.LineContains"> - <param type="negate" value="true"/> - <param type="contains" value="foo"/> - <param type="contains" value="bar"/> -</filterreader> -
- --<linecontains negate="true"> - <contains value="foo"/> - <contains value="bar"/> -</linecontains> -
Parameter Type | -Parameter Value | -Required | -
regexp | -Regular expression to be searched for. | -Yes | -
negate | -Whether to select - non-matching lines only. Since Ant 1.7 | -No | -
casesensitive | -Perform a case sensitive - match. Default is true. Since Ant 1.8.2 | -No | -
foo
-- -Convenience method: --<filterreader classname="org.apache.tools.ant.filters.LineContainsRegExp"> - <param type="regexp" value="foo*"/> -</filterreader> -
- -Negation: --<linecontainsregexp> - <regexp pattern="foo*"/> -</linecontainsregexp> -
-or --<filterreader classname="org.apache.tools.ant.filters.LineContainsRegExp"> - <param type="negate" value="true"/> - <param type="regexp" value="foo*"/> -</filterreader> -
- --<linecontainsregexp negate="true"> - <regexp pattern="foo*"/> -</linecontainsregexp> -
Parameter Name | -Parameter Value | -Required | -
prefix | -Prefix to be attached to lines. | -Yes | -
-
Foo
to all lines.
-- -Convenience method: --<filterreader classname="org.apache.tools.ant.filters.PrefixLines"> - <param name="prefix" value="Foo"/> -</filterreader> -
- --<prefixlines prefix="Foo"/> -
since Ant 1.8.0
- -Parameter Name | -Parameter Value | -Required | -
suffix | -Suffix to be attached to lines. | -Yes | -
-
Foo
to all lines.
-- -Convenience method: --<filterreader classname="org.apache.tools.ant.filters.SuffixLines"> - <param name="suffix" value="Foo"/> -</filterreader> -
- --<suffixlines suffix="Foo"/> -
Parameter Type | -Parameter Name | -Parameter Value | -Required | -
tokenchar | -begintoken | -String marking the - beginning of a token. Defaults to @ | -No | -
tokenchar | -endtoken | -String marking the - end of a token. Defaults to @ | -No | -
User defined String. | -token | -User defined search String. | -Yes | -
Not applicable. | -propertiesfile | -Properties file to take tokens from. | -No | -
Not applicable. | -propertiesResource | -Properties resource to take tokens from.
- Note this only works is you use the
- "convenience" <replacetokens> syntax.
- since Ant 1.8.0 |
- No | -
User defined String. | -value | -Replace-value for the token | -No | -
- -
- -Convenience method: --<tstamp/> -<!-- just for explaining the use of the properties --> -<property name="src.file" value="orders.csv"/> -<property name="src.file.replaced" value="orders.replaced"/> - -<!-- do the loading and filtering --> -<loadfile srcfile="${src.file}" property="${src.file.replaced}"> - <filterchain> - <filterreader classname="org.apache.tools.ant.filters.ReplaceTokens"> - <param type="token" name="DATE" value="${TODAY}"/> - </filterreader> - </filterchain> -</loadfile> - -<!-- just for explaining the use of the properties --> -<echo message="${orders.replaced}"/> -
- -This replaces occurrences of the string {{DATE}} in the data -with today's date and stores it in the property ${src.file.replaced}. --<tstamp/> -<loadfile srcfile="${src.file}" property="${src.file.replaced}"> - <filterchain> - <replacetokens> - <token key="DATE" value="${TODAY}"/> - </replacetokens> - </filterchain> -</loadfile> -
- -Convenience method: --<loadfile srcfile="${src.file}" property="${src.file.replaced}"> - <filterchain> - <filterreader classname="org.apache.tools.ant.filters.ReplaceTokens"> - <param type="tokenchar" name="begintoken" value="{{"/> - <param type="tokenchar" name="endtoken" value="}}"/> - </filterreader> - </filterchain> -</loadfile> -
- -This will treat each properties file entry in sample.properties as a token/key pair : --<tstamp/> -<loadfile srcfile="${src.file}" property="${src.file.replaced}"> - <filterchain> - <replacetokens begintoken="{{" endtoken="}}"> - <token key="DATE" value="${TODAY}"/> - </replacetokens> - </filterchain> -</loadfile> -
- -This reads the properties from an Ant resource referenced by its id: --<loadfile srcfile="${src.file}" property="${src.file.replaced}"> - <filterchain> - <filterreader classname="org.apache.tools.ant.filters.ReplaceTokens"> - <param type="propertiesfile" value="sample.properties"/> - </filterreader> - </filterchain> -</loadfile> -
- --<string id="embedded-properties"> -foo=bar -baz=xyzzy -</string> -<loadfile srcfile="${src.file}" property="${src.file.replaced}"> - <filterchain> - <replacetokens propertiesResource="${ant.refid:embedded-properties}"/> - </filterchain> -</loadfile> -
-
- -Convenience method: --<loadfile srcfile="${java.src.file}" property="${java.src.file.nocomments}"> - <filterchain> - <filterreader classname="org.apache.tools.ant.filters.StripJavaComments"/> - </filterchain> -</loadfile> -
- --<loadfile srcfile="${java.src.file}" property="${java.src.file.nocomments}"> - <filterchain> - <stripjavacomments/> - </filterchain> -</loadfile> -
Parameter Name | -Parameter Value | -Required | -
linebreaks | -Characters that are to - be stripped out. Defaults to "\r\n" | -No | -
-
- -Convenience method: --<loadfile srcfile="${src.file}" property="${src.file.contents}"> - <filterchain> - <filterreader classname="org.apache.tools.ant.filters.StripLineBreaks"/> - </filterchain> -</loadfile> -
- -This treats the '(' and ')' characters as line break characters and -strips them. --<loadfile srcfile="${src.file}" property="${src.file.contents}"> - <filterchain> - <striplinebreaks/> - </filterchain> -</loadfile> -
- --<loadfile srcfile="${src.file}" property="${src.file.contents}"> - <filterchain> - <filterreader classname="org.apache.tools.ant.filters.StripLineBreaks"> - <param name="linebreaks" value="()"/> - </filterreader> - </filterchain> -</loadfile> -
Parameter Type | -Parameter Value | -Required | -
comment | -Strings that identify a line as a comment - when they appear at the start of the line. | -Yes | -
-
- -Convenience method: --<filterreader classname="org.apache.tools.ant.filters.StripLineComments"> - <param type="comment" value="#"/> - <param type="comment" value="--"/> - <param type="comment" value="REM "/> - <param type="comment" value="rem "/> - <param type="comment" value="//"/> -</filterreader> -
- --<striplinecomments> - <comment value="#"/> - <comment value="--"/> - <comment value="REM "/> - <comment value="rem "/> - <comment value="//"/> -</striplinecomments> -
Parameter Name | -Parameter Value | -Required | -
tablength | -Defaults to "8" | -No | -
-
- -Convenience method: --<loadfile srcfile="${src.file}" property="${src.file.notab}"> - <filterchain> - <filterreader classname="org.apache.tools.ant.filters.TabsToSpaces"/> - </filterchain> -</loadfile> -
- --<loadfile srcfile="${src.file}" property="${src.file.notab}"> - <filterchain> - <tabstospaces/> - </filterchain> -</loadfile> -
Parameter Name | -Parameter Value | -Required | -
lines | -Number of lines to be read.
- Defaults to "10" A negative value means that all lines are - passed (useful with skip) |
- No | -
skip | -Number of lines to be skipped (from the end). - Defaults to "0" | -No | -
- -
Content | -- | - | - | Filter | -||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Line 1 | -- | - | - |
-
|
-||||||||||
Line 2 | -||||||||||||||
Line 3 | -- | |||||||||||||
Line 4 | -||||||||||||||
Line 5 | -- | |||||||||||||
Lines ... | -||||||||||||||
Line 95 | -||||||||||||||
Line 96 | -- | |||||||||||||
Line 97 | -||||||||||||||
Line 98 | -- | |||||||||||||
Line 99 | -
- -Convenience method: --<loadfile srcfile="${src.file}" property="${src.file.tail}"> - <filterchain> - <filterreader classname="org.apache.tools.ant.filters.TailFilter"> - <param name="lines" value="15"/> - </filterreader> - </filterchain> -</loadfile> -
- - -This stores the last 5 lines of the first 15 lines of the supplied -data in the property ${src.file.mid} --<loadfile srcfile="${src.file}" property="${src.file.tail}"> - <filterchain> - <tailfilter lines="15"/> - </filterchain> -</loadfile> -
- -Convenience method: --<loadfile srcfile="${src.file}" property="${src.file.mid}"> - <filterchain> - <filterreader classname="org.apache.tools.ant.filters.HeadFilter"> - <param name="lines" value="15"/> - </filterreader> - <filterreader classname="org.apache.tools.ant.filters.TailFilter"> - <param name="lines" value="5"/> - </filterreader> - </filterchain> -</loadfile> -
- - -This stores the last 10 lines, skipping the last 2 lines, of the supplied data -in the property src.file.head. (Means: if supplied data contains 60 lines, -lines 49-58 are extracted) --<loadfile srcfile="${src.file}" property="${src.file.mid}"> - <filterchain> - <headfilter lines="15"/> - <tailfilter lines="5"/> - </filterchain> -</loadfile> -
- --<loadfile srcfile="${src.file}" property="src.file.head"> - <filterchain> - <tailfilter lines="10" skip="2"/> - </filterchain> -</loadfile> -
This filter deletes specified characters.
-since Ant 1.6
-This filter is only available in the convenience form.
- -Parameter Name | -Parameter Value | -Required | -
chars | -- The characters to delete. This attribute is - backslash enabled. - | -Yes | -
-
- --<deletecharacters chars="\t\r"/> -
This filter prepends or appends the content file to the filtered files.
-since Ant 1.6
-Parameter Name | -Parameter Value | -Required | -
prepend | -- The name of the file which content should be prepended to the file. - | -No | -
append | -- The name of the file which content should be appended to the file. - | -No | -
- -
- -Adds a license text before each java source: --<filterchain> - <concatfilter/> -</filterchain> -
- - - --<filterchain> - <concatfilter prepend="apache-license-java.txt"/> -</filterchain> -
since Ant 1.6
--Only one tokenizer element may be used, the LineTokenizer is the -default if none are specified. A tokenizer -splits the input into token strings and trailing delimiter strings. -
-There may be zero or more string filters. A string filter processes -a token and either returns a string or a null. -It the string is not null it is passed to the next filter. This -proceeds until all the filters are called. -If a string is returned after all the filters, the string is -outputs with its associated token delimiter -(if one is present). -The trailing delimiter may be overridden by the delimOutput -attribute. -
-backslash interpretation -A number of attributes (including delimOutput) interpret -backslash escapes. The following are understood: \n, \r, \f, \t -and \\. - - -
Attribute | -Description | -Required | -
delimOutput | -- This overrides the tokendelimiter - returned by the tokenizer if it is not empty. This - attribute is backslash enabled. - | -No | -
- - The following tokenizers are provided by the default distribution. -
- LineTokenizer
- FileTokenizer
- StringTokenizer
-
- ReplaceString
- ContainsString
- ReplaceRegex
- ContainsRegex
- Trim
- IgnoreBlank
- DeleteCharacters
- UniqFilter
-
- ScriptFilter
-
- -
-This tokenizer splits the input into lines. -The tokenizer delimits lines -by "\r", "\n" or "\r\n". -This is the default tokenizer. -Attribute | -Description | -Required | -
includeDelims | -- Include the line endings in the token. - Default is false. - | -No | -
- - -Remove blank lines. --<tokenfilter delimoutput="\n"/> -
- - -This tokenizer treats all the input as a token. So be -careful not to use this on very large input. --<tokenfilter> - <ignoreblank/> -</tokenfilter> - -
- - -This tokenizer is based on java.util.StringTokenizer. -It splits up the input into strings separated by white space, or -by a specified list of delimiting characters. -If the stream starts with delimiter characters, the first -token will be the empty string (unless the delimsaretokens -attribute is used). - --<tokenfilter> - <filetokenizer/> - <replaceregex pattern="([\n\r]+[ \t]*|^[ \t]*)package" - flags="s" - replace="\1//package"/> -</tokenfilter> -
Attribute | -Description | -Required | -
delims | -The delimiter characters. White space - is used if this is not set. (White space is defined - in this case by java.lang.Character.isWhitespace()). - | -No | -
delimsaretokens | -If this is true, - each delimiter character is returned as a token. - Default is false. - | -No | -
suppressdelims | -- If this is true, delimiters are not returned. - Default is false. - | -No | -
includeDelims | -- Include the delimiters in the token. - Default is false. - | -No | -
- - -This is a simple filter to replace strings. -This filter may be used directly within a filterchain. - --<tokenfilter> - <stringtokenizer/> - <replaceregex pattern="(.+)" replace="[\1]"/> -</tokenfilter> - -
Attribute | -Description | -Required | -
from | -The string that must be replaced. | -Yes | -
to | -The new value for the replaced string. When omitted - an empty string is used. - | -No | -
- - -This is a simple filter to filter tokens that contains -a specified string. - --<tokenfilter> - <replacestring from="sun" to="moon"/> -</tokenfilter> -
Attribute | -Description | -Required | -
contains | -The string that the token must contain. | -Yes | -
- - -This string filter replaces regular expressions. -This filter may be used directly within a filterchain. --<tokenfilter> - <containsstring contains="foo"/> -</tokenfilter> - -
- See Regexp Type -concerning the choice of the implementation. -
- -Attribute | -Description | -Required | -
pattern | -The regular expression pattern to match in - the token. | -Yes | -
replace | -The substitution pattern to replace the matched - regular expression. When omitted an empty string is used. | -No | -
flags | -See -ReplaceRegexp -for an explanation of regex flags. | -No | -
- - -This filters strings that match regular expressions. -The filter may optionally replace the matched regular expression. -This filter may be used directly within a filterchain. --<tokenfilter> - <replaceregex pattern="hello" replace="world" flags="gi"/> -</tokenfilter> - -
-See -Regexp Type -concerning the choice of regular expression implementation. -
-Attribute | -Description | -Required | -
pattern | -The regular expression pattern to match in - the token. | -Yes | -
replace | -The substitution pattern to replace the matched - regular expression. When omitted the original token is returned. - | -No | -
flags | -See -ReplaceRegexp -for an explanation of regex flags. | -No | -
- -This example replaces lines like "SUITE(TestSuite, bits);" with -"void register_bits();" and removes other lines. - --<tokenfilter> - <containsregex pattern="(hello|world)" flags="i"/> -</tokenfilter> - -
- - -This filter trims whitespace from the start and end of -tokens. -This filter may be used directly within a filterchain. - -This filter removes empty tokens. -This filter may be used directly within a filterchain. - -This filter deletes specified characters from tokens. - --<tokenfilter> - <containsregex - pattern="^ *SUITE\(.*,\s*(.*)\s*\).*" - replace="void register_\1();"/> -</tokenfilter> -
Attribute | -Description | -Required | -
chars | -The characters to delete. This attribute - is backslash enabled. | -Yes | -
- - - --<tokenfilter> - <deletecharacters chars="\t"/> - <trim/> - <ignoreblank/> -</tokenfilter> - -
Suppresses all tokens that match their ancestor token. It is most - useful if combined with a sort filter.
- -This filter may be used directly within a filterchain.
- -- - -This is an optional filter that executes a script in a -Apache BSF - or - JSR 223 -supported language. -See the Script task for -an explanation of scripts and dependencies. - --<tokenfilter> - <uniqfilter/> -</tokenfilter> -
-The script is provided with an object self that has -getToken() and setToken(String) methods. -The getToken() method returns the current token. The setToken(String) -method replaces the current token. -
- -This filter may be used directly within a filterchain.-
Attribute | -Description | -Required | -
language | -The programming language the script is written in. -Must be a supported Apache BSF or JSR 223 language | -Yes | -
manager | -- The script engine manager to use. - See the script task - for using this attribute. - | -No - default is "auto" | -
src | -The location of the script as a file, if not inline - | -No | -
setbeans | -whether to have all properties, references and targets as - global variables in the script. since Ant 1.8.0 | -No, default is "true". | -
classpath | -- The classpath to pass into the script. - | -No | -
classpathref | -The classpath to use, given as a - reference to a path defined elsewhere. - | No | -
- This filter can take a nested <classpath> element. - See the script task - on how to use this element. -
-- -Remove lines containing the string "bad" while -copying text files: --<tokenfilter> - <scriptfilter language="javascript"> - self.setToken(self.getToken().toUpperCase()); - </scriptfilter> -</tokenfilter> -
-- --<copy todir="dist"> - <fileset dir="src" includes="**/*.txt"/> - <filterchain> - <scriptfilter language="beanshell"> - if (self.getToken().indexOf("bad") != -1) { - self.setToken(null); - } - </scriptfilter> - </filterchain> -</copy> --
<typedef/>
. For
-example a string filter that capitalizes words may be declared as:
-- -This may be used as follows: --package my.customant; -import org.apache.tools.ant.filters.TokenFilter; - -public class Capitalize - implements TokenFilter.Filter -{ - public String filter(String token) { - if (token.length() == 0) - return token; - return token.substring(0, 1).toUpperCase() + - token.substring(1); - } -} -
- - -- <typedef name="capitalize" classname="my.customant.Capitalize" - classpath="my.customant.path"/> - <copy file="input" tofile="output"> - <filterchain> - <tokenfilter> - <stringtokenizer/> - <capitalize/> - </tokenfilter> - </filterchain> - </copy> -
since Ant 1.8.0
- -The sort filter reads all lines and sorts them. The sort order can
- be reversed and it is possible to specify a custom implementation of
- the java.util.Comparator
interface to get even more
- control.
Parameter Name | -Parameter Value | -Required | -
reverse | -whether to reverse the sort order, - defaults to false. Note: this parameter is ignored if - the comparator parameter is present as well. | -No | -
comparator | -Class name of a class that
- implements java.util.Comparator for Strings. This
- class will be used to determine the sort order of lines. |
- No | -
This filter is also available using the
- name sortfilter
. The reverse
parameter
- becomes an attribute, comparator
can be specified by
- using a nested element.
- -- <copy todir="build"> - <fileset dir="input" includes="*.txt"/> - <filterchain> - <sortfilter/> - </filterchain> - </copy> -
-Sort all files *.txt
from src location
-into build location. The lines of each file are sorted in
-ascendant order comparing the lines via the
-String.compareTo(Object o)
method.
-
- -- <copy todir="build"> - <fileset dir="input" includes="*.txt"/> - <filterchain> - <sortfilter reverse="true"/> - </filterchain> - </copy> -
-Sort all files *.txt
from src location into reverse
-order and copy them into build location.
-
- -- <copy todir="build"> - <fileset dir="input" includes="*.txt"/> - <filterchain> - <filterreader classname="org.apache.tools.ant.filters.SortFilter"> - <param name="comparator" value="org.apache.tools.ant.filters.EvenFirstCmp"/> - </filterreader> - </filterchain> - </copy> -
-Sort all files *.txt
from src location using as
-sorting criterium EvenFirstCmp
class, that sorts the file
-lines putting even lines first then odd lines for example. The modified files
-are copied into build location. The EvenFirstCmp
,
-has to an instanciable class via Class.newInstance()
,
-therefore in case of inner class has to be static. It also has to
-implement java.util.Comparator
interface, for example:
-
- package org.apache.tools.ant.filters; - ...(omitted) - public final class EvenFirstCmp implements <b>Comparator</b> { - public int compare(Object o1, Object o2) { - ...(omitted) - } - } -- -
The example above is equivalent to:
- -- - diff --git a/framework/src/ant/apache-ant-1.9.6/manual/Types/filterset.html b/framework/src/ant/apache-ant-1.9.6/manual/Types/filterset.html deleted file mode 100644 index 8b0dfe18..00000000 --- a/framework/src/ant/apache-ant-1.9.6/manual/Types/filterset.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - -- <componentdef name="evenfirst" - classname="org.apache.tools.ant.filters.EvenFirstCmp"/> - <copy todir="build"> - <fileset dir="input" includes="*.txt"/> - <filterchain> - <sortfilter> - <evenfirst/> - </sortfilter> - </filterchain> - </copy> -
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>
.
FilterSets support the id
and refid
-attributes. You can define a FilterSet with an id
-attribute and then refer to that definition from another FilterSet
-with a refid
attribute. It is also possible to nest
-filtersets into filtersets to get a set union of the contained
-filters.
In addition, FilterSets can specify
-begintoken
and/or
-endtoken
attributes to define what to match.
Filtersets are used for doing
-replacements in tasks such as <copy>
, etc.
Filters can also by specified by one or more nested propertysets, the - contents of which are applied when the filterset is created.
- -If you specify multiple values for the same token, the last one - defined within a filterset will be used.
- --Note: When a filterset is used in an operation, the files are -processed in text mode and the filters applied line by line. This means that -the copy operations will typically corrupt binary files. When applying filters -you should ensure that the set of files being filtered are all text files. -
- -Attribute | -Description | -Default | -Required | -
begintoken | -The string marking the beginning of a token (eg.,
- @DATE@ ). |
- @ | -No | -
endtoken | -The string marking the end of a token (eg.,
- @DATE@ ). |
- @ | -No | -
filtersfile | -Specify a single filtersfile. | -none | -No | -
recurse | -Indicates whether the replacement text of tokens - should be searched for more tokens. Since Ant 1.6.3 | -true | -No | -
onmissingfiltersfile | -Indicate behavior when a nonexistent filtersfile - is specified. One of "fail", "warn", "ignore". Since Ant 1.7 | -"fail" | -No | -
Attribute | -Description | -Required | -
token | -The token to replace (eg., @DATE@ ) |
- Yes | -
value | -The value to replace it with
- (eg., Thursday, April 26, 2001 ). |
- Yes | -
Attribute | -Description | -Required | -
file | -A properties file of - name-value pairs from which to load the tokens. | -Yes | -
You are copying the version.txt
file to the dist
-directory from the build
directory
-but wish to replace the token @DATE@
with today's date.
- --<copy file="${build.dir}/version.txt" toFile="${dist.dir}/version.txt"> - <filterset> - <filter token="DATE" value="${TODAY}"/> - </filterset> -</copy> -
You are copying the version.txt
file to the dist
-directory from the build directory
-but wish to replace the token %DATE*
with today's date.
- --<copy file="${build.dir}/version.txt" toFile="${dist.dir}/version.txt"> - <filterset begintoken="%" endtoken="*"> - <filter token="DATE" value="${TODAY}"/> - </filterset> -</copy> -
Copy all the docs but change all dates and appropriate notices as stored in a file.
-- --<copy toDir="${dist.dir}/docs"> - <fileset dir="${build.dir}/docs"> - <include name="**/*.html"> - </fileset> - <filterset begintoken="%" endtoken="*"> - <filtersfile file="${user.dir}/dist.properties"/> - </filterset> -</copy> -
Define a FilterSet and reference it later.
-- --<filterset id="myFilterSet" begintoken="%" endtoken="*"> - <filter token="DATE" value="${TODAY}"/> -</filterset> - -<copy file="${build.dir}/version.txt" toFile="${dist.dir}/version.txt"> - <filterset refid="myFilterSet"/> -</copy> -
You are copying the version.txt
file to the dist
-directory from the build
directory
-but wish to replace the token @project.date@
with the property of the same name.
- diff --git a/framework/src/ant/apache-ant-1.9.6/manual/Types/mapper.html b/framework/src/ant/apache-ant-1.9.6/manual/Types/mapper.html deleted file mode 100644 index 5aff311e..00000000 --- a/framework/src/ant/apache-ant-1.9.6/manual/Types/mapper.html +++ /dev/null @@ -1,972 +0,0 @@ - - - - - - --<copy file="${build.dir}/version.txt" toFile="${dist.dir}/version.txt"> - <filterset> - <propertyset> - <propertyref name="project.date"/> - </propertyset> - </filterset> -</copy> -
Some tasks take source files and create target files. Depending on
-the task, it may be quite obvious which name a target file will have
-(using javac, you know there will be
-.class
files for your .java
files) - in
-other cases you may want to specify the target files, either to help
-Apache Ant or to get an extra bit of functionality.
While source files are usually specified as filesets, you don't specify target files directly -
-instead, you tell Ant how to find the target file(s) for one source file. An
-instance of org.apache.tools.ant.util.FileNameMapper
is
-responsible for this. It constructs target file names based on rules
-that can be parameterized with from
and to
-attributes - the exact meaning of which is implementation-dependent.
These instances are defined in <mapper>
elements
-with the following attributes:
Attribute | -Description | -Required | -
type | -specifies one of the built-in implementations. | -Exactly one of these | -
classname | -specifies the implementation by class name. | -|
classpath | -the classpath to use when looking up
- classname . |
- No | -
classpathref | -the classpath to use, given as reference to a path defined elsewhere. | -No | -
from | -the from attribute for the given
- implementation. |
- Depends on implementation. | -
to | -the to attribute for the given
- implementation. |
- Depends on implementation. | -
Note that Ant will not automatically convert / or \ characters in
-the to
and from
attributes to the correct
-directory separator of your current platform. If you need to specify
-this separator, use ${file.separator}
instead.
- For the regexpmapper, ${file.separator}
will not work,
-as on windows it is the '\' character, and this is an escape character
-for regular expressions, one should use the handledirsep
attribute
-instead.
-
The classpath can be specified via a nested
-<classpath>
, as well - that is,
-a path-like structure.
Since Ant 1.7.0, nested File Mappers can
-be supplied via either <mapper>
elements or
-<typedef>
'd
-implementations of org.apache.tools.ant.util.FileNameMapper
.
-If nested File Mappers are specified by either means, the mapper will be
-implicitly configured as a composite mapper.
-
All built-in mappers are case-sensitive.
-As of Ant 1.7.0, each of the built-in mapper implementation
- types is directly accessible using a specific tagname. This makes it
- possible for filename mappers to support attributes in addition to
- the generally available to and from.
- The <mapper type|classname="...">
usage
- form remains valid for reasons of backward compatibility.
The target file name is identical to the source file name. Both
-to
and from
will be ignored.
--<mapper type="identity"/> -<identitymapper/> -
Source file name | -Target file name | -
A.java |
- A.java |
-
foo/bar/B.java |
- foo/bar/B.java |
-
C.properties |
- C.properties |
-
Classes/dir/dir2/A.properties |
- Classes/dir/dir2/A.properties |
-
The target file name is identical to the source file name, with all
-leading directory information stripped off. Both to
and
-from
will be ignored.
--<mapper type="flatten"/> -<flattenmapper/> -
Source file name | -Target file name | -
A.java |
- A.java |
-
foo/bar/B.java |
- B.java |
-
C.properties |
- C.properties |
-
Classes/dir/dir2/A.properties |
- A.properties |
-
The target file name will always be the same, as defined by
-to
- from
will be ignored.
--<mapper type="merge" to="archive.tar"/> -<mergemapper to="archive.tar"/> -
Source file name | -Target file name | -
A.java |
- archive.tar |
-
foo/bar/B.java |
- archive.tar |
-
C.properties |
- archive.tar |
-
Classes/dir/dir2/A.properties |
- archive.tar |
-
Both to
and from
are required and define patterns that may
-contain at most one *
. For each source file that matches
-the from
pattern, a target file name will be constructed
-from the to
pattern by substituting the *
in
-the to
pattern with the text that matches the
-*
in the from
pattern. Source file names
-that don't match the from
pattern will be ignored.
--<mapper type="glob" from="*.java" to="*.java.bak"/> -<globmapper from="*.java" to="*.java.bak"/> -
Source file name | -Target file name | -
A.java |
- A.java.bak |
-
foo/bar/B.java |
- foo/bar/B.java.bak |
-
C.properties |
- ignored | -
Classes/dir/dir2/A.properties |
- ignored | -
--<mapper type="glob" from="C*ies" to="Q*y"/> -<globmapper from="C*ies" to="Q*y"/> -
Source file name | -Target file name | -
A.java |
- ignored | -
foo/bar/B.java |
- ignored | -
C.properties |
- Q.property |
-
Classes/dir/dir2/A.properties |
- Qlasses/dir/dir2/A.property |
-
- The globmapper mapper can take the following extra attributes. -
-Attribute | -Description | -Required | -
casesensitive | -- If this is false, the mapper will ignore case when matching the glob pattern. - This attribute can be true or false, the default is true. - Since Ant 1.6.3. - | -No | -
handledirsep | -- If this is specified, the mapper will ignore the difference between the normal - directory separator characters - \ and /. - This attribute can be true or false, the default is false. - This attribute is useful for cross-platform build files. - Since Ant 1.6.3. - | No | -
- An example: -
-- <pathconvert property="x" targetos="unix"> - <path path="Aj.Java"/> - <mapper> - <chainedmapper> - <flattenmapper/> - <globmapper from="a*.java" to="*.java.bak" casesensitive="no"/> - </chainedmapper> - </mapper> - </pathconvert> - <echo>x is ${x}</echo> --
- will output "x is j.java.bak". -
-- and -
-- <pathconvert property="x" targetos="unix"> - <path path="d/e/f/j.java"/> - <mapper> - <globmapper from="${basedir}\d/e\*" to="*" handledirsep="yes"/> - </mapper> - </pathconvert> - <echo>x is ${x}</echo> --
- will output "x is f/j.java". -
- - - - - - -Both to
and from
are required and define
-regular expressions. If the source file name (as a whole or in part)
-matches the from
pattern, the target file name will be
-constructed from the
-to
pattern, using \0
to \9
as
-back-references for the full match (\0
) or the matches of
-the subexpressions in parentheses. The to
pattern
-determines the whole file name, so if you wanted to
-replace the extension of a file you should not use from="\.old$"
-to=".new"
but rather from="(.*)\.old$" to="\1.new"
-(or rather use a glob mapper in this case).
Source files not matching the from
pattern will be
-ignored.
Note that you need to escape a dollar-sign ($
) with
-another dollar-sign in Ant.
The regexp mapper needs a supporting library and an implementation
-of org.apache.tools.ant.util.regexp.RegexpMatcher
that
- hides the specifics of the library. Since Ant 1.8.0 Ant
- requires Java 1.4 to run, so the implementation based on
- the java.util.regex
package will always be available.
- You can still use the now retired Jakarta ORO or Jakarta Regex instead if your
- provide the corresponding jar in your CLASSPATH.
For information about using gnu.regexp or gnu.rex with Ant, see this -article.
- -If you want to use one of the regular expression
- libraries other than java.util.regex
you need to also use
- the corresponding ant-[apache-oro, apache-regexp].jar
-from the Ant release you are using.
-Make sure, both will be loaded from the same
-classpath, that is either put them into your CLASSPATH
,
-ANT_HOME/lib
directory or a nested
-<classpath>
element of the mapper - you cannot have
-ant-[apache-oro, apache-regexp].jar
in ANT_HOME/lib
- and the library
-in a nested <classpath>
.
Ant will choose the regular-expression library based on the -following algorithm:
-ant.regexp.matcherimpl
has been set, it is taken as the
-name of the class implementing
-org.apache.tools.ant.util.regexp.RegexpMatcher
that
-should be used.--<mapper type="regexp" from="^(.*)\.java$$" to="\1.java.bak"/> -<regexpmapper from="^(.*)\.java$$" to="\1.java.bak"/> -
Source file name | -Target file name | -
A.java |
- A.java.bak |
-
foo/bar/B.java |
- foo/bar/B.java.bak |
-
C.properties |
- ignored | -
Classes/dir/dir2/A.properties |
- ignored | -
--<mapper type="regexp" from="^(.*)/([^/]+)/([^/]*)$$" to="\1/\2/\2-\3"/> -<regexpmapper from="^(.*)/([^/]+)/([^/]*)$$" to="\1/\2/\2-\3"/> -
Source file name | -Target file name | -
A.java |
- ignored | -
foo/bar/B.java |
- foo/bar/bar-B.java |
-
C.properties |
- ignored | -
Classes/dir/dir2/A.properties |
- Classes/dir/dir2/dir2-A.properties |
-
--<mapper type="regexp" from="^(.*)\.(.*)$$" to="\2.\1"/> -<regexpmapper from="^(.*)\.(.*)$$" to="\2.\1"/> -
Source file name | -Target file name | -
A.java |
- java.A |
-
foo/bar/B.java |
- java.foo/bar/B |
-
C.properties |
- properties.C |
-
Classes/dir/dir2/A.properties |
- properties.Classes/dir/dir2/A |
-
--<mapper type="regexp" from="^(.*?)(\$$[^/\\\.]*)?\.class$$" to="\1.java"/> -<regexpmapper from="^(.*?)(\$$[^/\\\.]*)?\.class$$" to="\1.java"/> -
Source file name | -Target file name | -
ClassLoader.class |
- ClassLoader.java |
-
java/lang/ClassLoader.class |
- java/lang/ClassLoader.java |
-
java\lang\ClassLoader$1.class |
- java\lang\ClassLoader.java |
-
java/lang/ClassLoader$foo$1.class |
- java/lang/ClassLoader.java |
-
- The regexpmapper mapper can take the following extra attributes. -
-Attribute | -Description | -Required | -
casesensitive | -- If this is false, the mapper will ignore case when matching the pattern. - This attribute can be true or false, the default is true. - Since Ant 1.6.3. - | -No | -
handledirsep | -- If this is specified, the mapper will treat a \ character in a filename - as a / for the purposes of matching. - This attribute can be true or false, the default is false. - This attribute is useful for cross-platform build files. - Since Ant 1.6.3. - | No | -
- An example: -
-- <pathconvert property="x" targetos="unix"> - <path path="Aj.Java"/> - <chainedmapper> - <flattenmapper/> - <regexpmapper from="a(.*)\.java" to="\1.java.bak" casesensitive="no"/> - </chainedmapper> - </pathconvert> - <echo>x is ${x}</echo> --
- will output "x is j.java.bak". -
-- and -
-- <pathconvert property="hd.prop" targetos="windows"> - <path path="d\e/f\j.java"/> - <chainedmapper> - <regexpmapper from="${basedir}/d/e/(.*)" to="\1" handledirsep="yes"/> - </chainedmapper> - </pathconvert> --
- will set hd.prop
to "f\j.java".
-
Sharing the same syntax as the glob mapper,
-the package mapper replaces
-directory separators found in the matched source pattern with dots in the target
-pattern placeholder. This mapper is particularly useful in combination
-with <uptodate>
and <junit>
output.
The to and from attributes are both required.
-Example: ---<mapper type="package" from="*Test.java" to="TEST-*Test.xml"/> -<packagemapper from="*Test.java" to="TEST-*Test.xml"/> -
Source file name | -Target file name | -
org/apache/tools/ant/util/PackageMapperTest.java |
- TEST-org.apache.tools.ant.util.PackageMapperTest.xml |
-
org/apache/tools/ant/util/Helper.java |
- ignored | -
This mapper is the inverse of the package mapper. - It replaces the dots in a package name with directory separators. This - is useful for matching XML formatter results against their JUnit test - test cases. The mapper shares the sample syntax - as the glob mapper. -
-The to and from attributes are both required.
-Example: ---<mapper type="unpackage" from="TEST-*Test.xml" to="${test.src.dir}/*Test.java"> -<unpackagemapper from="TEST-*Test.xml" to="${test.src.dir}/*Test.java"> -
Source file name | -Target file name | -
TEST-org.acme.AcmeTest.xml |
- ${test.src.dir}/org/acme/AcmeTest.java |
-
This mapper implementation can contain multiple nested mappers.
- File mapping is performed by passing the source filename to each nested
- <mapper>
in turn, returning all results.
- The to and from attributes are ignored.
Starting with Ant 1.8.0 the order of the mapped results is the - same as the order of the nested mappers; prior to Ant 1.8.0 the - order has been undefined.
-Examples: ---<compositemapper> - <identitymapper/> - <packagemapper from="*.java" to="*"/> -</compositemapper> -
Source file name | -Target file names | -
foo/bar/A.java |
- foo/bar/A.java |
-
foo.bar.A |
-
The composite mapper has no corresponding
- <mapper type>
attribute.
-
This mapper implementation can contain multiple nested mappers. - File mapping is performed by passing the source filename to the first - nested mapper, its results to the second, and so on. The target filenames - generated by the last nested mapper comprise the ultimate results of the - mapping operation. The to and from attributes are ignored.
-Examples: ---<chainedmapper> - <flattenmapper/> - <globmapper from="*" to="new/path/*"/> - <mapper> - <globmapper from="*" to="*1"/> - <globmapper from="*" to="*2"/> - </mapper> -</chainedmapper> -
Source file name | -Target file names | -
foo/bar/A.java |
- new/path/A.java1 |
-
new/path/A.java2 |
- |
boo/far/B.java |
- new/path/B.java1 |
-
new/path/B.java2 |
-
The chained mapper has no corresponding
- <mapper type>
attribute.
-
- This mapper implementation applies a filterchain - to the source file name. -
-Examples: -- --<filtermapper> - <replacestring from="\" to="/"/> -</filtermapper> -
Source file name | -Target file names | -
foo\bar\A.java |
- foo/bar/A.java |
-
- --<filtermapper> - <scriptfilter language="beanshell"> - self.setToken(self.getToken().toUpperCase()); - </scriptfilter> -</filtermapper> -
Source file name | -Target file names | -
foo\bar\A.java |
- FOO\BAR\A.JAVA |
-
The filtermapper has no corresponding
- <mapper type>
attribute.
-
-This mapper executes a script written in Apache BSF -or - JSR 223 -supported language, once per file to map.
-The script can be declared inline or in a specified file. - --See the Script task for -an explanation of scripts and dependencies. -
- -Attribute | -Description | -Required | -
language | -- Scripting language - | -Yes | -
manager | -- The script engine manager to use. - See the script task - for using this attribute. - | -No - default is "auto" | -
src | -- File containing the script - | -No | -
setbeans | -whether to have all properties, references and targets as - global variables in the script. since Ant 1.8.0 | -No, default is "true". | -
classpath | -- The classpath to pass into the script. - | -No | -
classpathref | -The classpath to use, given as a - reference to a path defined elsewhere. - | No | -
- This filename mapper can take a nested <classpath> element. - See the script task - on how to use this element. -
- -- Example: -
-- --<scriptmapper language="javascript"> - self.addMappedName(source.toUpperCase()); - self.addMappedName(source.toLowerCase()); -</scriptmapper> -
Source file name | -Target file names | -
foo\bar\A.java |
- FOO\BAR\A.JAVA |
-
foo\bar\a.java |
-
-To use this mapper, the scripts need access to the source file, -and the ability to return multiple mappings. Here are the relevant beans and -their methods. The script is called once for every source file, with the -list of mapped names reset after every invocation. - -
Script bean | -Description | -
source: String |
- - The file/path to map - | -
self |
- - the scriptmapper itself - | -
self.addMappedName(String name) |
- - Add a new mapping - | -
self.clear() |
- - Reset the list of files. - | -
The scriptmapper has no corresponding
- <mapper type>
attribute.
-
- This mapper supports an arbitrary number of nested mappers and - returns the results of the first mapper that matches. This is - different from composite mapper - which collects the results of all matching children.
-Examples: -- --<firstmatchmapper> - <globmapper from="*.txt" to="*.bak"/> - <globmapper from="*A.*" to="*B.*"/> -</firstmatchmapper> -
Source file name | -Target file names | -
foo/bar/A.txt |
- foo/bar/A.bak |
-
foo/bar/A.java |
- foo/bar/B.java |
-
The firstmatchmapper has no corresponding
- <mapper type>
attribute.
-
This mapper strips a configured number of leading directories from - the source file name.
- -Examples: -- --<cutdirsmapper dirs="1"/> -
Source file name | -Target file names | -
foo/bar/A.txt |
- bar/A.txt |
-
The cutdirsmapper has no
-corresponding <mapper type>
attribute.
Attribute | -Description | -Required | -
dirs | -- Number of directories to strip (must be a positive number). - | -Yes | -
Since Ant 1.9.4
- -A MultiRootFileSet is a group of files or directories. These files -or directories can be found in a directory forrest starting with a set -of base directories and are matched by patterns taken from a number of -PatternSets and Selectors.
- -MultiRootFileSet acts as a union of FileSets and DirSets -that share the same patterns and selectors.
- -MultiRootFileSet supports all attributes and nested elements of -FileSet and DirSet except for the "dir" attribute.
- -Attribute | -Description | -Required | -
basedirs | -Comma separated list of directories that build - the roots of the MultiRootFileSet. | -No | -
cache | -Whether to cache results; disabling - may seriously impact performance | -No, default true | -
type | -The type of file system entities which will be
- included in this set.
- Acceptable values are:
-
|
- No, defaults to file | -
includes | -A comma- or space-separated list of patterns of directories that - must be included; all directories 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 | -A comma- or space-separated list of patterns of directories that - must be excluded; no directories are excluded when omitted. | -No | -
excludesfile | -The name of a file; each line of this file is - taken to be an exclude pattern. | -No | -
casesensitive | -Specifies whether case-sensitivity should be applied
- (true |yes |on or
- false |no |off ). |
- No; defaults to true. | -
followsymlinks | -Shall symbolic links be followed? Defaults to - true. See fileset's documentation. | -No | -
erroronmissingdir | -- Specify what happens if one of the base directories does not exist. - If true a build error will happen, if false, the subtree - will be ignored/empty. - Defaults to true. - | -No | -
PatternSets can be specified as nested
-<patternset>
elements. In addition, MultiRootFileSet holds
-an implicit PatternSet and supports the nested
-<include>
, <includesfile>
,
-<exclude>
and <excludesfile>
-elements of <patternset>
directly, as well as
-<patternset>
's attributes.
Selectors are available as nested elements within the
-MultiRootFileSet. If any of the selectors within the MultiRootFileSet
-do not select the file or directory, it is not considered part of the
-MultiRootFileSet. This makes a MultiRootFileSet equivalent to
-an <and>
selector container.
In addition basedirs for the MultiRootFileSet can be specified as
- nested basedir
elements that have a
- single file
attribute.
--<multirootfileset basedirs="${build.dir},${other.project.dir}"> - <include name="apps/**/classes"/> - <exclude name="apps/**/*Test*"/> -</multirootfileset> -
Groups all files inside classes
found under the
-apps
subdirectory of ${build.dir}
or
-${other.project.dir}
, except those that have the text
-Test
in their name.
--<multirootfileset> - <basedir file="${build.dir}"/> - <basedir file="${other.project.dir}" - <include name="apps/**/classes"/> - <exclude name="apps/**/*Test*"/> -</multirootfileset> -
Is equivalent to the first example but used
- nested basedir
elements. The nested elements and
- the basedirs
attribute can be used at the same time and
- the will be merged.
- All releases of Ant prior to Ant 1.6 do not support XML namespaces. - No support basically implies two things here: -
-<prefix>
'
- are not treated specially, which means that custom tasks and types have
- actually been able to use such attributes as parameter names. Again,
- such tasks/types are going to break when namespace support is enabled
- on the parser.
- Use of colons in element names has been discouraged in the past, - and using any attribute starting with "xml" is actually strongly - discouraged by the XML spec to reserve such names for future use. -
-In build files using a lot of custom and third-party tasks, it is
- easy to get into name conflicts. When individual types are defined, the
- build file writer can do some namespacing manually (for example, using
- "tomcat-deploy" instead of just "deploy"). But when defining whole
- libraries of types using the <typedef>
'resource' attribute, the
- build file writer has no chance to override or even prefix the names
- supplied by the library.
- Adding a 'prefix' attribute to <typedef>
might have been enough,
- but XML already has a well-known method for namespacing. Thus, instead
- of adding a 'prefix' attribute, the <typedef>
and <taskdef>
- tasks get a 'uri' attribute, which stores the URI of the XML namespace
- with which the type should be associated:
-
<typedef resource="org/example/tasks.properties" uri="http://example.org/tasks"/> - <my:task xmlns:my="http://example.org/tasks"> - ... - </my:task> --
As the above example demonstrates, the namespace URI needs to be - specified at least twice: one time as the value of the 'uri' attribute, - and another time to actually map the namespace to occurrences of - elements from that namespace, by using the 'xmlns' attribute. This - mapping can happen at any level in the build file: -
<project name="test" xmlns:my="http://example.org/tasks"> - <typedef resource="org/example/tasks.properties" uri="http://example.org/tasks"/> - <my:task> - ... - </my:task> - </project> --
- Use of a namespace prefix is of course optional. Therefore - the example could also look like this: -
<project name="test"> - <typedef resource="org/example/tasks.properties" uri="http://example.org/tasks"/> - <task xmlns="http://example.org/tasks"> - ... - </task> - </project> --
- Here, the namespace is set as the default namespace for the <task>
- element and all its descendants.
-
- The default namespace used by Ant is "antlib:org.apache.tools.ant". -
--<typedef resource="org/example/tasks.properties" uri="antlib:org.apache.tools.ant"/> -<task> - .... -</task> -- - - -
- Almost always in Ant 1.6, elements nested inside a namespaced - element have the same namespace as their parent. So if 'task' in the - example above allowed a nested 'config' element, the build file snippet - would look like this: -
<typedef resource="org/example/tasks.properties" uri="http://example.org/tasks"/> - <my:task xmlns:my="http://example.org/tasks"> - <my:config a="foo" b="bar"/> - ... - </my:task> --
If the element allows or requires a lot of nested elements, the - prefix needs to be used for every nested element. Making the namespace - the default can reduce the verbosity of the script: -
<typedef resource="org/example/tasks.properties" uri="http://example.org/tasks"/> - <task xmlns="http://example.org/tasks"> - <config a="foo" b="bar"/> - ... - </task> --
- From Ant 1.6.2, elements nested inside a namespaced element may also be - in Ant's default namespace. This means that the following is now allowed: -
-<typedef resource="org/example/tasks.properties" - uri="http://example.org/tasks"/> - <my:task xmlns:my="http://example.org/tasks"> - <config a="foo" b="bar"/> - ... - </my:task> -- -
- Attributes are only used to configure the element they belong to if: -
-
- In Ant 1.9.1 two attribute namespaces ant:if
and ant:unless
were added
- to allow you to insert elements conditionally.
-
- Other attributes are simply ignored. -
-- This means that both: -
--
<my:task xmlns:my="http://example.org/tasks"> - <my:config a="foo" b="bar"/> - ... - </my:task> --
- and -
-<my:task xmlns:my="http://example.org/tasks"> - <my:config my:a="foo" my:b="bar"/> - ... - </my:task> --
- result in the parameters "a" and "b" being used as parameters to configure the nested "config" element. -
-It also means that you can use attributes from other namespaces - to markup the build file with extra metadata, such as RDF and - XML-Schema (whether that's a good thing or not). The same is not true - for elements from unknown namespaces, which result in a error. -
-Now comes the difficult part: elements from different namespaces can
- be woven together under certain circumstances. This has a lot to do
- with the Ant 1.6
- add type introspection rules:
- Ant types and tasks are now free to accept arbitrary named types as
- nested elements, as long as the concrete type implements the interface
- expected by the task/type. The most obvious example for this is the
- <condition>
task, which supports various nested conditions, all
- of which extend the interface Condition. To integrate a
- custom condition in Ant, you can now simply <typedef>
the
- condition, and then use it anywhere nested conditions are allowed
- (assuming the containing element has a generic add(Condition) or addConfigured(Condition) method):
-
<typedef resource="org/example/conditions.properties" uri="http://example.org/conditions"/> - <condition property="prop" xmlns="http://example.org/conditions"> - <and> - <available file="bla.txt"/> - <my:condition a="foo"/> - </and> - </condition> --
- In Ant 1.6, this feature cannot be used as much as we'd all like to: a - lot of code has not yet been adapted to the new introspection rules, - and elements like Ant's built-in conditions and selectors are not - really types in 1.6. This is expected to change in Ant 1.7. -
-- The new AntLib - feature is also very much integrated with the namespace support in Ant - 1.6. Basically, you can "import" Antlibs simply by using a special - scheme for the namespace URI: the antlib scheme, which expects the package name in which a special antlib.xml file is located. -
- - - diff --git a/framework/src/ant/apache-ant-1.9.6/manual/Types/patternset.html b/framework/src/ant/apache-ant-1.9.6/manual/Types/patternset.html deleted file mode 100644 index 4ad433db..00000000 --- a/framework/src/ant/apache-ant-1.9.6/manual/Types/patternset.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - -Patterns can be grouped to
-sets and later be referenced by their id
attribute. They
-are defined via a patternset
element, which can appear
-nested into a FileSet or a directory-based
-task that constitutes an implicit FileSet. In addition,
-patternset
s can be defined as a stand alone element at
-the same level as target
i.e., as children of
-project
as well as as children of
-target
.
Patterns can be specified by nested
-<include>
, or <exclude>
elements
-or the following attributes.
Attribute | -Description | -
includes | -comma- or space-separated list of patterns of files that must be - included. All files are included when omitted. | -
includesfile | -the name of a file; each line of this file is - taken to be an include pattern. You can specify more than one - include file by using a nested includesfile elements. - Note: if the file is empty and there are no other - patterns defined for the fileset, all files will be included. - | -
excludes | -comma- or space-separated list of patterns of files that must be - excluded; no files (except default excludes) are excluded when omitted. | -
excludesfile | -the name of a file; each line of this file is - taken to be an exclude pattern. You can specify more than one - exclude file by using a nested excludesfile elements. | -
include
and exclude
Each such element defines a single pattern for files to include or -exclude.
-Attribute | -Description | -Required | -
name | -the pattern - to in/exclude. | -Yes | -
if | -Only use this pattern if the named property is set. | -No | -
unless | -Only use this pattern if the named property is - not set. | -No | -
includesfile
and excludesfile
If you want to list the files to include or exclude external to -your build file, you should use the includesfile/excludesfile -attributes or elements. Using the attribute, you can only specify a -single file of each type, while the nested elements can be specified -more than once - the nested elements also support if/unless attributes -you can use to test the existence of a property.
-Attribute | -Description | -Required | -
name | -the name of the file holding the patterns to - in/exclude. | -Yes | -
if | -Only read this file if the named property is set. | -No | -
unless | -Only read this file if the named property is - not set. | -No | -
patternset
Patternsets may be nested within one another, adding the nested -patterns to the parent patternset.
-invert
A nested patternset can be inverted using the <invert>
-element. Since Apache Ant 1.7.1
--<patternset id="non.test.sources"> - <include name="**/*.java"/> - <exclude name="**/*Test*"/> -</patternset> -
Builds a set of patterns that matches all .java
files
-that do not contain the text Test
in their name. This set
-can be referred to via
-<patternset refid="non.test.sources"/>
,
-by tasks that support this feature, or by FileSets.
Note that while the includes
and
-excludes
attributes accept
-multiple elements separated by commas or spaces, the nested
-<include>
and <exclude>
elements expect their name
-attribute to hold a single pattern.
The nested elements allow you to use if and unless arguments to -specify that the element should only be used if a property is set, or -that it should be used only if a property is not set.
-For example
---<patternset id="sources"> - <include name="std/**/*.java"/> - <include name="prof/**/*.java" if="professional"/> - <exclude name="**/*Test*"/> -</patternset> -
will only include the files in the sub-directory prof if the property -professional is set to some value.
-The two sets
---<patternset includesfile="some-file"/> -
and
---<patternset> - <includesfile name="some-file"/> -<patternset/> -
are identical. The include patterns will be read from the file
-some-file
, one pattern per line.
--<patternset> - <includesfile name="some-file"/> - <includesfile name="${some-other-file}" - if="some-other-file" - /> -<patternset/> -
will also read include patterns from the file the property
-some-other-file
points to, if a property of that name has
-been defined.
-Permissions represents a set of security permissions granted or revoked to
-a specific part code executed in the JVM where Apache Ant is running in.
-The actual Permissions are specified via a set of nested permission items either
-<grant>
ed or <revoke>
d.
-In the base situation a base set of permissions granted.
-Extra permissions can be
-granted. A granted permission can be overruled by revoking a permission.
-The security manager installed by the permissions will throw an
-SecurityException
if
-the code subject to these permissions try to use an permission that has not been
-granted or that has been revoked.
-Indicates a specific permission is always granted. Its attributes indicate which -permissions are granted.
-Attribute | -Description | -Required | -
class | -The fully qualified name of the Permission class. | -Yes | -
name | -The name of the Permission. The actual contents depends on the - Permission class. | -No | -
actions | -The actions allowed. The actual contents depend on the - Permission class and name. | -No | -
-Implied permissions are granted. -
--Please note that some Permission classes may actually need a name and / or actions in order to function properly. The name and actions are parsed by the actual -Permission class. -
--Indicates a specific permission is revoked.
-Attribute | -Description | -Required | -
class | -The fully qualified name of the Permission class. | -Yes | -
name | -The name of the Permission. The actual contents depends on the - Permission class. | -No | -
actions | -The actions allowed. The actual contents depend on the - Permission class and name. | -No | -
-Implied permissions are not resolved and therefore also not revoked. -
--The name can handle the * wildcard at the end of the name, in which case all -permissions of the specified class of which the name starts with the specified name -(excluding the *) are revoked. Note that the - wildcard often supported by the -granted properties is not supported. -If the name is left empty all names match, and are revoked. -If the actions are left empty all actions match, and are revoked. -
--These permissions can be revoked via-<grant class="java.net.SocketPermission" name="localhost:1024-" actions="listen"> -<grant class="java.util.PropertyPermission" name="java.version" actions="read"> -<grant class="java.util.PropertyPermission" name="java.vendor" actions="read"> -<grant class="java.util.PropertyPermission" name="java.vendor.url" actions="read"> -<grant class="java.util.PropertyPermission" name="java.class.version" actions="read"> -<grant class="java.util.PropertyPermission" name="os.name" actions="read"> -<grant class="java.util.PropertyPermission" name="os.version" actions="read"> -<grant class="java.util.PropertyPermission" name="os.arch" actions="read"> -<grant class="java.util.PropertyPermission" name="file.encoding" actions="read"> -<grant class="java.util.PropertyPermission" name="file.separator" actions="read"> -<grant class="java.util.PropertyPermission" name="path.separator" actions="read"> -<grant class="java.util.PropertyPermission" name="line.separator" actions="read"> -<grant class="java.util.PropertyPermission" name="java.specification.version" actions="read"> -<grant class="java.util.PropertyPermission" name="java.specification.vendor" actions="read"> -<grant class="java.util.PropertyPermission" name="java.specification.name" actions="read"> -<grant class="java.util.PropertyPermission" name="java.vm.specification.version" actions="read"> -<grant class="java.util.PropertyPermission" name="java.vm.specification.vendor" actions="read"> -<grant class="java.util.PropertyPermission" name="java.vm.specification.name" actions="read"> -<grant class="java.util.PropertyPermission" name="java.vm.version" actions="read"> -<grant class="java.util.PropertyPermission" name="java.vm.vendor" actions="read"> -<grant class="java.util.PropertyPermission" name="java.vm.name" actions="read"> -
<revoke>
elements if necessary.
-
---<permissions> - <grant class="java.security.AllPermission"/> - <revoke class="java.util.PropertyPermission"/> -</permissions> -
-Grants all permissions to the code except for those handling Properties. -
---<permissions> - <grant class="java.net.SocketPermission" name="foo.bar.com" action="connect"/> - <grant class="java.util.PropertyPermission" name="user.home" action="read,write"/> -</permissions> -
-Grants the base set of permissions with the addition of a SocketPermission to connect -to foo.bar.com and the permission to read and write the user.home system property. -
- - - diff --git a/framework/src/ant/apache-ant-1.9.6/manual/Types/propertyset.html b/framework/src/ant/apache-ant-1.9.6/manual/Types/propertyset.html deleted file mode 100644 index 81d491e0..00000000 --- a/framework/src/ant/apache-ant-1.9.6/manual/Types/propertyset.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - -Since Apache Ant 1.6
- -Groups a set of properties to be used by reference in a task that -supports this.
- -Attribute | -Description | -Required | -
dynamic | -Whether to reevaluate the set every time the set
- is used. Default is "true ". |
- No | -
negate | -Whether to negate results. If
- "true ", all properties not
- selected by nested elements will be returned. Default is
- "false ". Since Ant 1.6.2
- |
- No | -
Selects properties from the current project to be included in the -set.
- -Attribute | -Description | -Required | -
name | -Select the property with the given name. | -Exactly one of these. | -
prefix | -Select the properties whose name starts with the - given string. | -|
regex | -Select the properties that match the given - regular expression. Similar to regexp type mappers, this - requires a supported regular expression library. | -|
builtin | -Selects a builtin set of properties. Valid
- values for this attribute are all for all Ant
- properties, system for the system properties and
- commandline for all properties specified on the
- command line when invoking Ant (plus a number of special
- internal Ant properties). |
-
A propertyset
can be used as the set union of more
-propertyset
s.
For example:
- -- --<propertyset id="properties-starting-with-foo"> - <propertyref prefix="foo"/> -</propertyset> -<propertyset id="properties-starting-with-bar"> - <propertyref prefix="bar"/> -</propertyset> -<propertyset id="my-set"> - <propertyset refid="properties-starting-with-foo"/> - <propertyset refid="properties-starting-with-bar"/> -</propertyset> -
collects all properties whose name starts with either -"foo" or "bar" in the set named -"my-set".
- -A mapper - at maximum one mapper can be -specified. The mapper is used to change the names of the property -keys, for example: - -
- --<propertyset id="properties-starting-with-foo"> - <propertyref prefix="foo"/> - <mapper type="glob" from="foo*" to="bar*"/> -</propertyset> -
collects all properties whose name starts with "foo", but -changes the names to start with "bar" instead.
- -If supplied, the nested mapper will be applied -subsequent to any negation of matched properties.
- - - - - - diff --git a/framework/src/ant/apache-ant-1.9.6/manual/Types/redirector.html b/framework/src/ant/apache-ant-1.9.6/manual/Types/redirector.html deleted file mode 100644 index d0e36838..00000000 --- a/framework/src/ant/apache-ant-1.9.6/manual/Types/redirector.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - -For many tasks, input and output can be defined in a fairly
-straightforward fashion. The exec
-task, used to execute an external process, stands as a very
-basic example. The executed process may accept input, produce
-output, or do either or both depending upon various circumstances.
-Output may be classified as "output" or as "error
-output." The <redirector>
type provides a concrete means
-of redirecting input and output featuring the use of
-File Mappers to specify
-source (input) and destination (output/error) files. Since Apache Ant 1.6.2
-
The <redirector>
element accepts the following attributes:
Attribute | -Description | -Required | -
output | -Name of a file to which output should be written. - If the error stream is not also redirected to a file or property, - it will appear in this output. | -No | -
error | -The file to which the standard error of the - command should be redirected. | -No | -
logError | -This attribute is used when you wish to see - error output in Ant's log and you are redirecting output to - a file/property. The error output will not be included in - the output file/property. If you redirect error with the - error or errorProperty attributes, this will - have no effect. | -No | -
append | -Whether output and error files should be
- appended to rather than overwritten. Defaults to
- false . |
- No | -
createemptyfiles | -Whether output and error files should be
- created even when empty. Defaults to true . |
- No | -
outputproperty | -The name of a property in which the output of the - command should be stored. Unless the error stream is redirected - to a separate file or stream, this property will include the - error output. | -No | -
errorproperty | -The name of a property in which the standard error - of the command should be stored. | -No | -
input | -A file from which the executed command's standard input - is taken. This attribute is mutually exclusive with the - inputstring attribute. | -No | -
inputstring | -A string which serves as the input stream for the - executed command. This attribute is mutually exclusive with the - input attribute. | -No | -
inputencoding | -The input encoding. | -No | -
outputencoding | -The output encoding. | -No | -
errorencoding | -The error encoding. | -No | -
alwayslog | -Always send to the log in addition to - any other destination. Since Ant 1.6.3. - | -No, default is false |
-
loginputstring | -Controls the display of inputstring's value in
- log messages. Set to false when sending sensitive data
- (e.g. passwords) to external processes. Since Ant 1.6.3.
- |
- No, default is true |
-
binaryOutput | -When set to true Ant will not try to split the - output into lines - which it will usually do in order to separate - error from normal output. This setting will not prevent binary - output from getting corrupted if you also specify filter chains. - Since Ant 1.9.4. - | -No, default is false |
-
A single File Mapper used to redirect process
-input. Multiple mapping results should concatenate all mapped files as input.
-Mapping will ordinarily be performed on a task-specified sourcefile;
-consult the documentation of the individual task for more details.
-A nested <inputmapper>
is not compatible with either of the
-input or inputstring attributes.
A single File Mapper used to redirect process
-output. Mapping will ordinarily be performed on a task-specified sourcefile;
-consult the documentation of the individual task for more details.
-A nested <outputmapper>
is not compatible with the
-output attribute.
A single File Mapper used to redirect error
-output. Mapping will ordinarily be performed on a task-specified sourcefile;
-consult the documentation of the individual task for more details.
-A nested <errormapper>
is not compatible with the
-error attribute.
A FilterChain can be -applied to the process input.
-A FilterChain can be -applied to the process output.
-A FilterChain can be -applied to the error output.
-The expected behavior of a <redirector>
is to a great degree
-dependent on the supporting task. Any possible points of confusion
-should be noted at the task level.
-Regexp represents a regular expression. -
Attribute | -Description | -Required | -
pattern | -regular expression pattern | -Yes | -
-- <regexp id="myregexp" pattern="alpha(.+)beta"/>
-
-Defines a regular expression for later use with id myregexp. -
--- <regexp refid="myregexp"/>
-
-Use the regular expression with id myregexp. -
--Apache Ant comes with -wrappers for -the java.util.regex package, -jakarta-regexp -and jakarta-ORO, -See installation dependencies - concerning the supporting libraries.
-
-The property ant.regexp.regexpimpl
governs which regular expression implementation will be chosen.
-Possible values for this property are :
-
org.apache.tools.ant.util.regexp.Regexp
.
-If ant.regexp.regexpimpl
is not defined, Ant uses Jdk14Regexp as this is always available.
--There are cross-platform issues for matches related to line terminator. -For example if you use $ to anchor your regular expression on the end of a line -the results might be very different depending on both your platform and the regular -expression library you use. It is 'highly recommended' that you test your pattern on -both Unix and Windows platforms before you rely on it. -
-These string filters also use the mechanism of regexp to choose a regular expression implementation : -
--A file-like entity can be abstracted to the concept of a resource. -In addition to providing access to file-like attributes, a resource -implementation should, when possible, provide the means to read content -from and/or write content to the underlying entity. Although the resource -concept was introduced in Apache Ant 1.5.2, resources are available for -explicit use beginning in Ant 1.7. -
- -A basic resource. Other resource types derive from this basic -type; as such all its attributes are available, though in most cases -irrelevant attributes will be ignored. This and all resource -implementations are also usable as single-element -Resource Collections. -
- -Attribute | -Description | -Required | -
name | -The name of this resource | -No | -
exists | -Whether this resource exists | -No, default true | -
lastmodified | -The last modification time of this resource | -No | -
directory | -Whether this resource is directory-like | -No, default false | -
size | -The size of this resource | -No | -
Represents a file accessible via local filesystem conventions.
- -Attribute | -Description | -Required | -
file | -The file represented by this resource | -Yes | -
basedir | -The base directory of this resource. When this - attribute is set, attempts to access the name of the resource - will yield a path relative to this location. | -No | -
Represents a resource loadable via a Java classloader.
- -Attribute | -Description | -Required | -
name | -The name of the resource. | -Yes | -
classpath | -the classpath to use when looking up a resource. | -No | -
classpathref | -the classpath to use when looking up a resource,
- given as reference
- to a <path> defined elsewhere.. |
- No | -
loaderRef | -the name of the loader that is - used to load the resource, constructed from the specified classpath. | -No | -
parentFirst | -Whether to consult the parent classloader first -
- the parent classloader most likely is the system classloader -
- when using a nested classpath. Defaults
- to true .- Since Ant 1.8.0 |
- No | -
The classpath can also be specified as nested classpath element, -where <classpath> is a path-like structure.
- - -Loads the value of a java constant. As a specialisation of -javaresource all of its attributes and nested elements are -supported. A constant must be specified as public static otherwise it could not be loaded.
- -Attribute | -Description | -Required | -
name | -The name of the resource. Must be specified as full qualified - field name. - | -Yes | -
<loadresource property="version">
- <javaconstant name="org.acme.Main.VERSION">
- <classpath>
- <pathelement location="${acme.lib.dir}"/>
- </classpath>
- </javaconstant>
- </loadresource>
-
-
-Create a new file c:/temp/org.apache.tools.ant.Main.DEFAULT_BUILD_FILENAME with the content
-of that constant (build.xml).
-<copy todir="c:/temp">
- <javaconstant name="org.apache.tools.ant.Main.DEFAULT_BUILD_FILENAME"/>
-</copy>
-
-
-Represents an entry in a ZIP archive. The archive can be specified
-using the archive attribute or a nested single-element resource
-collection. zipentry
only supports file system resources
-as nested elements.
Attribute | -Description | -Required | -
zipfile or its alias name archive | -The zip file containing this resource | -Yes, unless a nested resource - collection has been specified. | -
name | -The name of the archived resource | -Yes | -
encoding | -The encoding of the zipfile | -No; - platform default used if unspecified | -
Represents an entry in a TAR archive. The archive can be specified -using the archive attribute or a nested single-element resource -collection.
- -Attribute | -Description | -Required | -
archive | -The tar archive containing this resource | -Yes, unless a nested resource - collection has been specified. | -
name | -The name of the archived resource | -Yes | -
This is not a stand-alone resource, but a wrapper around another -resource providing compression of the resource's contents on the fly. -A single element resource collection must be specified as a nested -element.
- -This is not a stand-alone resource, but a wrapper around another -resource providing compression of the resource's contents on the fly. -A single element resource collection must be specified as a nested -element.
- -Represents a URL.
- -Attribute | -Description | -Required | -
url | -The url to expose | -Exactly one of these | -
file | -The file to expose as a file: url | -|
baseUrl | -The base URL which must be combined with relativePath | -|
relativePath | -Relative path that defines the url combined with - baseUrl | -If using baseUrl | -
Represents a Java String. It can be written to, but only once, after which -it will be an error to write to again.
- -Attribute | -Description | -Required | -
value | -The value of this resource | -No | -
The resource also supports nested text, which can only be supplied if the value
attribute is unset:
-
- <string> - self.log("Ant version =${ant.version}"); - </string> -- - - -
Represents an Ant property.
- -Attribute | -Description | -Required | -
name | -The property name | -Yes | -
-A Resource Collection is an abstraction of an entity that groups -together a number of resources. Several of -Ant's "legacy" datatypes have been modified to behave as Resource Collections: -
Strangely, some tasks can even legitimately behave as resource collections: -
A generic resource collection, designed for use with
- references.
- For example, if a third-party Ant task generates a Resource Collection
- of an unknown type, it can still be accessed via a
- <resources>
collection. The secondary use of this
- collection type is as a container of other resource collections,
- preserving the order of nested collections as well as
- duplicate resources (contrast with union).
-
-- --
-- -Attribute -Description -Required -- -cache -Whether to cache results. since Ant 1.8.0 -No, default false -
A group of files. These files are matched by absolute patterns
- taken from a number of PatternSets.
- These can be specified as nested <patternset>
- elements. In addition, <files>
holds an implicit
- PatternSet and supports the nested <include>
,
- <includesfile>
, <exclude>
- and <excludesfile>
elements of PatternSet directly,
- as well as PatternSet's attributes.
-
File Selectors are available as nested
- elements. A file must be selected by all selectors in order to be included;
- <files>
is thus equivalent to an
- <and>
file selector container.
-
More simply put, this type is equivalent to a - fileset with no base directory. - Please note that without a base directory, - filesystem scanning is based entirely on include and exclude patterns. - A filename (or any) - selector can only influence the scanning process after - the file has been included based on pattern-based selection. -
- -Attribute | -Description | -Required | -
includes | -comma- or space-separated list of patterns - of files that must be included | -At least one of these | -
includesfile | -the name of a file; each line of this file is - taken to be an include pattern. | -|
excludes | -comma- or space-separated list of patterns - of files that must be excluded | -No, default none - (except default excludes when true) | -
excludesfile | -the name of a file; each line of this file is - taken to be an exclude pattern. | -|
defaultexcludes | -Whether - default excludes - should be used | -No, default true | -
casesensitive | -Whether patterns are case-sensitive | -No, default true | -
followsymlinks | -Whether to follow symbolic links - (see note below) | -No, default true | -
Note: All files/directories for which -the canonical path is different from its path are considered symbolic -links. On Unix systems this usually means the file really is a -symbolic link but it may lead to false results on other -platforms. -
- -Restricts a nested resource collection using resource selectors: -
-- --
-- -Attribute -Description -Required -- -cache -Whether to cache results; disabling - may seriously impact performance -No, default true -Parameters specified as nested elements
-A single resource collection is required.
-Nested resource selectors are used to "narrow down" the included - resources, combined via a logical AND. These are patterned - after file selectors but are, - unsurprisingly, targeted to resources. - Several built-in resource selectors are available in the internal - antlib -
- -org.apache.tools.ant.types.resources.selectors
: --
- -- name - select resources by name.
-- exists - select existing resources.
-- date - select resources by date.
-- type - select resources by type.
-- size - select resources by size.
-- instanceof - - select resources by class or Ant datatype.
-- and - "and" nested resource selectors.
-- or - "or" nested resource selectors.
-- not - "not" a nested resource selector.
-- none - - select resources selected by no nested resource selectors.
-- majority - select resources selected - by a majority of nested resource selectors.
-- modified - select resources which - content has changed.
-- contains - select resources - containing a particular text string.
-- containsregexp - select - resources whose contents match a particular regular expression.
-- compare - select resources - based on comparison to other resources.
-- readable - - Select files (resources must be files) if they are readable.
-- writable - - Select files (resources must be files) if they are writable.
-name
-Selects resources by name.
--
- -- -Attribute -Description -Required -- -name -The name pattern to test using standard Ant - patterns. -Exactly one of - the two -- -regex -The regular expression matching files to select. -- -casesensitive -Whether name comparisons are case-sensitive -No, default true -- -handledirsep -- If this is specified, the mapper will treat a \ character in a - resource name or name attribute as a / for the purposes of - matching. This attribute can be true or false, the default is - false. - Since Ant 1.8.0. - No -exists
-Selects existing resources.
- -date
-Selects resources by date.
--
- -- -Attribute -Description -Required -- -millis -The comparison date/time in ms since January 1, 1970 -One of these -- -datetime -The formatted comparison date/time -- -pattern -SimpleDateFormat-compatible pattern - for use with the -datetime
attribute- No, default is "MM/DD/YYYY HH:MM AM_or_PM" -- -granularity -The number of milliseconds leeway to use when - comparing file modification times. This is needed because not - every file system supports tracking the last modified time to - the millisecond level. -No; default varies by platform: - FAT filesystems = 2 sec; Unix = 1 sec; NTFS = 1 ms. -- -when -One of "before", "after", "equal" -No, default "equal" -type
-Selects resources by type (file or directory).
--
- -- -Attribute -Description -Required -- -type -One of "file", "dir", "any" (since Ant 1.8) -Yes -size
-Selects resources by size.
--
- -- -Attribute -Description -Required -- -size -The size to compare -Yes -- -when -One of "equal", "eq", "greater", "gt", "less", "lt", - "ge" (greater or equal), "ne" (not equal), "le" (less or equal) -No, default "equal" -instanceof
-Selects resources by type.
--
- -- -Attribute -Description -Required -- -class -The class of which the resource must be an instance -One of these -- -type -The Ant type that must - be assignable from the resource -- -uri -The uri in which type must be defined -No -and
-Selects a resource if it is selected by all nested resource selectors.
- -or
-Selects a resource if it is selected - by at least one nested resource selector.
- -not
-Negates the selection result of the single - nested resource selector allowed.
- -none
-Selects a resource if it is selected - by no nested resource selectors.
- -majority
-Selects a resource if it is selected - by the majority of nested resource selectors.
--
- -- -Attribute -Description -Required -- -allowtie -Whether a tie (when there is an even number - of nested resource selectors) is considered a majority -No, default true -compare
-Selects a resource based on its comparison to one or more "control" - resources using nested resource comparators.
--
-- -Attribute -Description -Required -- -when -Comparison ("equal"/"eq", "greater"/"gt", "less"/"lt", - "le" (less or equal), "ge" (greater or equal), "ne" (not equal). -No, default "equal" -- -against -Quantifier ("all"/"each"/"every", "any"/"some", - (exactly) "one", "most"/"majority", "none". -No, default "all" -Parameters specified as nested elements
-The resources against which comparisons will be made must be specified - using the nested <control> element, which denotes a - resources collection.
-Examples
-Assuming the namespace settings -
-rsel="antlib:org.apache.tools.ant.types.resources.selectors" - rcmp="antlib:org.apache.tools.ant.types.resources.comparators" -
-<restrict> - <fileset dir="src" includes="a,b,c,d,e,f,g" /> - <rsel:compare when="le" against="all"> - <control> - <resource name="d" /> - </control> - <rcmp:name /> - </rsel:compare> -</restrict> --Selects files a, b, c, and d.
-- <project rsel="antlib:org.apache.tools.ant.types.resources.selectors"> - <macrodef name="copyFromPath"> - <attribute name="todir"/> - <attribute name="refid"/> - <element name="nested-resource-selectors" optional="yes" implicit="true"/> - <sequential> - <mkdir dir="@{todir}" taskname="copyFromPath"/> - <copy todir="@{todir}" taskname="copyFromPath"> - <restrict> - <path refid="@{refid}"/> - <rsel:or> - <nested-resource-selectors/> - </rsel:or> - </restrict> - <flattenmapper/> - </copy> - </sequential> - </macrodef> - <copyFromPath refid="classpath" todir="todir"> - <rsel:name name="log4j.properties"/> - <rsel:name name="default.properties"/> - </copyFromPath> - </project> --Creates the todir directory and copies (if present) the - files log4j.properties and default.properties - from the Classpath (already used while compiling). -
- -- <project> - <filelist id="allfiles" dir="${ant.home}/bin" files="ant.cmd,foo.txt,ant.bat,bar.txt,ant"/> - <restrict id="missingfiles"> - <filelist refid="allfiles"/> - <rsel:not xmlns:rsel="antlib:org.apache.tools.ant.types.resources.selectors"> - <rsel:exists/> - </rsel:not> - </restrict> - <echo>These files are missed: ${toString:missingfiles}</echo> - </project> --The resource collection allfiles defines a list of files which are expected. The restrict - missingfiles uses the <not><exists> selector for getting all files - which are not present. Finally we use the toString: pathshortcut for - getting them in a readable form: [echo] These files are missed: ....foo.txt;....bar.txt
- -
Sorts a nested resource collection according to the resources' - natural order, or by one or more nested resource - comparators:
--- --
-- -Attribute -Description -Required -- -cache -Whether to cache results; disabling - may seriously impact performance -No, default true -Parameters specified as nested elements
-A single resource collection is required.
-The sort can be controlled and customized by specifying one or more - resource comparators. Resources can be sorted according to multiple - criteria; the first specified is the "outermost", while the last - specified is the "innermost". Several built-in resource comparators - are available in the internal antlib -
-org.apache.tools.ant.types.resources.comparators
: -Resource Comparators:
--
- -- name - sort resources by name
-- exists - sort resources by existence
-- date - sort resources by date
-- type - sort resources by type
-- size - sort resources by size
-- content - sort resources by content
-- reverse - reverse the natural sort order, - or that of a single nested resource comparator
-name
-Sort resources by name.
- -exists
-Sort resources by existence. - Not existing is considered "less than" existing.
- -date
-Sort resources by date.
- -type
-Sort resources by type (file or directory). - Because directories contain files, they are considered "greater".
- -size
-Sort resources by size.
- -content
-Sort resources by content.
--
- -- -Attribute -Description -Required -- -binary -Whether content should be compared in binary mode. - If false, content will be compared without regard to - platform-specific line-ending conventions. -No, default true -reverse
-Reverse the natural sort order, or that of a single nested comparator.
- -Examples
-- <property name="eol" value="${line.separator}" /> - <pathconvert property="sorted" pathsep="${eol}"> - <sort> - <tokens> - <string value="foo bar etc baz" /> - <stringtokenizer /> - </tokens> - </sort> - </pathconvert>-The resource of type string "foo bar etc baz" is split into four tokens by - the stringtokenizer. These tokens are sorted and there sorted gets the value - of "bar baz etc foo".
- -- <sort> - <fileset dir="foo" /> - <reverse xmlns="antlib:org.apache.tools.ant.types.resources.comparators"> - <date /> - </reverse> - </sort>-This takes all files from foo - and sorts them by modification date in reverse order. - Because the resource comparators used (
- -<reverse>
- and<date>
) are in an internal antlib - their namespace must be set explicitly. -
Includes the first count resources from a nested resource collection. -This can be used in conjunction with the sort collection, -for example, to select the first few oldest, largest, etc. resources from a -larger collection.
--- --
-- -Attribute -Description -Required -- -count -The number of resources to include -No, default 1 -- -cache -Whether to cache results; disabling - may seriously impact performance -No, default true -Parameters specified as nested elements
-A single resource collection is required.
-
Includes the last count resources from a nested resource collection. -This can be used in conjunction with the sort collection, -for example, to select the last few oldest, largest, etc. resources from a -larger collection. Since Ant 1.7.1.
--- --
-- -Attribute -Description -Required -- -count -The number of resources to include -No, default 1 -- -cache -Whether to cache results; disabling - may seriously impact performance -No, default true -Parameters specified as nested elements
-A single resource collection is required.
-
Includes all elements except for the first count resources -from a nested resource collection. This can be used in conjunction -with the sort collection, for example, to select -all but the first few oldest, largest, etc. resources from a larger -collection. Since Ant 1.9.5.
--- --
-- -Attribute -Description -Required -- -count -The number of resources to exclude -No, default 1 -- -cache -Whether to cache results; disabling - may seriously impact performance -No, default true -Parameters specified as nested elements
-A single resource collection is required.
-
Includes all elements except for the last count resources -from a nested resource collection. This can be used in conjunction -with the sort collection, for example, to select -all but the last few oldest, largest, etc. resources from a larger -collection. Since Ant 1.9.5.
--- --
-- -Attribute -Description -Required -- -count -The number of resources to exclude -No, default 1 -- -cache -Whether to cache results; disabling - may seriously impact performance -No, default true -Parameters specified as nested elements
-A single resource collection is required.
-
Includes the string tokens gathered from a nested
- resource collection. Uses the same tokenizers supported by the
-TokenFilter. Imaginative
- use of this resource collection can implement equivalents for such Unix
- functions as sort
, grep -c
, wc
and
- wc -l
.
-- --
-- -Attribute -Description -Required -- -encoding -The encoding of the nested resources -No, default is platform default -- -cache -Whether to cache results; disabling - may seriously impact performance -No, default true -Parameters specified as nested elements
--
-- A single resource collection is required.
-- One nested tokenizer may be specified. If omitted, a - LineTokenizer will be used. -
-Examples
-<concat> - <union> - <sort> - <tokens> - <resources refid="input" /> - <linetokenizer includedelims="true" /> - </tokens> - </sort> - </union> -</concat> --Implements Unix sort -u against resource collection input.
-
-- -The following resource collections implement set operations:
--
- -- union
-- intersect
-- difference
-union
-Union of nested resource collections.
- -intersect
-Intersection of nested resource collections.
- -difference
-Difference of nested resource collections.
- -The following attributes apply to all set-operation resource collections: -
--
- -- -Attribute -Description -Required -- -cache -Whether to cache results; disabling - may seriously impact performance -No, default true -Examples
-- <resources id="A"> - <string value="a"/> - <string value="b"/> - </resources> - <resources id="B"> - <string value="b"/> - <string value="c"/> - </resources> - <union id="union"><resources refid="A"/><resources refid="B"/></union> - <intersect id="intersect"><resources refid="A"/><resources refid="B"/></intersect> - <difference id="difference"><resources refid="A"/><resources refid="B"/></difference> - <echo> - A: ${toString:A} = a;b - B: ${toString:B} = b;c - - union : ${toString:union} = a;b;c - intersect : ${toString:intersect} = b - difference: ${toString:difference} = a;c - </echo> --
Since Ant 1.8.0
- -Wraps another resource collection and maps the names of the nested - resources using a mapper.
- -Even if mappedresources wraps a resource collection that - consists of file-system based resources, mappedresources - will not appear to be file-system based. This means you can't - use mappedresources with tasks that only allow file-system - based resources.
- --- -Parameters specified as attributes
- --
- -- -Attribute -Description -Required -- -cache -Whether to cache results; enabling - may improve performance. Since Ant 1.8.1 -No, default false -- -enablemultiplemappings -- If true the the collection will use all the mappings for a - given source path. If false the it will only process the first - resource. - since Ant 1.8.1. -No - defaults to false. -Parameters specified as nested elements
-A single resource collection is required.
-A single mapper can be used to map - names. If no mapper has been given (which doesn't make any sense, - honestly), an identity mapper will be used.
- -Examples
- -Copies all files from a given directory to a target directory - adding ".bak" as an extension. Note this could be done with a - mapper nested into copy directly as well.
- -- <copy todir="${target}"> - <mappedresources> - <fileset dir="${src}"/> - <globmapper from="*" to="*.bak"/> - </mappedresources> - </copy> -- -Creates a WAR archive adding all CLASSPATH entries that are files - to the
- -WEB-INF/lib
directory without keeping their - files-system structure.- <war destfile="${output}"> - <mappedresources> - <restrict> - <path path="${java.class.path}"/> - <type type="file"/> - </restrict> - <chainedmapper> - <flattenmapper/> - <globmapper from="*" to="WEB-INF/lib/*"/> - </chainedmapper> - </mappedresources> - </war> --
Since Ant 1.8.0
- -This resource collection accepts an arbitrary number of nested
- resources and assumes that all those resources must be either ZIP or
- TAR archives. The resources returned
- by <archives>
are the contents of the nested
- archives.
This resource collection is a generalization - of zipgroupfileset - which is only supported by the zip family of tasks.
- -archives doesn't support any attributes.
- --- -Parameters specified as nested elements
- -- -
<archives>
has two nested - elements<zips>
and -<tars>
that are unions - themselves, i.e. they accept arbitrary many resource(collection)s - as nested elements.The nested resources of <zips> are treated as ZIP archives, - the nested resources of <tars> as TAR archives.
- -Examples
- -Copies all files from all jars that are on the classpath - to
- -${target}
.- <copy todir="${target}"> - <archives> - <zips> - <restrict> - <path path="${java.class.path}"/> - <name name="*.jar"/> - </restrict> - </zips> - </archives> - </copy> --
Since Ant 1.8.0
- -This resource collection accepts an arbitrary number of nested - resources, reads those resources and returns a resource for each - line read.
- -If the line contains a colon, Ant will try to use it as an URL and - if that fails (or the line doesn't contain a colon) will return a - file resource with the line's content as its name.
- -Properties will be expanded for each line. If the property - expansion yields a resource object rather than a string (for example - because of custom property helpers), the resources will be returned - directly.
- -<resourcelist>
is a generalization
- of <filelist>
.
-- --
-- -Attribute -Description -Required -- -encoding -The encoding of the nested resources -No, default is platform default -
-- - - diff --git a/framework/src/ant/apache-ant-1.9.6/manual/Types/selectors-program.html b/framework/src/ant/apache-ant-1.9.6/manual/Types/selectors-program.html deleted file mode 100644 index 074a5426..00000000 --- a/framework/src/ant/apache-ant-1.9.6/manual/Types/selectors-program.html +++ /dev/null @@ -1,244 +0,0 @@ - - - - - -Parameters specified as nested elements
- -- -
<resourcelist>
accepts arbitrary many - resource(collection)s as nested elements.In addition
- -<resourcelist>
supports - nested<filterchain>
elements that can be used - to filter/modify the read resources before their lines get - expanded. Such a nested element corresponds to - a filterchain.Examples
- -The following example copies a file from the first URL of - several alternatives that can actually be reached. It assumes - that the file mirrors.txt looks like
- -- mirrors.txt: -http://best.mirror.example.org/ -http://second.best.mirror.example.org/mirror/of/best/ -https://yet.another.mirror/ -http://the.original.site/ -- -- <copy todir="${target}"> - <first> - <restrict> - <resourcelist> - <file file="mirrors.txt"/> - </resourcelist> - <exists/> - </restrict> - </first> - </copy> --
Want to define your own selectors? It's easy!
- -First, pick the type of selector that you want to define. There - are three types, and a recipe for each one follows. Chances are - you'll want to work with the first one, Custom Selectors.
- -This is the category that Apache Ant provides specifically for you to
- define your own Selectors. Anywhere you want to use your selector
- you use the <custom>
element and specify
- the class name of your selector within it. See the
- Custom Selectors
- section of the Selector page for details. The
- <custom>
element can be used anywhere
- the core selectors can be used. It can be contained within
- Selector Containers,
- for example.
To create a new Custom Selector, you have to create a class that
- implements
- org.apache.tools.ant.types.selectors.ExtendFileSelector
.
- The easiest way to do that is through the convenience base class
- org.apache.tools.ant.types.selectors.BaseExtendSelector
,
- which provides all of the methods for supporting
- <param>
tags. First, override the
- isSelected()
method, and optionally the
- verifySettings()
method. If your custom
- selector requires parameters to be set, you can also override
- the setParameters()
method and interpret the
- parameters that are passed in any way you like. Several of the
- core selectors demonstrate how to do that because they can
- also be used as custom selectors.
These are the selectors used by Ant itself. To implement one of - these, you will have to alter some of the classes contained within - Ant.
- -First, create a class that implements
- org.apache.tools.ant.types.selectors.FileSelector
.
- You can either choose to implement all methods yourself from
- scratch, or you can extend
- org.apache.tools.ant.types.selectors.BaseSelector
- instead, a convenience class that provides reasonable default
- behaviour for many methods.
There is only one method required.
- public boolean isSelected(File basedir, String filename,
- File file)
- is the real purpose of the whole exercise. It returns true
- or false depending on whether the given file should be
- selected from the list or not.
If you are using
- org.apache.tools.ant.types.selectors.BaseSelector
- there are also some predefined behaviours you can take advantage
- of. Any time you encounter a problem when setting attributes or
- adding tags, you can call setError(String errmsg) and the class
- will know that there is a problem. Then, at the top of your
- isSelected()
method call validate()
and
- a BuildException will be thrown with the contents of your error
- message. The validate()
method also gives you a
- last chance to check your settings for consistency because it
- calls verifySettings()
. Override this method and
- call setError()
within it if you detect any
- problems in how your selector is set up.
You may also want to override toString()
.
Put an add
method for your selector in
- org.apache.tools.ant.types.selectors.SelectorContainer
.
- This is an interface, so you will also have to add an implementation
- for the method in the classes which implement it, namely
- org.apache.tools.ant.types.AbstractFileSet
,
- org.apache.tools.ant.taskdefs.MatchingTask
and
- org.apache.tools.ant.types.selectors.BaseSelectorContainer
.
- Once it is in there, it will be available everywhere that core
- selectors are appropriate.
Got an idea for a new Selector Container? Creating a new one is - no problem:
-Create a new class that implements
- org.apache.tools.ant.types.selectors.SelectorContainer
.
- This will ensure that your new
- Container can access any new selectors that come along. Again, there
- is a convenience class available for you called
- org.apache.tools.ant.types.selectors.BaseSelectorContainer
.
-
Implement the
- public boolean isSelected(String filename, File file)
- method to do the right thing. Chances are you'll want to iterate
- over the selectors under you, so use
- selectorElements()
to get an iterator that will do
- that.
Again, put an add
method for your container in
- org.apache.tools.ant.types.selectors.SelectorContainer
- and its implementations
- org.apache.tools.ant.types.AbstractFileSet
and
- org.apache.tools.ant.types.selectors.BaseSelectorContainer
.
-
For a robust component (and selectors are (Project)Components) tests are - necessary. For testing Tasks we use JUnit TestCases - more specific - org.apache.tools.ant.BuildFileRule extends org.junit.rules.ExternalResource. - Some of its features like configure the (test) project by reading its buildfile and - execute targets we need for selector tests also. Therefore we use that BuildFileRule. - But testing selectors requires some more work: having a set of files, instantiate - and configure the selector, check the selection work and more. Because we usually - extend BaseExtendSelector its features have to be tested also (e.g. setError()). -
- -That's why we have a test rule for doing our selector tests: - org.apache.tools.ant.types.selectors.BaseSelectorRule.
- -This class extends ExternalResource and therefore can included in the set of Ant's - unit tests. It holds an instance of preconfigured BuildFileRule. Configuration - is done by parsing the src/etc/testcases/types/selectors.xml. BaseSelectorRule - then gives us helper methods for handling multiple selections.
- -Because the term "testcase" or "testenvironment" are so often used, this - special testenvironment got a new name: bed. The setup and cleanup of - the bed is all handled by the BaseSelectorRule so any test only has to handle - the actual test scenarios
- -A usual test scenario is:
-An example test would be:
-package org.apache.tools.ant.types.selectors; - -public class MySelectorTest { - - @Rule - public final BaseSelectorRule selectorRule = new BaseSelectorRule(); - - @Test - public void testCase1() { - - - // Configure the selector - MySelector s = new MySelector(); - s.addParam("key1", "value1"); - s.addParam("key2", "value2"); - s.setXX(true); - s.setYY("a value"); - - // do the tests - assertEquals("FTTTTTTTT", selectorRule.selectionString(s)); - } -} -- As an example of an error JUnit could log
- [junit] FAILED - [junit] Error for files: .;copy.filterset.filtered;tar/gz/asf-logo.gif.tar.gz - [junit] expected:<FTTTFTTTF...> but was:<TTTTTTTTT...> - [junit] junit.framework.ComparisonFailure: Error for files: .;copy.filterset.filtered;tar/gz/asf-logo.gif.tar.gz - [junit] expected:<FTTTFTTTF...> but was:<TTTTTTTTT...> - [junit] at junit.framework.Assert.assertEquals(Assert.java:81) - [junit] at org.apache.tools.ant.types.selectors.BaseSelectorTest.performTest(BaseSelectorTest.java:194) -- -
Described above the test class should provide a getInstance() - method. But that isn't used here. The used getSelector() method is - implemented in the base class and gives an instance of an Ant Project to - the selector. This is usually done inside normal build file runs, but not - inside this special environment, so this method gives the selector the - ability to use its own Project object (getProject()), for example - for logging.
- - -During development and maybe later you sometimes need the output of information.
- Therefore Logging is needed. Because the selector extends BaseExtendSelector or directly
- BaseSelector it is an Ant DataType and therefore a ProjectComponent.
- That means that you have access to the project object and its logging capability.
- ProjectComponent itself provides log methods which will do the
- access to the project instance. Logging is therefore done simply with:
-
- log( "message" ); -- or -
- log( "message" , loglevel ); -- where the loglevel is one of the values
Selectors are a mechanism whereby the files that make up a
- <fileset>
can be selected based on criteria
- other than filename as provided by the <include>
- and <exclude>
tags.
A selector is an element of FileSet, and appears within it. It can
- also be defined outside of any target by using the <selector>
tag
- and then using it as a reference.
-
Different selectors have different attributes. Some selectors can
- contain other selectors, and these are called
- Selector Containers
.
- There is also a category of selectors that allow
- user-defined extensions, called
- Custom Selectors
.
- The ones built in to Apache Ant are called
- Core Selectors
.
-
Core selectors are the ones that come standard - with Ant. They can be used within a fileset and can be contained - within Selector Containers.
- -The core selectors are:
- -<contains>
- Select
- files that contain a particular text string<date>
- Select files
- that have been modified either before or after a particular date
- and time<depend>
- Select files
- that have been modified more recently than equivalent files
- elsewhere<depth>
- Select files
- that appear so many directories down in a directory tree<different>
- Select files
- that are different from those elsewhere<filename>
- Select
- files whose name matches a particular pattern. Equivalent to
- the include and exclude elements of a patternset.<present>
- Select
- files that either do or do not exist in some other location<containsregexp>
- Select
- files that match a regular expression<size>
- Select files
- that are larger or smaller than a particular number of bytes.<type>
- Select files
- that are either regular files or directories.<modified>
- Select files if
- the return value of the configured algorithm is different from that
- stored in a cache.<signedselector>
- Select files if
- they are signed, and optionally if they have a signature of a certain name.
- <scriptselector>
-
- Use a BSF or JSR 223 scripting language to create
- your own selector
- <readable>
-
- Select files if they are readable.<writable>
-
- Select files if they are writable.The <contains>
tag in a FileSet limits
- the files defined by that fileset to only those which contain the
- string specified by the text
attribute.
- .
The <contains>
selector can be used as a
- ResourceSelector (see the
- <restrict>
- ResourceCollection).
Attribute | -Description | -Required | -
text | -Specifies the text that every file must contain - | -Yes | -
casesensitive | -Whether to pay attention to case when looking
- for the string in the text attribute. Default is
- true.
- |
- No | -
ignorewhitespace | -Whether to eliminate whitespace before checking
- for the string in the text attribute. Default is
- false.
- |
- No | -
encoding | -Encoding of the resources being selected. - Required in practice if the encoding of the files being - selected is different from the default encoding of the JVM - where Ant is running. - Since Ant 1.9.0 - | -No | -
Here is an example of how to use the Contains Selector:
- -- --<fileset dir="${doc.path}" includes="**/*.html"> - <contains text="script" casesensitive="no"/> -</fileset> -
Selects all the HTML files that contain the string
- script
.
The <date>
tag in a FileSet will put
- a limit on the files specified by the include tag, so that tags
- whose last modified date does not meet the date limits specified
- by the selector will not end up being selected.
Attribute | -Description | -Required | -
datetime | -Specifies the date and time to test for. - Should be in the format MM/DD/YYYY HH:MM AM_or_PM, or - an alternative pattern specified via the pattern - attribute. - | -At least one of the two. | -
millis | -The number of milliseconds since 1970 that should - be tested for. It is usually much easier to use the datetime - attribute. - | -|
when | -Indicates how to interpret the date, whether
- the files to be selected are those whose last modified times should
- be before, after, or equal to the specified value. Acceptable
- values for this attribute are:
-
| No | -
granularity | -The number of milliseconds leeway to use when - comparing file modification times. This is needed because not every - file system supports tracking the last modified time to the - millisecond level. Default is 0 milliseconds, or 2 seconds on DOS systems. - | -No | -
pattern | -The SimpleDateFormat -compatible pattern
- to use when interpreting the datetime attribute.
- Since Ant 1.6.2
- |
- No | -
checkdirs | -- Indicates whether or not to check dates on directories. - | -No, defaults to false | -
Here is an example of how to use the Date Selector:
- -- --<fileset dir="${jar.path}" includes="**/*.jar"> - <date datetime="01/01/2001 12:00 AM" when="before"/> -</fileset> -
Selects all JAR files which were last modified before midnight - January 1, 2001.
- - -The <depend>
tag selects files
- whose last modified date is later than another, equivalent file in
- another location.
The <depend>
tag supports the use of a
- contained <mapper>
element
- to define the location of the file to be compared against. If no
- <mapper>
element is specified, the
- identity
type mapper is used.
The <depend>
selector is case-sensitive.
Attribute | -Description | -Required | -
targetdir | -The base directory to look for the files to compare
- against. The precise location depends on a combination of this
- attribute and the <mapper> element, if any.
- |
- Yes | -
granularity | -The number of milliseconds leeway to give before - deciding a file is out of date. This is needed because not every - file system supports tracking the last modified time to the - millisecond level. Default is 0 milliseconds, or 2 seconds on DOS systems. - | -No | -
Here is an example of how to use the Depend Selector:
- -- --<fileset dir="${ant.1.5}/src/main" includes="**/*.java"> - <depend targetdir="${ant.1.4.1}/src/main"/> -</fileset> -
Selects all the Java source files which were modified in the - 1.5 release. -
- - -The <depth>
tag selects files based on
- how many directory levels deep they are in relation to the base
- directory of the fileset.
-
Attribute | -Description | -Required | -
min | -The minimum number of directory levels below - the base directory that a file must be in order to be selected. - Default is no limit. - | -At least one of the two. | -
max | -The maximum number of directory levels below - the base directory that a file can be and still be selected. - Default is no limit. - | -
Here is an example of how to use the Depth Selector:
- -- --<fileset dir="${doc.path}" includes="**/*"> - <depth max="1"/> -</fileset> -
Selects all files in the base directory and one directory below - that.
- - -The <different>
selector will select a file
- if it is deemed to be 'different' from an equivalent file in
- another location. The rules for determining difference between
- the two files are as follows:
-
<copy>
task, set
- preservelastmodified to true to propagate the timestamp
- from the source file to the destination file.
-
- The <different>
selector supports the use of a
- contained <mapper>
element
- to define the location of the file to be compared against. If no
- <mapper>
element is specified, the
- identity
type mapper is used.
Attribute | -Description | -Required | -
targetdir | -The base directory to look for the files to compare
- against. The precise location depends on a combination of this
- attribute and the <mapper> element, if any.
- |
- Yes | -
ignoreFileTimes | -Whether to use file times in the comparison or not. - Default is true (time differences are ignored). - | -No | -
ignoreContents | -Whether to do a byte per byte compare. - Default is false (contents are compared). - Since Ant 1.6.3 - | -No | -
granularity | -The number of milliseconds leeway to give before - deciding a file is out of date. This is needed because not every - file system supports tracking the last modified time to the - millisecond level. Default is 0 milliseconds, or 2 seconds on DOS systems. - | -No | -
Here is an example of how to use the Different Selector:
- -- --<fileset dir="${ant.1.5}/src/main" includes="**/*.java"> - <different targetdir="${ant.1.4.1}/src/main" - ignoreFileTimes="true"/> -</fileset> -
Compares all the Java source files between the 1.4.1 and the 1.5 release - and selects those who are different, disregarding file times. -
- -The <filename>
tag acts like the
- <include>
and <exclude>
- tags within a fileset. By using a selector instead, however,
- one can combine it with all the other selectors using whatever
- selector container is desired.
-
The <filename>
selector is
- case-sensitive.
Attribute | -Description | -Required | -
name | -The name of files to select. The name parameter - can contain the standard Ant wildcard characters. - | -Exactly one of - the two | -
regex | -The regular expression matching files to select. | -|
casesensitive | -Whether to pay attention to case when looking - at file names. Default is "true". - | -No | -
negate | -Whether to reverse the effects of this filename - selection, therefore emulating an exclude rather than include - tag. Default is "false". - | -No | -
Here is an example of how to use the Filename Selector:
- -- --<fileset dir="${doc.path}" includes="**/*"> - <filename name="**/*.css"/> -</fileset> -
Selects all the cascading style sheet files.
- - -The <present>
tag selects files
- that have an equivalent file in another directory tree.
The <present>
tag supports the use of a
- contained <mapper>
element
- to define the location of the file to be tested against. If no
- <mapper>
element is specified, the
- identity
type mapper is used.
The <present>
selector is case-sensitive.
Attribute | -Description | -Required | -
targetdir | -The base directory to look for the files to compare
- against. The precise location depends on a combination of this
- attribute and the <mapper> element, if any.
- |
- Yes | -
present | -Whether we are requiring that a file is present in
- the src directory tree only, or in both the src and the target
- directory tree. Valid values are:
-
<not>
- selector container.
- |
- No | -
Here is an example of how to use the Present Selector:
- -- --<fileset dir="${ant.1.5}/src/main" includes="**/*.java"> - <present present="srconly" targetdir="${ant.1.4.1}/src/main"/> -</fileset> -
Selects all the Java source files which are new in the - 1.5 release. -
- -The <containsregexp>
tag in a FileSet limits
- the files defined by that fileset to only those which contents contain a
- match to the regular expression specified by the expression
attribute.
-
The <containsregexp>
selector can be used as a
- ResourceSelector (see the
- <restrict>
- ResourceCollection).
Attribute | -Description | -Required | -
expression | -Specifies the regular expression that must - match true in every file | -Yes | -
casesensitive | -Perform a case sensitive match. Default is - true. since Ant 1.8.2 | -No | -
multiline | -- Perform a multi line match. - Default is false. since Ant 1.8.2 | -No | -
singleline | -- This allows '.' to match new lines. - SingleLine is not to be confused with multiline, SingleLine is a perl - regex term, it corresponds to dotall in java regex. - Default is false. since Ant 1.8.2 | -No | -
Here is an example of how to use the regular expression Selector:
- -- --<fileset dir="${doc.path}" includes="*.txt"> - <containsregexp expression="[4-6]\.[0-9]"/> -</fileset> -
Selects all the text files that match the regular expression - (have a 4,5 or 6 followed by a period and a number from 0 to 9). - - -
The <size>
tag in a FileSet will put
- a limit on the files specified by the include tag, so that tags
- which do not meet the size limits specified by the selector will not
- end up being selected.
Attribute | -Description | -Required | -
value | -The size of the file which should be tested for. - | -Yes | -
units | -The units that the value attribute
- is expressed in. When using the standard single letter SI
- designations, such as "k","M", or
- "G", multiples of 1000 are used. If you want to use
- power of 2 units, use the IEC standard: "Ki" for 1024,
- "Mi" for 1048576, and so on. The default is no units,
- which means the value attribute expresses the exact
- number of bytes.
- |
- No | -
when | -Indicates how to interpret the size, whether
- the files to be selected should be larger, smaller, or equal to
- that value. Acceptable values for this attribute are:
-
| No | -
Here is an example of how to use the Size Selector:
- -- --<fileset dir="${jar.path}"> - <patternset> - <include name="**/*.jar"/> - </patternset> - <size value="4" units="Ki" when="more"/> -</fileset> -
Selects all JAR files that are larger than 4096 bytes.
- -The <type>
tag selects files of a certain type:
- directory or regular.
Attribute | -Description | -Required | -
type | -The type of file which should be tested for.
- Acceptable values are:
-
|
- Yes | -
Here is an example of how to use the Type Selector to select only
- directories in ${src}
- --<fileset dir="${src}"> - <type type="dir"/> -</fileset> -
The Type Selector is often used in conjunction with other selectors.
- For example, to select files that also exist in a template
- directory, but avoid selecting empty directories, use:
-
-
- - --<fileset dir="${src}"> - <and> - <present targetdir="template"/> - <type type="file"/> - </and> -</fileset> -
The <modified>
selector computes a value for a file, compares that
- to the value stored in a cache and select the file, if these two values
- differ.
Because this selector is highly configurable the order in which the selection is done - is:
The comparison, computing of the hashvalue and the store is done by implementation - of special interfaces. Therefore they may provide additional parameters.
- -The <modified>
selector can be used as a
- ResourceSelector (see the
- <restrict>
- ResourceCollection).
- In that case it maps simple file resources to files and does its job. If the
- resource is from another type, the <modified>
selector tries
- to (attention!) copy the content into a local file for computing the
- hashvalue.
Attribute | -Description | -Required | -
algorithm | - The type of algorithm should be used.
- Acceptable values are (further information see later):
-
|
- No, defaults to digest | -
cache | - The type of cache should be used.
- Acceptable values are (further information see later):
-
|
- No, defaults to propertyfile | -
comparator | - The type of comparator should be used.
- Acceptable values are (further information see later):
-
|
- No, defaults to equal | -
algorithmclass | -Classname of custom algorithm implementation. Lower - priority than algorithm. | -No | -
cacheclass | -Classname of custom cache implementation. Lower - priority than cache. | -No | -
comparatorclass | -Classname of custom comparator implementation. Lower - priority than comparator. | -No | -
update | -Should the cache be updated when values differ? (boolean) | -No, defaults to true | -
seldirs | -Should directories be selected? (boolean) | -No, defaults to true | -
selres | -Should Resources without an InputStream, and - therefore without checking, be selected? (boolean) | -No, defaults to true. Only relevant - when used as ResourceSelector. | -
delayupdate | -If set to true, the storage of the cache will be delayed until the - next finished BuildEvent; task finished, target finished or build finished, - whichever comes first. This is provided for increased performance. If set - to false, the storage of the cache will happen with each change. This - attribute depends upon the update attribute. (boolean) | -No, defaults to true | -
These attributes can be set with nested <param/>
tags. With <param/>
- tags you can set other values too - as long as they are named according to
- the following rules:
Algorithm options | |
Name | -Description | -
hashvalue | -Reads the content of a file into a java.lang.String - and use thats hashValue(). No additional configuration required. - | -
digest | - Uses java.security.MessageDigest. This Algorithm supports
- the following attributes:
-
|
-
checksum | - Uses java.util.zip.Checksum. This Algorithm supports
- the following attributes:
-
|
-
Cache options | |
propertyfile | - Use the java.util.Properties class and its possibility
- to load and store to file.
- This Cache implementation supports the following attributes:
-
|
-
Comparator options | |
equal | -Very simple object comparison. | -
rule | -Uses java.text.RuleBasedCollator for Object - comparison. - - (see note for restrictions) - | -
The <modified>
selector supports a nested
- <classpath>
element that represents a
- PATH like structure for finding custom interface implementations.
Here are some examples of how to use the Modified Selector:
- --- <copy todir="dest"> - <fileset dir="src"> - <modified/> - </fileset> - </copy> -
This will copy all files from src to dest which content has changed. - Using an updating PropertyfileCache with cache.properties and - MD5-DigestAlgorithm.
- --- <copy todir="dest"> - <fileset dir="src"> - <modified update="true" - seldirs="true" - cache="propertyfile" - algorithm="digest" - comparator="equal"> - <param name="cache.cachefile" value="cache.properties"/> - <param name="algorithm.algorithm" value="MD5"/> - </modified> - </fileset> - </copy> -
This is the same example rewritten as CoreSelector with setting the all the values - (same as defaults are).
- --- <copy todir="dest"> - <fileset dir="src"> - <custom class="org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector"> - <param name="update" value="true"/> - <param name="seldirs" value="true"/> - <param name="cache" value="propertyfile"/> - <param name="algorithm" value="digest"/> - <param name="comparator" value="equal"/> - <param name="cache.cachefile" value="cache.properties"/> - <param name="algorithm.algorithm" value="MD5"/> - </custom> - </fileset> - </copy> -
And this is the same rewritten as CustomSelector.
- --- <target name="generate-and-upload-site"> - <echo> generate the site using forrest </echo> - <antcall target="site"/> - - <echo> upload the changed file </echo> - <ftp server="${ftp.server}" userid="${ftp.user}" password="${ftp.pwd}"> - <fileset dir="htdocs/manual"> - <modified/> - </fileset> - </ftp> - </target> -
A useful scenario for this selector inside a build environment - for homepage generation (e.g. with - Apache Forrest). Here all changed files are uploaded to the server. The - CacheSelector saves therefore much upload time.
- --- <modified cacheclassname="com.mycompany.MyCache"> - <classpath> - <pathelement location="lib/mycompany-antutil.jar"/> - </classpath> - </modified> -
Uses com.mycompany.MyCache from a jar outside of Ants own classpath - as cache implementation
- -The RuleBasedCollator needs a format for its work, but its needed while - instantiation. There is a problem in the initialization algorithm for this - case. Therefore you should not use this (or tell me the workaround :-).
- -
- The <signedselector>
tag selects signed files and optionally
- signed with a certain name.
-
- This selector has been added in Apache Ant 1.7. -
-Attribute | -Description | -Required | -
name | -The signature name to check for. | -no | -
The <readable>
selector selects only files
- that are readable. Ant only invokes
- java.io.File#canRead
so if a file is unreadable
- but the Java VM cannot detect this state, this selector will
- still select the file.
The <writable>
selector selects only files
- that are writable. Ant only invokes
- java.io.File#canWrite
so if a file is unwritable
- but the Java VM cannot detect this state, this selector will
- still select the file.
- The <scriptselector>
element enables you
- to write a complex selection algorithm in any
- Apache BSF
- or
- JSR 223
- supported language.
- See the Script task for
- an explanation of scripts and dependencies.
-
- This selector was added in Apache Ant 1.7. -
-Attribute | -Description | -Required | -
language | -language of the script. | -yes | -
manager | -- The script engine manager to use. - See the script task - for using this attribute. - | -No - default is "auto" | -
src | -filename of the script | -no | -
setbeans | -whether to have all properties, references and targets as - global variables in the script. | -No, default is "true". | -
classpath | -- The classpath to pass into the script. - | -No | -
classpathref | -The classpath to use, given as a - reference to a path defined elsewhere. - | No | -
- This selector can take a nested <classpath> element. - See the script task - on how to use this element. -
-
- If no src
attribute is supplied, the script must be nested
- inside the selector declaration.
-
The embedded script is invoked for every test, with
- the bean self
- is bound to the selector. It has an attribute selected
- must can be set using setSelected(boolean)
to select that
- file.
-
-
- - The following beans are configured for every script, alongside - the classic set of project, properties, and targets. - -
Bean | -Description | -Type | -
self | -selector instance | -org.apache.tools.ant.types.optional | -
filename | -filename of the selection | -String | -
file | -file of the selection | -java.io.File | -
basedir | -Fileset base directory | -java.io.File | -
- The self
bean maps to the selector, which has the following
- attributes. Only the selected
flag is writable, the rest
- are read only via their getter methods.
-
-
Attribute | -Description | -Type | -
selected | -writeable flag to select this file | -boolean | -
filename | -filename of the selection | -String | -
file | -file of the selection | -java.io.File | -
basedir | -Fileset base directory | -java.io.File | -
- Example -
-- <scriptselector language="javascript"> - self.setSelected(true); - </scriptselector> --
- Selects every file. -
- -- <scriptselector language="javascript"> - self.setSelected((filename.length%2)==0); - </scriptselector> --Select files whose filename length is even. - -
To create more complex selections, a variety of selectors that - contain other selectors are available for your use. They combine the - selections of their child selectors in various ways.
- -The selector containers are:
- -<and>
- select a file only if all
- the contained selectors select it.
- <majority>
- select a file
- if a majority of its selectors select it.
- <none>
- select a file only if
- none of the contained selectors select it.
- <not>
- can contain only one
- selector, and reverses what it selects and doesn't select.
- <or>
- selects a file if any one
- of the contained selectors selects it.
- <selector>
- contains only one
- selector and forwards all requests to it without alteration, provided
- that any "if"
or
- "unless"
conditions are met. This
- is the selector to use if you want to define a reference. It is
- usable as an element of <project>
. It is also
- the one to use if you want selection of files to be dependent on
- Ant property settings.
- All selector containers can contain any other selector, including - other containers, as an element. Using containers, the selector tags - can be arbitrarily deep. Here is a complete list of allowable - selector elements within a container:
- -<and>
<contains>
<custom>
<date>
<depend>
<depth>
<filename>
<majority>
<none>
<not>
<or>
<present>
<selector>
<size>
The <and>
tag selects files that are
- selected by all of the elements it contains. It returns as
- soon as it finds a selector that does not select the file,
- so it is not guaranteed to check every selector.
-
Here is an example of how to use the And Selector:
- -- --<fileset dir="${dist}" includes="**/*.jar"> - <and> - <size value="4" units="Ki" when="more"/> - <date datetime="01/01/2001 12:00 AM" when="before"/> - </and> -</fileset> -
Selects all the JAR file larger than 4096 bytes which haven't been update - since the last millennium. -
- - -The <majority>
tag selects files provided
- that a majority of the contained elements also select it. Ties are
- dealt with as specified by the allowtie
attribute.
-
Attribute | -Description | -Required | -
allowtie | -Whether files should be selected if there - are an even number of selectors selecting them as are - not selecting them. Default is true. - | -No | -
Here is an example of how to use the Majority Selector:
- -- --<fileset dir="${docs}" includes="**/*.html"> - <majority> - <contains text="project" casesensitive="false"/> - <contains text="taskdef" casesensitive="false"/> - <contains text="IntrospectionHelper" casesensitive="true"/> - </majority> -</fileset> -
Selects all the HTML files which contain at least two of the three - phrases "project", "taskdef", and "IntrospectionHelper" (this last phrase must - match case exactly). -
- - -The <none>
tag selects files that are
- not selected by any of the elements it contains. It returns as
- soon as it finds a selector that selects the file,
- so it is not guaranteed to check every selector.
-
Here is an example of how to use the None Selector:
- -- --<fileset dir="${src}" includes="**/*.java"> - <none> - <present targetdir="${dest}"/> - <present targetdir="${dest}"> - <mapper type="glob" from="*.java" to="*.class"/> - </present> - </none> -</fileset> -
Selects only Java files which do not have equivalent java or - class files in the dest directory. -
- - -The <not>
tag reverses the meaning of the
- single selector it contains.
-
Here is an example of how to use the Not Selector:
- -- --<fileset dir="${src}" includes="**/*.java"> - <not> - <contains text="test"/> - </not> -</fileset> -
Selects all the files in the src directory that do not contain the - string "test". -
- - -The <or>
tag selects files that are
- selected by any one of the elements it contains. It returns as
- soon as it finds a selector that selects the file,
- so it is not guaranteed to check every selector.
-
Here is an example of how to use the Or Selector:
- -- --<fileset dir="${basedir}"> - <or> - <depth max="0"/> - <filename name="*.png"/> - <filename name="*.gif"/> - <filename name="*.jpg"/> - </or> -</fileset> -
Selects all the files in the top directory along with all the - image files below it. -
- - -The <selector>
tag is used to create selectors
- that can be reused through references. It is the only selector which can
- be used outside of
- any target, as an element of the <project>
tag. It
- can contain only one other selector, but of course that selector can
- be a container.
-
The <selector>
tag can also be used to select
- files conditionally based on whether an Ant property exists or not.
- This functionality is realized using the "if"
and
- "unless"
attributes in exactly the same way they
- are used on targets or on the <include>
and
- <exclude>
tags within a
- <patternset>
.
Attribute | -Description | -Required | -
if | -Allow files to be selected only if the named - property is set. - | -No | -
unless | -Allow files to be selected only if the named - property is not set. - | -No | -
Here is an example of how to use the Selector Reference:
- -- --<project default="all" basedir="./ant"> - - <selector id="completed"> - <none> - <depend targetdir="build/classes"> - <mapper type="glob" from="*.java" to="*.class"/> - </depend> - <depend targetdir="docs/manual/api"> - <mapper type="glob" from="*.java" to="*.html"/> - </depend> - </none> - </selector> - - <target> - <zip> - <fileset dir="src/main" includes="**/*.java"> - <selector refid="completed"/> - </fileset> - </zip> - </target> - -</project> -
Zips up all the Java files which have an up-to-date equivalent - class file and javadoc file associated with them. -
- -And an example of selecting files conditionally, based on whether - properties are set:
- -- --<fileset dir="${working.copy}"> - <or> - <selector if="include.tests"> - <filename name="**/*Test.class"> - </selector> - <selector if="include.source"> - <and> - <filename name="**/*.java"> - <not> - <selector unless="include.tests"> - <filename name="**/*Test.java"> - </selector> - </not> - </and> - </selector> - </or> -</fileset> -
A fileset that conditionally contains Java source files and Test - source and class files.
- -You can write your own selectors and use them within the selector
- containers by specifying them within the <custom>
tag.
First, you have to write your selector class in Java. The only
- requirement it must meet in order to be a selector is that it implements
- the org.apache.tools.ant.types.selectors.FileSelector
- interface, which contains a single method. See
- Programming Selectors in Ant for
- more information.
Once that is written, you include it in your build file by using
- the <custom>
tag.
-
Attribute | -Description | -Required | -
classname | -The name of your class that implements
- org.apache.tools.ant.types.selectors.FileSelector .
- |
- Yes | -
classpath | -The classpath to use in order to load the - custom selector class. If neither this classpath nor the - classpathref are specified, the class will be - loaded from the classpath that Ant uses. - | -No | -
classpathref | -A reference to a classpath previously - defined. If neither this reference nor the - classpath above are specified, the class will be - loaded from the classpath that Ant uses. - | -No | -
Here is how you use <custom>
to
- use your class as a selector:
-
- --<fileset dir="${mydir}" includes="**/*"> - <custom classname="com.mydomain.MySelector"> - <param name="myattribute" value="myvalue"/> - </custom> -</fileset> -
A number of core selectors can also be used as custom selectors
- by specifying their attributes using <param>
elements. These
- are
org.apache.tools.ant.types.selectors.ContainsSelector
- org.apache.tools.ant.types.selectors.DateSelector
- org.apache.tools.ant.types.selectors.DepthSelector
- org.apache.tools.ant.types.selectors.FilenameSelector
- org.apache.tools.ant.types.selectors.SizeSelector
- Here is the example from the Depth Selector section rewritten
- to use the selector through <custom>
.
- --<fileset dir="${doc.path}" includes="**/*"> - <custom classname="org.apache.tools.ant.types.selectors.DepthSelector"> - <param name="max" value="1"/> - </custom> -</fileset> -
Selects all files in the base directory and one directory below - that.
- -For more details concerning writing your own selectors, consult - Programming Selectors in Ant.
- - - - - - diff --git a/framework/src/ant/apache-ant-1.9.6/manual/Types/tarfileset.html b/framework/src/ant/apache-ant-1.9.6/manual/Types/tarfileset.html deleted file mode 100644 index 499ed798..00000000 --- a/framework/src/ant/apache-ant-1.9.6/manual/Types/tarfileset.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - -TarFileSet has been added as a stand-alone type in Apache Ant -1.7.
- -A <tarfileset>
is a special form of a <fileset>
which can behave in 2
-different ways :
-
<tarfileset>
supports all attributes of <fileset>
- in addition to those listed below. Note that tar archives in general
- don't contain entries with leading slashes so you shouldn't use
- include/exclude patterns that start with slashes either.
-
A tarfileset can be defined with the id attribute and referred to with the refid attribute. This is also true
-for tarfileset which has been added in Ant 1.7.
-
Attribute | -Description | -Required | -
prefix | -all files in the fileset are prefixed with that -path in the archive. | -No | -
fullpath | -the file described by the fileset is placed at -that exact location in the archive. | -No | -
src | -may be used in place of the dir attribute - to specify a tar file whose contents will be extracted and included -in the archive. | -No | -
filemode | -A 3 digit octal string, specify the user, group -and other modes in the standard Unix fashion. Only applies to -plain files. Default is 644. | -No | -
dirmode | -A 3 digit octal string, specify the user, group -and other modes in the standard Unix fashion. Only applies to -directories. Default is 755. | -No | -
username | -The username for the tar entry. This is not the same as the UID. - | -No | -
group | -The groupname for the tar entry. This is not the same as the GID. - | -No | -
uid | -The user identifier (UID) for the tar entry. This is an integer value - and is not the same as the username. - | -No | -
gid | -The group identifier (GID) for the tar entry. - | -No | -
erroronmissingarchive | -- Specify what happens if the archive does not exist. - If true, a build error will happen; if false, the fileset - will be ignored/empty. - Defaults to true. - Since Ant 1.8.0 - | -No | -
encoding | -The character encoding to use for filenames - inside the zip file. For a list of possible values see the Supported Encodings. - Defaults to the platform's default character encoding. - Since Ant 1.9.5 - | No | -
The fullpath attribute can only be set for filesets that -represent a single file. The prefix and fullpath -attributes cannot both be set on the same fileset.
-When using the src attribute, include and exclude patterns -may be used to specify a subset of the archive for inclusion in the -archive as with the dir attribute.
- -Please note that currently only the tar task uses the permission and -ownership attributes.
- -The specified resource will be used as src.
- --- -- <copy todir="some-dir"> - <tarfileset includes="lib/**"> - <bzip2resource> - <url url="http://example.org/dist/some-archive.tar.bz2"/> - </bzip2resource> - </tarfileset> - </copy> -
downloads the archive some-archive.tar.bz2, uncompresses and -extracts it on the fly, copies the contents of the lib directory into -some-dir and discards the rest of the archive. File timestamps will -be compared between the archive's entries and files inside the target -directory, no files get overwritten unless they are out-of-date.
- - - - diff --git a/framework/src/ant/apache-ant-1.9.6/manual/Types/xmlcatalog.html b/framework/src/ant/apache-ant-1.9.6/manual/Types/xmlcatalog.html deleted file mode 100644 index a0ddafc0..00000000 --- a/framework/src/ant/apache-ant-1.9.6/manual/Types/xmlcatalog.html +++ /dev/null @@ -1,306 +0,0 @@ - - - - - - -An XMLCatalog is a catalog of public resources such as DTDs or -entities that are referenced in an XML document. Catalogs are -typically used to make web references to resources point to a locally -cached copy of the resource.
- -This allows the XML Parser, XSLT Processor or other consumer of XML -documents -to efficiently allow a local substitution for a resource available on the -web. -
-Note: This task uses, but does not depend on external -libraries not included in the Apache Ant distribution. See Library Dependencies for more -information.
-This data type provides a catalog of resource locations based
-on the
-OASIS "Open Catalog" standard. The catalog entries are used
-both for Entity resolution and URI resolution, in accordance with
-the org.xml.sax.EntityResolver
and
-javax.xml.transform.URIResolver
interfaces as defined
-in the Java API for XML
-Processing (JAXP) Specification.
For example, in a web.xml
file, the DTD is referenced as:
-
-<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" - "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"> --The XML processor, without XMLCatalog support, would need to retrieve the -DTD from -the URL specified whenever validation of the document was required. - -
This can be very time consuming during the build process, -especially where network throughput is limited. Alternatively, you -can do the following: -
web-app_2_2.dtd
onto your local disk somewhere (either in the
-filesystem or even embedded inside a jar or zip file on the classpath).<xmlcatalog>
with a <dtd>
-element whose location
attribute points to the file.XMLCatalogs can appear inside tasks
-that support this feature or at the same level as target
-- i.e., as children of project
for reuse across different
-tasks,
-e.g. XML Validation and XSLT Transformation. The XML Validate task
-uses XMLCatalogs for entity resolution. The XSLT Transformation
-task uses XMLCatalogs for both entity and URI resolution.
XMLCatalogs are specified as either a reference to another
-XMLCatalog, defined previously in a build file, or as a list of
-dtd
or entity
locations. In addition,
-external catalog files may be specified in a nested catalogpath
,
-but they will be ignored unless the resolver library from
-xml-commons is available in the system classpath. Due to backwards
-incompatible changes in the resolver code after the release of
-resolver 1.0, Ant will not support resolver.jar in version 1.0 - we
-expect a resolver release 1.1 to happen before Ant 1.6 gets
-released. A separate classpath for entity resolution may be
-specified inline via nested classpath
elements; otherwise
-the system classpath is used for this as well.
XMLCatalogs can also be nested inside other XMLCatalogs. For -example, a "superset" XMLCatalog could be made by including several -nested XMLCatalogs that referred to other, previously defined -XMLCatalogs.
-Resource locations can be specified either in-line or in
-external catalog file(s), or both. In order to use an external
-catalog file, the xml-commons resolver library ("resolver.jar")
-must be in your path. External catalog files may be either
-plain text format or
-XML format. If the xml-commons resolver library is not found in the
-classpath, external catalog files, specified in catalogpath
,
-will be ignored and a warning
-will be logged. In this case, however, processing of inline entries will
-proceed normally.
Currently, only <dtd>
and
-<entity>
elements may be specified inline; these
-roughly correspond to OASIS catalog entry types PUBLIC
and
-URI
respectively. By contrast, external catalog files
-may use any of the entry types defined in the
-
-+OASIS specification.
publicId
attribute of each entry
-with the PublicID or URI of the entity to be resolved. Assuming a
-matching entry is found, XMLCatalog then executes the following steps:
-
-The location
is first looked up in the filesystem. If
-the location
is a relative path, the ant project basedir
-attribute is used as the base directory. If the location
-specifies an absolute path, it is used as is. Once we have an
-absolute path in hand, we check to see if a valid and readable file
-exists at that path. If so, we are done. If not, we proceed to the
-next step.
The location
is next looked up in the classpath.
-Recall that jar files are merely fancy zip files. For classpath
-lookup, the location
is used as is (no base is
-prepended). We use a Classloader to attempt to load the resource from
-the classpath. For example, if hello.jar is in the classpath and it
-contains foo/bar/blat.dtd
it will resolve an entity whose
-location
is foo/bar/blat.dtd
. Of course, it
-will not resolve an entity whose location
is
-blat.dtd
.
-
-
-
What happens next depends on whether the resolver library from -xml-commons is available on the classpath. If so, we defer all -further attempts at resolving to it. The resolver library supports -extremely sophisticated functionality like URL rewriting and so on, -which can be accessed by making the appropriate entries in external -catalog files (XMLCatalog does not yet provide inline support for all -of the entries defined in the OASIS -standard).
- -Finally, we attempt to make a URL out of the location
.
-At first this may seem like this would defeat the purpose of
-XMLCatalogs -- why go back out to the internet? But in fact, this can
-be used to (in a sense) implement HTTP redirects, substituting one URL
-for another. The mapped-to URL might also be served by a local web
-server. If the URL resolves to a valid and readable resource, we are
-done. Otherwise, we give up. In this case, the XML processor will
-perform its normal resolution algorithm. Depending on the processor
-configuration, further resolution failures may or may not result in
-fatal (i.e. build-ending) errors.
Attribute | -Description | -Required | -
id | -a unique name for an XMLCatalog, used for referencing -the - XMLCatalog's contents from another XMLCatalog | -No | -
refid | -the id of another XMLCatalog whose
-contents
- you would like to be used for this XMLCatalog |
- No | -
The dtd
and entity
elements used to specify
-XMLCatalogs are identical in their structure
Attribute | -Description | -Required | -
publicId | -The public identifier used when defining a dtd or
-entity,
- e.g. "-//Sun Microsystems, Inc.//DTD Web Application
-2.2//EN"
- |
- Yes | -
location | -The location of the local replacement to be used for -the public identifier specified. This may be specified as a file name, -resource name found on the classpath, or a URL. Relative paths will -be resolved according to the base, which by default is the Ant project -basedir. - | -Yes | -
The classpath to use for entity
-resolution. The nested <classpath>
is a
-path-like structure.
-The nested catalogpath
element is a path-like structure listing catalog files to
-search. All files in this path are assumed to be OASIS catalog files, in
-either
-
-plain text format or
-XML format. Entries specifying nonexistent files will be ignored. If the
-resolver library from xml-commons is not available in the classpath, all
-catalogpaths
will be ignored and a warning will be logged.
-
Set up an XMLCatalog with a single dtd referenced locally in a user's -home -directory:
--- <xmlcatalog> - <dtd - publicId="-//OASIS//DTD DocBook XML V4.1.2//EN" - location="/home/dion/downloads/docbook/docbookx.dtd"/> - </xmlcatalog> -
Set up an XMLCatalog with a multiple dtds to be found either in the -filesystem (relative to the Ant project basedir) or in the classpath: -
-- -- <xmlcatalog id="commonDTDs"> - <dtd - publicId="-//OASIS//DTD DocBook XML V4.1.2//EN" - location="docbook/docbookx.dtd"/> - <dtd - publicId="-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" - location="web-app_2_2.dtd"/> - </xmlcatalog> -
Set up an XMLCatalog with a combination of DTDs and entities as -well as a nested XMLCatalog and external catalog files in both -formats:
- --- <xmlcatalog id="allcatalogs"> - <dtd - publicId="-//ArielPartners//DTD XML Article V1.0//EN" - location="com/arielpartners/knowledgebase/dtd/article.dtd"/> - <entity - publicId="LargeLogo" - location="com/arielpartners/images/ariel-logo-large.gif"/> - <xmlcatalog refid="commonDTDs"/> - <catalogpath> - <pathelement location="/etc/sgml/catalog"/> - <fileset - dir="/anetwork/drive" - includes="**/catalog"/> - <fileset - dir="/my/catalogs" - includes="**/catalog.xml"/> - </catalogpath> - </xmlcatalog> - </xmlcatalog> -
To reference the above XMLCatalog in an xslt
task:
-
- - - - - diff --git a/framework/src/ant/apache-ant-1.9.6/manual/Types/zipfileset.html b/framework/src/ant/apache-ant-1.9.6/manual/Types/zipfileset.html deleted file mode 100644 index 955e2718..00000000 --- a/framework/src/ant/apache-ant-1.9.6/manual/Types/zipfileset.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - -- <xslt basedir="${source.doc}" - destdir="${dest.xdocs}" - extension=".xml" - style="${source.xsl.converter.docbook}" - includes="**/*.xml" - force="true"> - <xmlcatalog refid="allcatalogs"/> - </xslt> -
A <zipfileset>
is a special form of a <fileset>
which can behave in 2
-different ways :
-
<zipfileset>
supports all attributes of <fileset>
- in addition to those listed below. Note that zip archives in general
- don't contain entries with leading slashes so you shouldn't use
- include/exclude patterns that start with slashes either.
Since Ant 1.6, a zipfileset can be defined with the id attribute and referred to with
-the refid attribute.
-
Attribute | -Description | -Required | -
prefix | -all files in the fileset are prefixed with that -path in the archive. | -No | -
fullpath | -the file described by the fileset is placed at -that exact location in the archive. | -No | -
src | -may be used in place of the dir attribute - to specify a zip file whose contents will be extracted and included -in the archive. | -No | -
filemode | -A 3 digit octal string, specify the user, group -and other modes in the standard Unix fashion. Only applies to -plain files. Default is 644. since Ant 1.5.2. | -No | -
dirmode | -A 3 digit octal string, specify the user, group -and other modes in the standard Unix fashion. Only applies to -directories. Default is 755. since Ant 1.5.2. | -No | -
encoding | -The character encoding to use for filenames - inside the zip file. For a list of possible values see the Supported Encodings. - Defaults to the platform's default character encoding. - | No | -
erroronmissingarchive | -- Specify what happens if the archive does not exist. - If true, a build error will happen; if false, the fileset - will be ignored/empty. - Defaults to true. - Since Ant 1.8.0 - | -No | -
The fullpath attribute can only be set for filesets that -represent a single file. The prefix and fullpath -attributes cannot both be set on the same fileset.
-When using the src attribute, include and exclude patterns -may be used to specify a subset of the archive for inclusion in the -archive as with the dir attribute.
- -Please note that currently only the tar and zip tasks use the permission.
- -The specified resource will be used as src.
- --- - - - -- cgit 1.2.3-korg<zip destfile="${dist}/manual.zip">-
<zipfileset dir="htdocs/manual" prefix="docs/user-guide"/>
<zipfileset dir="." includes="ChangeLog27.txt" fullpath="docs/ChangeLog.txt"/>
<zipfileset src="examples.zip" includes="**/*.html" prefix="docs/examples"/>
</zip>zips all files in the
-htdocs/manual
directory into -thedocs/user-guide
directory in the archive, adds the -fileChangeLog27.txt
in the current directory asdocs/ChangeLog.txt
, -and includes all the html files inexamples.zip
underdocs/examples
. -The archive might end up containing the files:docs/user-guide/html/index.html
-docs/ChangeLog.txt
-docs/examples/index.html
-