Browse Source

Update Antlib status

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@371996 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 19 years ago
parent
commit
9f73c537e1
5 changed files with 567 additions and 72 deletions
  1. +221
    -0
      xdocs/antlibs/antunit/index.xml
  2. +146
    -0
      xdocs/antlibs/dotnet/index.xml
  3. +123
    -2
      xdocs/antlibs/proper.xml
  4. +8
    -70
      xdocs/antlibs/sandbox.xml
  5. +69
    -0
      xdocs/antlibs/svn/index.xml

+ 221
- 0
xdocs/antlibs/antunit/index.xml View File

@@ -0,0 +1,221 @@
<?xml version="1.0"?>
<!--
Copyright 2006 The Apache Software Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<document>

<properties>
<index value="1"/>
<title>AntUnit</title>
</properties>

<body>

<section name="Idea">
<p>Initially all tests for Ant tasks were written as individual
<a href="http://www.junit.org/">JUnit</a> test cases. Pretty
soon it was clear that most tests needed to perform common tasks
like reading a build file, intializing a project instance with
it and executing a target. At this point <a
href="http://svn.apache.org/viewcvs.cgi/ant/core/trunk/src/testcases/org/apache/tools/ant/BuildFileTest.java">BuildFileTest</a>
was invented, a base class for almost all task test cases.</p>

<p>BuildFileTest works fine and in fact has been picked up by <a
href="http://ant-contrib.sf.net/">the Ant-Contrib Project</a>
and others as well.</p>

<p>Over time a new pattern evolved, more and more tests only
executed a target and didn't check any effects. Instead that
target contained the assertions as a <code>&lt;fail&gt;</code>
task. This is an example taken from the build file for the
ANTLR task (using Ant 1.7 features):</p>

<source><![CDATA[
<target name="test3" depends="setup">
<antlr target="antlr.g" outputdirectory="${tmp.dir}"/>
<fail>
<condition>
<!-- to prove each of these files exists;
ANTLR >= 2.7.6 leaves behind new (.smap) files as well. -->
<resourcecount when="ne" count="5">
<fileset dir="${tmp.dir}">
<include name="CalcParserTokenTypes.txt" />
<include name="CalcParserTokenTypes.java" />
<include name="CalcLexer.java" />
<include name="CalcParser.java" />
<include name="CalcTreeWalker.java" />
</fileset>
</resourcecount>
</condition>
</fail>
</target>
]]></source>

<p>where the corresponding JUnit testcase has been reduced
to</p>

<source><![CDATA[
...
public class ANTLRTest extends BuildFileTest {

private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/antlr/";

public ANTLRTest(String name) {
super(name);
}

public void setUp() {
configureProject(TASKDEFS_DIR + "antlr.xml");
}

public void tearDown() {
executeTarget("cleanup");
}

public void test3() {
executeTarget("test3");
}
...
}
]]></source>

<p>This approach has a couple of advantages, one of them is that
it is very easy to translate an example build file from a bug
report into a test case. If you ask a user for a testcase for a
given bug in Ant, he now doesn't need to understand JUnit or how
to fit a test into Ant's existing tests any more.</p>

<p>AntUnit takes this approach to testing even further, it
removes JUnit completely and it comes with a set of predefined
<code>&lt;assert&gt;</code> tasks in order to reuse common kind
of checks.</p>

<p>It turns out that AntUnit lends itself as a solution to other
problems as well. The assertions are an easy way to validate a
setup before even starting the build process, for example.
AntUnit could also be used for functional and integration tests
outside of the scope of Ant tasks (assert contents of databases
after running an application, assert contents of HTTP responses
...). This is an area that will need more research.</p>
</section>

<section name="Concepts">
<subsection name="antunit Task">
<p>The &lt;antunit&gt; task drives the tests much like
&lt;junit&gt; does for JUnit tests.</p>

<p>When called on a build file, the task will start a new Ant
project for that build file and scan for targets with names
that start with "test". For each such target it then will</p>
<ol>
<li>Execute the target named setUp, if there is one.</li>
<li>Execute the target itself - if this target depends on
other targets the normal Ant rules apply and the dependent
targets are executed first.</li>
<li>Execute the target names tearDown, if there is one.</li>
</ol>

</subsection>
<subsection name="Assertions">

<p>The base task is <code>&lt;assertTrue&gt;</code>. It
accepts a single nested condition and throws a subclass of
BuildException named AssertionFailedException if that
condition evaluates to false.</p>

<p>This task could have been implemented using
<code>&lt;macrodef&gt;</code> and <code>&lt;fail&gt;</code>,
but in fact it is a "real" task so that it is possible to
throw a subclass of BuildException. The
<code>&lt;antunit&gt;</code> task catches this exception and
marks the target as failed, any other type of Exception
(including other BuildException) are test errors.</p>

<p>Together with <code>&lt;assertTrue&gt;</code> there are
many predefined assertions for common conditions, most of
these are only macros.</p>

</subsection>

<subsection name="Other Tasks">

<p>The <code>&lt;logcapturer&gt;</code> captures all messages
that pass Ant's logging system and provides them via a
reference inside of the project. If you want to assert
certain log messages, you need to start this task (prior to
your target under test) and use the
<code>&lt;assertLogContains&gt;</code> assertion.</p>

<p><code>&lt;expectFailure&gt;</code> is a task container that
catches any BuildException thrown by tasks nested into it. If
no exception has been thrown it will cause a test failure (by
throwing an AssertionFailedException).</p>
</subsection>

<subsection name="AntUnitListener">
<p>Part of the library is the <code>AntUnitListener</code>
interface that can be used to record test results. The
&lt;antunit&gt; task accepts arbitrary many listeners and
relays test results to them.</p>

<p>Currently only a single implementation
<code>&lt;plainlistener&gt;</code> modelled after the "plain"
JUnit listener is bundeled with the library.</p>
</subsection>
</section>

<section name="Examples">

<p>This is a way to test that <code>&lt;touch&gt;</code>
actually creates a file if it doesn't exist:</p>

<source><![CDATA[
<project xmlns:au="antlib:org.apache.ant.antunit">
<!-- is called prior to the test -->
<target name="setUp">
<property name="foo" value="foo"/>
</target>

<!-- is called after the test, if if that causes an error -->
<target name="tearDown">
<delete file="${foo}" quiet="true"/>
</target>

<!-- the actual test case -->
<target name="testTouchCreatesFile">
<au:assertFileDoesntExist name="${foo}"/>
<touch file="${foo}"/>
<au:assertFileExists name="${foo}"/>
</target>
</project>
]]></source>

<p>When running a task like</p>

<source><![CDATA[
<au:antunit>
<fileset dir="." includes="touch.xml"/>
<au:plainlistener/>
</au:antunit>
]]></source>

<p>from a buildfile of its own you'll get a result that looks like</p>

<source><![CDATA[
]]></source>

</section>
</body>
</document>

+ 146
- 0
xdocs/antlibs/dotnet/index.xml View File

@@ -0,0 +1,146 @@
<?xml version="1.0"?>
<!--
Copyright 2006 The Apache Software Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<document>

<properties>
<index value="1"/>
<title>.NET Ant Library</title>
</properties>

<body>

<section name="Idea">

<p>This library doesn't strive to replace NAnt or MSBuild, its
main purpose is to help those of us who work on projects
crossing platform boundaries. With this library you can use Ant
to build and test the Java as well as the .NET parts of your
project.</p>

<p>This library provides a special version of the
<code>&lt;exec&gt;</code> task tailored to run .NET executables.
On Windows it will assume the Microsoft framework is around and
run the executable directly, while it will invoke Mono on any
other platform. Of course you can override these
assumptions.</p>

<p>Based on this a few tasks to run well known .NET utilities
from within Ant are provided, namely tasks to run <a
href="http://www.nunit.org/">NUnit</a>, <a
href="http://nant.sf.net/">NAnt</a> and <a
href="http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=27&amp;SiteID=1">MSBuild</a>.</p>

<p>There also is some experimental <a
href="http://wix.sf.net/">Wix</a> task, but it probably doesn't
do anything useful at all.</p>
</section>

<section name="Tasks">
<subsection name="dotnetexec">
<p>Runs a .NET executable.</p>
</subsection>

<subsection name="nunit">
<p>Runs NUnit tests.</p>
</subsection>

<subsection name="nant">
<p>Invokes NAnt, either on an external file or a build file
snippet contained inside your Ant build file.</p>
</subsection>

<subsection name="msbuild">
<p>Invokes MSBuild, either on an external file or a build file
snippet contained inside your Ant build file.</p>
</subsection>
</section>

<section name="Examples">
<subsection name="nant">
<source><![CDATA[
<project xmlns:dn="antlib:org.apache.ant.dotnet">
<dn:nant>
<build>
<echo message="Hello world"/>
</build>
</dn:nant>
</project>
]]></source>

<p>runs NAnt on the embedded <code>&lt;echo&gt;</code>
task, output looks like</p>

<source><![CDATA[
Buildfile: test.xml
[dn:nant] NAnt 0.85 (Build 0.85.1932.0; rc3; 16.04.2005)
[dn:nant] Copyright (C) 2001-2005 Gerry Shaw
[dn:nant] http://nant.sourceforge.net
[dn:nant]
[dn:nant] Buildfile: file:///c:/DOKUME~1/STEFAN~1.BOD/LOKALE~1/Temp/build1058451555.xml
[dn:nant] Target framework: Microsoft .NET Framework 1.1
[dn:nant]
[dn:nant] [echo] Hello world
[dn:nant]
[dn:nant] BUILD SUCCEEDED
[dn:nant]
[dn:nant] Total time: 0.2 seconds.

BUILD SUCCESSFUL
Total time: 2 seconds]]></source>
</subsection>

<subsection name="msbuild">
<source><![CDATA[
<project xmlns:dn="antlib:org.apache.ant.dotnet">
<dn:msbuild>
<build>
<Message Text="Hello world"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"/>
</build>
</dn:msbuild>
</project>]]></source>

<p>runs MSBuild on the embedded <code>&lt;Message&gt;</code>
task, output looks like</p>

<source><![CDATA[
Buildfile: test.xml
[dn:msbuild] Microsoft (R) Build Engine Version 2.0.50727.42
[dn:msbuild] [Microsoft .NET Framework, Version 2.0.50727.42]
[dn:msbuild] Copyright (C) Microsoft Corporation 2005. All rights reserved.

[dn:msbuild] Build started 15.12.2005 20:21:56.
[dn:msbuild] __________________________________________________
[dn:msbuild] Project "c:\Dokumente und Einstellungen\stefan.bodewig\Lokale Einstellungen\Temp\build1543310185.xml" (default targets):

[dn:msbuild] Target generated-by-ant:
[dn:msbuild] Hello world

[dn:msbuild] Build succeeded.
[dn:msbuild] 0 Warning(s)
[dn:msbuild] 0 Error(s)

[dn:msbuild] Time Elapsed 00:00:00.10

BUILD SUCCESSFUL
Total time: 0 seconds
]]></source>

</subsection>
</section>
</body>
</document>

+ 123
- 2
xdocs/antlibs/proper.xml View File

@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
Copyright 2005 The Apache Software Foundation
Copyright 2005-2006 The Apache Software Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -25,7 +25,128 @@

<section name="Ant Libraries">

<p>No Ant Library has left the sandbox yet.</p>
<a name="antunit"/>
<subsection name="AntUnit - Unit Test Framework for Ant Tasks">

<p>AntUnit borrows ideas from JUnit 3.x and the &lt;junit&gt;
task. It provides a task that runs build files as unit tests
as well as a number of assertion tasks to support the
idea.</p>

<table>
<tr>
<th>Homepage:</th>
<td><a href="./antunit/index.html">http://ant.apache.org/antlibs/antunit/</a></td>
</tr>
<tr>
<th>SVN URL:</th>
<td><a href="https://svn.apache.org/repos/asf/ant/antlibs/antunit/trunk/">https://svn.apache.org/repos/asf/ant/antlibs/antunit/trunk/</a></td>
</tr>
<tr>
<th>ViewSVN:</th>
<td><a href="http://svn.apache.org/viewcvs.cgi/ant/antlibs/antunit/trunk/">http://svn.apache.org/viewcvs.cgi/ant/antlibs/antunit/trunk/</a></td>
</tr>
<tr>
<th>Ant compatibility:</th>
<td>Ant 1.7.x</td>
</tr>
<tr>
<th>Added to sandbox:</th>
<td>2005-04-15</td>
</tr>
<tr>
<th>Promoted from sandbox:</th>
<td>2005-11-22</td>
</tr>
<tr>
<th>Latest Release:</th>
<td>None</td>
</tr>
</table>
</subsection>

<a name="dotnet"/>
<subsection name="DotNet - Improved Support for .NET projects">

<p>Provides a simple infrastructure to execute .NET
applications from within Ant for different VMs so that the
user doesn't have to change the build file when she wants to
run Mono on Linux and Microsoft's VM on Windows.</p>

<p>Also contains &lt;nant&gt;, &lt;nunit&gt; and
&lt;msbuild&gt; tasks and an untested &lt;wix&gt; tasks.</p>

<table>
<tr>
<th>Homepage:</th>
<td><a href="./dotnet/index.html">http://ant.apache.org/antlibs/dotnet/</a></td>
</tr>
<tr>
<th>SVN URL:</th>
<td><a href="https://svn.apache.org/repos/asf/ant/antlibs/dotnet/trunk/">https://svn.apache.org/repos/asf/ant/antlibs/dotnet/trunk/</a></td>
</tr>
<tr>
<th>ViewSVN:</th>
<td><a href="http://svn.apache.org/viewcvs.cgi/ant/antlibs/dotnet/trunk/">http://svn.apache.org/viewcvs.cgi/ant/antlibs/dotnet/trunk/</a></td>
</tr>
<tr>
<th>Ant compatibility:</th>
<td>Ant 1.7.x<br/>A branch that works with Ant 1.6.2 and
above exists in <a href="https://svn.apache.org/repos/asf/ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/">https://svn.apache.org/repos/asf/ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/</a></td>
</tr>
<tr>
<th>Added to sandbox:</th>
<td>2005-04-15</td>
</tr>
<tr>
<th>Promoted from sandbox:</th>
<td>2005-11-22</td>
</tr>
<tr>
<th>Latest Release:</th>
<td>None</td>
</tr>
</table>
</subsection>

<a name="svn"/>
<subsection name="SVN - Subversion Support">

<p>Contains tasks that correspond to Ant's &lt;cvs&gt;,
&lt;cvschangelog&gt; and &lt;cvstagdiff&gt; tasks. Requires
Subversion's command line client.</p>

<table>
<tr>
<th>Homepage:</th>
<td><a href="./svn/index.html">http://ant.apache.org/antlibs/svn/</a></td>
</tr>
<tr>
<th>SVN URL:</th>
<td><a href="https://svn.apache.org/repos/asf/ant/antlibs/svn/trunk/">https://svn.apache.org/repos/asf/ant/antlibs/svn/trunk/</a></td>
</tr>
<tr>
<th>ViewSVN:</th>
<td><a href="http://svn.apache.org/viewcvs.cgi/ant/antlibs/svn/trunk/">http://svn.apache.org/viewcvs.cgi/ant/antlibs/svn/trunk/</a></td>
</tr>
<tr>
<th>Ant compatibility:</th>
<td>Ant 1.7.x</td>
</tr>
<tr>
<th>Added to sandbox:</th>
<td>2005-04-15</td>
</tr>
<tr>
<th>Promoted from sandbox:</th>
<td>2005-11-22</td>
</tr>
<tr>
<th>Latest Release:</th>
<td>None</td>
</tr>
</table>
</subsection>

</section>



+ 8
- 70
xdocs/antlibs/sandbox.xml View File

@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
Copyright 2005 The Apache Software Foundation
Copyright 2005-2006 The Apache Software Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -37,6 +37,9 @@

<section name="Current Sandbox Ant Libraries">

<p>There are no Ant libraries in the sandbox right now.</p>

<!-- example for copy/paste reuse ;-)
<subsection name="AntUnit - Unit Test Framework for Ant Tasks">

<p>AntUnit borrows ideas from JUnit 3.x and the &lt;junit&gt;
@@ -46,77 +49,12 @@

<table>
<tr>
<th>URL:</th>
<td>https://svn.apache.org/repos/asf/ant/sandbox/antlibs/antunit/trunk/</td>
</tr>
<tr>
<th>ViewSVN:</th>
<td>http://svn.apache.org/viewcvs.cgi/ant/sandbox/antlibs/antunit/trunk/</td>
</tr>
<tr>
<th>Ant compatibility:</th>
<td>Ant 1.7.x</td>
</tr>
<tr>
<th>Added to sandbox:</th>
<td>2005-04-15</td>
</tr>
<tr>
<th>Sponsoring Committers</th>
<td>Stefan Bodewig</td>
</tr>
</table>
</subsection>

<subsection name="DotNet - Improved Support for .NET projects">

<p>Provides a simple infrastructure to execute .NET
applications from within Ant for different VMs so that the
user doesn't have to change the build file when she wants to
run Mono on Linux and Microsoft's VM on Windows.</p>

<p>Also contains &lt;nant&gt;, &lt;nunit&gt; and untested
&lt;msbuild&gt; and &lt;wix&gt; tasks.</p>

<table>
<tr>
<th>URL:</th>
<td>https://svn.apache.org/repos/asf/ant/sandbox/antlibs/dotnet/trunk/</td>
</tr>
<tr>
<th>ViewSVN:</th>
<td>http://svn.apache.org/viewcvs.cgi/ant/sandbox/antlibs/dotnet/trunk/</td>
</tr>
<tr>
<th>Ant compatibility:</th>
<td>Ant 1.7.x<br/>A branch that works with Ant 1.6.2 and
above exists in https://svn.apache.org/repos/asf/ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/</td>
</tr>
<tr>
<th>Added to sandbox:</th>
<td>2005-04-15</td>
</tr>
<tr>
<th>Sponsoring Committers</th>
<td>Stefan Bodewig</td>
</tr>
</table>
</subsection>

<subsection name="SVN - Subversion Support">

<p>Contains tasks that correspond to Ant's &lt;cvs&gt;,
&lt;cvschangelog&gt; and &lt;cvstagdiff&gt; tasks. Requires
Subversion's command line client.</p>

<table>
<tr>
<th>URL:</th>
<td>https://svn.apache.org/repos/asf/ant/sandbox/antlibs/svn/trunk/</td>
<th>SVN URL:</th>
<td><a href="https://svn.apache.org/repos/asf/ant/sandbox/antlibs/antunit/trunk/">https://svn.apache.org/repos/asf/ant/sandbox/antlibs/antunit/trunk/</a></td>
</tr>
<tr>
<th>ViewSVN:</th>
<td>http://svn.apache.org/viewcvs.cgi/ant/sandbox/antlibs/svn/trunk/</td>
<td><a href="http://svn.apache.org/viewcvs.cgi/ant/sandbox/antlibs/antunit/trunk/">http://svn.apache.org/viewcvs.cgi/ant/sandbox/antlibs/antunit/trunk/</a></td>
</tr>
<tr>
<th>Ant compatibility:</th>
@@ -132,7 +70,7 @@
</tr>
</table>
</subsection>
-->
</section>
</body>


+ 69
- 0
xdocs/antlibs/svn/index.xml View File

@@ -0,0 +1,69 @@
<?xml version="1.0"?>
<!--
Copyright 2006 The Apache Software Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<document>

<properties>
<index value="1"/>
<title>Subversion Ant Library</title>
</properties>

<body>

<section name="Idea">
<p>The main purpose of this Ant library is to provide the same
level of support that Ant provides for CVS. This means the
tasks are wrappers on top of the command line client (read: you
still need to install an svn client) and there is not much more
than running the executable and creating some reports.</p>

<p>If you are looking for projects that aim at more, there are
better alternatives, for example <a
href="http://subclipse.tigris.org/svnant.html">Subclipse's Ant
task</a> or <a
href="http://tmate.org/svn/ant.html">JavaSVN</a>.</p>
</section>

<section name="Tasks">
<subsection name="svn">
<p>A very thin layer on top of the command line executable,
comparable to <a
href="http://ant.apache.org/manual/CoreTasks/cvs.html">the CVS
task</a>.</p>
</subsection>

<subsection name="changelog">
<p>Creates a log of change comments between two revisions,
comparable to <a
href="http://ant.apache.org/manual/CoreTasks/changelog.html">CvsChangeLog</a>.</p>
</subsection>

<subsection name="*diff">
<p><code>&lt;tagdiff&gt;</code> creates a differences report
for the changes between two tags or branches.</p>

<p><code>&lt;revisiondiff&gt;</code> creates a differences report
for the changes between two revisions.</p>

<p>Together comparable to <a
href="http://ant.apache.org/manual/CoreTasks/cvstagdiff.html">CvsTagDiff</a>.</p>
</subsection>
</section>

<section name="Examples">
</section>
</body>
</document>

Loading…
Cancel
Save