From 753a6c60f47f3ac4f270005b65e9d6481de8eb68 Mon Sep 17 00:00:00 2001 From: Ashlee Young Date: Fri, 23 Oct 2015 10:00:02 -0700 Subject: Adding maven and ant source trees Change-Id: I0a39b9add833a31b9c3f98d193983ae2f3a5a445 Signed-off-by: Ashlee Young --- .../apache-ant-1.9.6/manual/Tasks/presetdef.html | 184 +++++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 framework/src/ant/apache-ant-1.9.6/manual/Tasks/presetdef.html (limited to 'framework/src/ant/apache-ant-1.9.6/manual/Tasks/presetdef.html') diff --git a/framework/src/ant/apache-ant-1.9.6/manual/Tasks/presetdef.html b/framework/src/ant/apache-ant-1.9.6/manual/Tasks/presetdef.html new file mode 100644 index 00000000..c7f381c0 --- /dev/null +++ b/framework/src/ant/apache-ant-1.9.6/manual/Tasks/presetdef.html @@ -0,0 +1,184 @@ + + + + + + +PreSetDef Task + + + + + +

PreSetDef

+

Description

+

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

+

+ since Apache Ant 1.6 +

+

+ The resolution of properties in any of the attributes or + nested text takes place with the definition is used and not + when the preset definition is defined. +

+

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, deprecation + srcdir and destdir + attributes set. It also has a src element to source files from a generated + directory. +
+
+<presetdef name="my.javac">
+   <javac debug="${debug}" deprecation="${deprecation}"
+          srcdir="${src.dir}" destdir="${classes.dir}">
+      <src path="${gen.dir}"/>
+   </javac>
+</presetdef>
+
+
+ This can be used as a normal javac task - example: +
+
+<my.javac/>
+
+
+ The attributes specified in the preset task may be overridden - i.e. + they may be seen as optional attributes - example: +
+
+<my.javac srcdir="${test.src}" deprecation="no"/>
+
+
+ One may put a presetdef definition in an antlib. + For example suppose the jar file antgoodies.jar has + the antlib.xml as follows: +
+
+<antlib>
+   <taskdef resource="com/acme/antgoodies/tasks.properties"/>
+   <!-- Implement the common use of the javac command -->
+   <presetdef name="javac">
+      <javac deprecation="${deprecation}" debug="${debug}"
+             srcdir="src" destdir="classes"/>
+   </presetdef>
+</antlib>
+
+
+ One may then use this in a build file as follows: +
+
+<project default="example" xmlns:antgoodies="antlib:com.acme.antgoodies">
+   <target name="example">
+      <!-- Compile source -->
+      <antgoodies:javac srcdir="src/main"/>
+      <!-- Compile test code -->
+      <antgoodies:javac srcdir="src/test"/>
+   </target>
+</project>
+
+
+

+ The following is an example of evaluation of properties when the + definition is used: +

+
+
+<target name="defineandcall">
+   <presetdef name="showmessage">
+      <echo>message is '${message}'</echo>
+   </presetdef>
+   <showmessage/>
+   <property name="message" value="Message 1"/>
+   <showmessage/>
+   <antcall target="called">
+      <param name="message" value="Message 2"/>
+   </antcall>
+</target>
+<target name="called">
+   <showmessage/>
+</target>
+
+
+

+ The command ant defineandcall results in the output: +

+
+
+defineandcall:
+[showmessage] message is '${message}'
+[showmessage] message is 'Message 1'
+
+called:
+[showmessage] message is 'Message 2'
+
+
+

+It is possible to use a trick to evaluate properties when the definition is +made rather than used. This can be useful if you do not expect some +properties to be available in child builds run with +<ant ... inheritall="false">: +

+
+<macrodef name="showmessage-presetdef">
+  <attribute name="messageval"/>
+  <presetdef name="showmessage">
+    <echo>message is '@{messageval}'</echo>
+  </presetdef>
+</macrodef>
+<showmessage-presetdef messageval="${message}"/>
+
+
+ + + + -- cgit 1.2.3-korg