From a1a8c3c21c6ae9450a3f3b463b268f221b6bdf7f Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Tue, 8 Mar 2005 18:17:40 +0000 Subject: [PATCH] place examples in
blocks git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277837 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/CoreTasks/ant.html | 74 +++++++++++++------------- docs/manual/CoreTasks/antcall.html | 34 ++++++------ docs/manual/CoreTasks/apt.html | 61 +++++++++++---------- docs/manual/CoreTasks/available.html | 26 +++++---- docs/manual/CoreTasks/basename.html | 15 ++++-- docs/manual/CoreTasks/buildnumber.html | 8 ++- docs/manual/CoreTasks/checksum.html | 22 ++++---- docs/manual/CoreTasks/chmod.html | 2 +- docs/manual/CoreTasks/pack.html | 12 ++--- docs/manual/CoreTasks/unpack.html | 24 ++++----- 10 files changed, 148 insertions(+), 130 deletions(-) diff --git a/docs/manual/CoreTasks/ant.html b/docs/manual/CoreTasks/ant.html index 2cb867eac..eaf7de645 100644 --- a/docs/manual/CoreTasks/ant.html +++ b/docs/manual/CoreTasks/ant.html @@ -198,72 +198,72 @@ details:

Examples

-
-  <ant antfile="subproject/subbuild.xml" dir="subproject" target="compile"/>
+
+<ant antfile="subproject/subbuild.xml"
+     dir="subproject" target="compile"/>
 
-  <ant dir="subproject"/>
+<ant dir="subproject"/>
 
-  <ant antfile="subproject/property_based_subbuild.xml">
-    <property name="param1" value="version 1.x"/>
-    <property file="config/subproject/default.properties"/>
-  </ant>
-
-  <ant inheritAll="false" antfile="subproject/subbuild.xml">
-    <property name="output.type" value="html"/>
-  </ant>
-
+<ant antfile="subproject/property_based_subbuild.xml"> + <property name="param1" value="version 1.x"/> + <property file="config/subproject/default.properties"/> +</ant> +<ant inheritAll="false" antfile="subproject/subbuild.xml"> + <property name="output.type" value="html"/> +</ant> +

The build file of the calling project defines some <path> elements like this:

-
-  <path id="path1">
+
+<path id="path1">
     ...
-  </path>
-  <path id="path2">
+</path>
+<path id="path2">
     ...
-  </path>
-
+</path> +

and the called build file (subbuild.xml) also defines a <path> with the id path1, but path2 is not defined:

-
-  <ant antfile="subbuild.xml" inheritrefs="true"/>
-
+
+<ant antfile="subbuild.xml" inheritrefs="true"/>
+

will not override subbuild's definition of path1, but make the parent's definition of path2 available in the subbuild.

-
-  <ant antfile="subbuild.xml"/>
-
+
+<ant antfile="subbuild.xml"/>
+

as well as

-
-  <ant antfile="subbuild.xml" inheritrefs="false"/>
-
+
+<ant antfile="subbuild.xml" inheritrefs="false"/>
+

will neither override path1 nor copy path2.

-
-  <ant antfile="subbuild.xml" inheritrefs="false">
-    <reference refid="path1"/>
-  </ant>
-
+
+<ant antfile="subbuild.xml" inheritrefs="false">
+  <reference refid="path1"/>
+</ant>
+

will override subbuild's definition of path1.

-
-  <ant antfile="subbuild.xml" inheritrefs="false">
-    <reference refid="path1" torefid="path2"/>
-  </ant>
-
+
+<ant antfile="subbuild.xml" inheritrefs="false">
+  <reference refid="path1" torefid="path2"/>
+</ant>
+

will copy the parent's definition of path1 into the new project using the id path2.

diff --git a/docs/manual/CoreTasks/antcall.html b/docs/manual/CoreTasks/antcall.html index 667ff504b..96fb20a72 100644 --- a/docs/manual/CoreTasks/antcall.html +++ b/docs/manual/CoreTasks/antcall.html @@ -147,24 +147,24 @@ targets so specified, in the order specified.

since Ant 1.6.3.

Examples

-
-  <target name="default">
-    <antcall target="doSomethingElse">
-      <param name="param1" value="value"/>
-    </antcall>
-  </target>
-
-  <target name="doSomethingElse">
-    <echo message="param1=${param1}"/>
-  </target>
-
+
+<target name="default">
+  <antcall target="doSomethingElse">
+    <param name="param1" value="value"/>
+  </antcall>
+</target>
+
+<target name="doSomethingElse">
+  <echo message="param1=${param1}"/>
+</target>
+

Will run the target 'doSomethingElse' and echo 'param1=value'.

-
-  <antcall ... >
-    <reference refid="path1" torefid="path2"/>
-  </antcall>
-
+
+<antcall ... >
+  <reference refid="path1" torefid="path2"/>
+</antcall>
+

will copy the parent's definition of path1 into the new project using the id path2.

@@ -173,4 +173,4 @@ new project using the id path2.

Reserved.

- \ No newline at end of file + diff --git a/docs/manual/CoreTasks/apt.html b/docs/manual/CoreTasks/apt.html index fa4d9f6a7..6f83553ff 100644 --- a/docs/manual/CoreTasks/apt.html +++ b/docs/manual/CoreTasks/apt.html @@ -84,15 +84,17 @@

Examples

-
  <apt srcdir="${src}"
-         destdir="${build}"
-         classpath="xyz.jar"
-         debug="on"
-         compile="true"
-         factory="com.mycom.MyAnnotationProcessorFactory"
-         factorypathref="my.factorypath.id"
-         preprocessdir="${preprocess.dir}">
-    </apt>
+
+<apt srcdir="${src}"
+     destdir="${build}"
+     classpath="xyz.jar"
+     debug="on"
+     compile="true"
+     factory="com.mycom.MyAnnotationProcessorFactory"
+     factorypathref="my.factorypath.id"
+     preprocessdir="${preprocess.dir}">
+</apt>
+

compiles all .java files under the ${src} directory, and stores the .class files in the ${build} directory. @@ -121,26 +123,27 @@ The inherited "compiler" attribute is ignored, as it is forced to use the Apt co <javac> task to compile first your original source code, and then the generated source code:

-
  <apt srcdir="${src}"
-         destdir="${build}"
-         classpath="xyz.jar"
-         debug="true"
-         compile="false"
-         factory="com.mycom.MyAnnotationProcessorFactory"
-         factorypathref="my.factorypath.id"
-         preprocessdir="${preprocess.dir}">
-    </apt>
-
-    <javac srcdir="${src}"
-         destdir="${build}"
-         classpath="xyz.jar"
-         debug="on"/>
-
-    <javac srcdir="${preprocess.dir}"
-         destdir="${build}"
-         classpath="xyz.jar"
-         debug="true"/>
-
+
+<apt srcdir="${src}"
+     destdir="${build}"
+     classpath="xyz.jar"
+     debug="true"
+     compile="false"
+     factory="com.mycom.MyAnnotationProcessorFactory"
+     factorypathref="my.factorypath.id"
+     preprocessdir="${preprocess.dir}">
+</apt>
+
+<javac srcdir="${src}"
+       destdir="${build}"
+       classpath="xyz.jar"
+       debug="on"/>
+
+<javac srcdir="${preprocess.dir}"
+       destdir="${build}"
+       classpath="xyz.jar"
+       debug="true"/>
+
This may involve more build file coding, but the speedup gained from switching to jikes may justify the effort. diff --git a/docs/manual/CoreTasks/available.html b/docs/manual/CoreTasks/available.html index 849480ac8..6649ae8c4 100644 --- a/docs/manual/CoreTasks/available.html +++ b/docs/manual/CoreTasks/available.html @@ -87,37 +87,41 @@ href="../using.html#path">path-like structure and can also be set via a nest href="../using.html#path">path-like structure and can also be set via a nested <filepath> element.

Examples

-
  <available classname="org.whatever.Myclass" property="Myclass.present"/>
+
+<available classname="org.whatever.Myclass" property="Myclass.present"/>
+

sets the Myclass.present property to the value "true" if the class org.whatever.Myclass is found in Ant's classpath.

-
+
 <property name="jaxp.jar" value="./lib/jaxp11/jaxp.jar"/>
 <available file="${jaxp.jar}" property="jaxp.jar.present"/>
-
+

sets the jaxp.jar.present property to the value "true" if the file ./lib/jaxp11/jaxp.jar is found.

-
-<available file="/usr/local/lib" type="dir" property="local.lib.present"/>
-
+
+<available file="/usr/local/lib" type="dir"
+           property="local.lib.present"/>
+

sets the local.lib.present property to the value "true" if the directory /usr/local/lib is found.

-
+
 ...in project ...
 <property name="jaxp.jar" value="./lib/jaxp11/jaxp.jar"/>
 <path id="jaxp" location="${jaxp.jar}"/>
 ...in target ...
-<available classname="javax.xml.transform.Transformer" classpathref="jaxp" property="jaxp11.present"/>
-
+<available classname="javax.xml.transform.Transformer" + classpathref="jaxp" property="jaxp11.present"/> +

sets the jaxp11.present property to the value "true" if the class javax.xml.transform.Transformer is found in the classpath referenced by jaxp (in this case, ./lib/jaxp11/jaxp.jar).

-
+
 <available property="have.extras" resource="extratasks.properties">
   <classpath>
     <pathelement location="/usr/local/ant/extra.jar/>
   </classpath>
 </available>
-
+

sets the have.extras property to the value "true" if the resource-file extratasks.properties is found.

diff --git a/docs/manual/CoreTasks/basename.html b/docs/manual/CoreTasks/basename.html index 936068a01..e238c1dcc 100644 --- a/docs/manual/CoreTasks/basename.html +++ b/docs/manual/CoreTasks/basename.html @@ -48,16 +48,23 @@ the basename will be the simple file name, without any directory elements.

Examples

-
  <basename property="jar.filename" file="${lib.jarfile}"/>
+
+<basename property="jar.filename" file="${lib.jarfile}"/>
+
will set jar.filename to myjar.jar, if lib.jarfile is defined as either a full-path filename (eg., /usr/local/lib/myjar.jar), a relative-path filename (eg., lib/myjar.jar), or a simple filename (eg., myjar.jar). -
  <basename property="cmdname" file="D:/usr/local/foo.exe" suffix=".exe"/>
+
+<basename property="cmdname" file="D:/usr/local/foo.exe"
+         suffix=".exe"/>
+
will set cmdname to foo. -
  <property environment="env"/>
-  <basename property="temp.dirname" file="${env.TEMP}"/>
+
+<property environment="env"/>
+<basename property="temp.dirname" file="${env.TEMP}"/>
+
will set temp.dirname to the last directory element of the path defined for the TEMP environment variable.

diff --git a/docs/manual/CoreTasks/buildnumber.html b/docs/manual/CoreTasks/buildnumber.html index 7620dfdcb..3ad6b807d 100644 --- a/docs/manual/CoreTasks/buildnumber.html +++ b/docs/manual/CoreTasks/buildnumber.html @@ -37,12 +37,16 @@ the number format.)

Examples

-
  <buildnumber/>
+
+<buildnumber/>
+

Read, increment, and write a build number to the default file, build.number.

-
  <buildnumber file="mybuild.number"/>
+
+<buildnumber file="mybuild.number"/>
+

Read, increment, and write a build number to the file mybuild.number.

diff --git a/docs/manual/CoreTasks/checksum.html b/docs/manual/CoreTasks/checksum.html index 7001c1b32..0e4f9c5a5 100644 --- a/docs/manual/CoreTasks/checksum.html +++ b/docs/manual/CoreTasks/checksum.html @@ -150,48 +150,48 @@ built-in into your JDK.

Examples

Example 1

-
<checksum file="foo.bar"/>
+
<checksum file="foo.bar"/>
Generates a MD5 checksum for foo.bar and stores the checksum in the destination file foo.bar.MD5. foo.bar.MD5 is overwritten only if foo.bar is newer than itself.

Example 2

-
<checksum file="foo.bar" forceOverwrite="yes"/>
+
<checksum file="foo.bar" forceOverwrite="yes"/>
Generates a MD5 checksum for foo.bar and stores the checksum in foo.bar.MD5. If foo.bar.MD5 already exists, it is overwritten.

Example 3

-
<checksum file="foo.bar" property="foobarMD5"/>
+
<checksum file="foo.bar" property="foobarMD5"/>
Generates a MD5 checksum for foo.bar and stores it in the Project Property foobarMD5.

Example 4

-
<checksum file="foo.bar" verifyProperty="isMD5ok"/>
+
<checksum file="foo.bar" verifyProperty="isMD5ok"/>
Generates a MD5 checksum for foo.bar, compares it against foo.bar.MD5 and sets isMD5ok to either true or false, depending upon the result.

Example 5

-
<checksum file="foo.bar" algorithm="SHA" fileext="asc"/>
+
<checksum file="foo.bar" algorithm="SHA" fileext="asc"/>
Generates a SHA checksum for foo.bar and stores the checksum in the destination file foo.bar.asc. foo.bar.asc is overwritten only if foo.bar is newer than itself.

Example 6

-
+
 <checksum file="foo.bar" property="${md5}" verifyProperty="isEqual"/>
-
+
Generates a MD5 checksum for foo.bar, compares it against the value of the property md5, and sets isEqual to either true or false, depending upon the result.

Example 7

-
+
 <checksum>
   <fileset dir=".">
     <include name="foo*"/>
   </fileset>
 </checksum>
-
+
Works just like Example 1, but generates a .MD5 file for every file that begins with the name foo.

Example 8

-
+
 <condition property="isChecksumEqual">
   <checksum>
     <fileset dir=".">
@@ -199,7 +199,7 @@ Works just like Example 1, but generates a .MD5 file for every file that begins
     </fileset>
   </checksum>
 </condition>
-
+
Works like Example 4, but only sets isChecksumEqual to true, if the checksum matches - it will never be set to false. This example demonstrates use with the Condition task. diff --git a/docs/manual/CoreTasks/chmod.html b/docs/manual/CoreTasks/chmod.html index 9d428cbf9..2f779e3de 100644 --- a/docs/manual/CoreTasks/chmod.html +++ b/docs/manual/CoreTasks/chmod.html @@ -145,7 +145,7 @@ permissions.

</dirset> </chmod> - +blockquote>

keeps non-owners from touching cgi scripts, files with a .old extension or directories beginning with private_. A directory diff --git a/docs/manual/CoreTasks/pack.html b/docs/manual/CoreTasks/pack.html index 6c86d58b9..0e44ef925 100644 --- a/docs/manual/CoreTasks/pack.html +++ b/docs/manual/CoreTasks/pack.html @@ -36,12 +36,12 @@ file is newer.

Examples

-
-

<gzip src="test.tar" destfile="test.tar.gz"/>

-
-
-

<bzip2 src="test.tar" destfile="test.tar.bz2"/>

-
+
+<gzip src="test.tar" destfile="test.tar.gz"/>
+
+
+<bzip2 src="test.tar" destfile="test.tar.bz2"/>
+

Copyright © 2000-2005 The Apache Software Foundation. All rights Reserved.

diff --git a/docs/manual/CoreTasks/unpack.html b/docs/manual/CoreTasks/unpack.html index 5c1ad48f6..d4a26abb5 100644 --- a/docs/manual/CoreTasks/unpack.html +++ b/docs/manual/CoreTasks/unpack.html @@ -38,21 +38,21 @@ does not exist.

Examples

-
-

<gunzip src="test.tar.gz"/>

-
+
+<gunzip src="test.tar.gz"/>
+

expands test.tar.gz to test.tar

-
-

<bunzip2 src="test.tar.bz2"/>

-
+
+<bunzip2 src="test.tar.bz2"/>
+

expands test.tar.bz2 to test.tar

-
-

<gunzip src="test.tar.gz" dest="test2.tar"/>

-
+
+<gunzip src="test.tar.gz" dest="test2.tar"/>
+

expands test.tar.gz to test2.tar

-
-

<gunzip src="test.tar.gz" dest="subdir"/>

-
+
+<gunzip src="test.tar.gz" dest="subdir"/>
+

expands test.tar.gz to subdir/test.tar (assuming subdir is a directory).