From 95e912bb7383423441543cd0be02c7aae31057bc Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Thu, 14 Aug 2003 12:48:10 +0000 Subject: [PATCH] adding doc for presetdef and macrodef git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275083 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/CoreTasks/macrodef.html | 176 +++++++++++++++++++++++++++ docs/manual/CoreTasks/presetdef.html | 77 ++++++++++++ docs/manual/coretasklist.html | 2 + 3 files changed, 255 insertions(+) create mode 100644 docs/manual/CoreTasks/macrodef.html create mode 100644 docs/manual/CoreTasks/presetdef.html diff --git a/docs/manual/CoreTasks/macrodef.html b/docs/manual/CoreTasks/macrodef.html new file mode 100644 index 000000000..8c3d1ff03 --- /dev/null +++ b/docs/manual/CoreTasks/macrodef.html @@ -0,0 +1,176 @@ + + + + + MacroDef Task + + + + +

MacroDef

+

Description

+

+ This defines a new task using a <sequential> or <parallel> + nested task as a template. Nested elements <param> and + <element> are used to specify attributes and elements of + the new task. These get substituted into the <sequential> + or <parallel> task when the new task is run. +

+

+ Introduced in ant1.6 Experimental. +

+

Parameters

+ + + + + + + + + + + + + + + + +
AttributeDescriptionRequired
namethe name of the new definitionYes
uri + The uri that this definition should live in. + No
+

Parameters specified as nested elements

+

param

+

+ This is used to specify attributes of the new task. The values + of the attributes get substituted into the templated task. + The attributes will be required attributes unless a default + value has been set. +

+

+ This attribute is placed in the body of the templated + task using the ant property notation - ${attribute name}. + Note that is not an actual ant property. +

+

Parameters

+ + + + + + + + + + + + + + + + +
AttributeDescriptionRequired
namethe name of the new attributeYes
default + the default value of the attribute. + No
+

element

+

+ This is used to specify nested elements of the new task. + The contents of the nested elements of the task instance + are placed in the templated task at the tag name. +

+

Parameters

+ + + + + + + + + + + + + + + + +
AttributeDescriptionRequired
namethe name of the new attributeYes
optional + if true this nested element is optional. Default is + false - i.e the nested element is required in + the new task. + No
+ +

Examples

+

+ The following example defined a task called testing and + runs it. +

+
+
+<macrodef name="testing">
+   <param name="v" default="NOT SET"/>
+   <element name="some-tasks" optional="yes"/>
+   <sequential>
+      <echo>v is ${v}</echo>
+      <some-tasks/>
+   </sequential>
+</macrodef>
+
+<testing v="This is v">
+   <some-tasks>
+      <echo>this is a test</echo>
+   </some-tasks>
+</testing>
+      
+
+

+ The following fragment defines a task called <call-cc> which + take the attributes "target", "link" and "target.dir" and the + nested element "cc-elements". The body of the task + uses the <cc> task from the + ant-contrib project. +

+
+
+<macrodef name="call-cc">
+   <param name="target"/>
+   <param name="link"/>
+   <param name="target.dir"/>
+   <element name="cc-elements"/>
+   <sequential>
+      <mkdir dir="${obj.dir}/${target}"/>
+      <mkdir dir="${target.dir}"/>
+         <cc link="${link}" objdir="${obj.dir}/${target}"
+             outfile="${target.dir}/${target}">
+            <compiler refid="compiler.options"/>
+            <cc-elements/>
+         </cc>
+      </sequential>
+</macrodef>
+      
+
+

+ This then can be used as follows: +

+
+
+<call-cc target="unittests" link="executable"
+         target.dir="${build.bin.dir}">
+   <cc-elements>
+      <includepath location="${gen.dir}"/>
+      <includepath location="test"/>
+      <fileset dir="test/unittest" includes = "**/*.cpp"/>
+      <fileset dir="${gen.dir}" includes = "*.cpp"/>
+      <linker refid="linker-libs"/>
+   </cc-elements>
+</call-cc>
+      
+
+
+

Copyright © 2003 Apache Software +Foundation. All rights Reserved.

+ + + + diff --git a/docs/manual/CoreTasks/presetdef.html b/docs/manual/CoreTasks/presetdef.html new file mode 100644 index 000000000..5980586ca --- /dev/null +++ b/docs/manual/CoreTasks/presetdef.html @@ -0,0 +1,77 @@ + + + + + PreSetDef Task + + + + +

PreSetDef

+

Description

+

+ The preset definition generates a new definition + based on a current definition with some attributes + or elements preset. +

+

+ Introduced in ant1.6 Experimental. +

+

Parameters

+ + + + + + + + + + + + + + + + +
AttributeDescriptionRequired
namethe name of the new definitionYes
uri + The uri that this definition should live in. + No
+

Parameters specified as nested elements

+

another type with attributes or elements set

+

The <presetdef> task takes one nested element as a parameter. + This nested element can be any other type or task. The attributes + and elements that need to be preset are placed here. +

+ +

Examples

+

+ The following fragment defines a javac task with the debug and deprecation + attributes set. It also has a src element to source files from a generated + directory. +

+
+
+<presetdef name="my.javac">
+   <javac debug="${debug}" deprecation="${deprecation}">
+      <src path="${gen.dir}"/>
+   </javac>
+</presetdef>
+      
+
+

+ This can be used as a normal javac task - example: +

+
+
+<my.javac src="${src.dir}" destdir="${classes.dir}"/>
+      
+
+ +
+

Copyright © 2003 Apache Software +Foundation. All rights Reserved.

+ + + + diff --git a/docs/manual/coretasklist.html b/docs/manual/coretasklist.html index 634d2652d..2b8359c47 100644 --- a/docs/manual/coretasklist.html +++ b/docs/manual/coretasklist.html @@ -60,12 +60,14 @@ LoadFile
LoadProperties
Mail
+MacroDef
Manifest
Mkdir
Move
Parallel
Patch
PathConvert
+PreSetDef
Property
Record
Rename