Skip to content
Permalink
Browse files
Import sandbox antlibs
git-svn-id: https://svn.apache.org/repos/asf/ant/sandbox/antlibs/dotnet/trunk@161469 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
bodewig committed Apr 15, 2005
0 parents commit 65552cf8b752d587dd0f79457637698b3bc20bef
Showing 29 changed files with 2,917 additions and 0 deletions.
38 README
@@ -0,0 +1,38 @@
dotnet sandbox README
=====================

Author:
-------

Stefan Bodewig, but feel free to go ahead and modify to your liking.

Goal:
-----

Provide 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.

This sounds far more ambitioned than it actually is.

Short term goals are:

* A <dotnetexec> task that can be used as

<dotnetexec executable="ExampleCsc.exe"/>

without testing for the environment (see the dotnet.xml build file
for Ant's tests as an example for what may become simpler with
this).

* A <nant> task.

* A <msbuild> task - if only for the fun of having it.

* A <wix> task.

* A <nunit> task.

Those tasks should end up in an antlib of their own in order to be
distributable independent of Ant.
@@ -0,0 +1,91 @@
<?xml version="1.0"?>
<!--
Copyright 2003-2004 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.
-->
<project default="compile">

<target name="setup">
<property name="build" value="build"/>
<property name="build.classes" value="${build}/classes"/>
<property name="build.testclasses" value="${build}/test-classes"/>
<property name="build.lib" value="${build}/lib"/>
<property name="jarname" value="${build.lib}/dotnet.jar"/>
<mkdir dir="${build.classes}"/>
<mkdir dir="${build.testclasses}"/>
<mkdir dir="${build.lib}"/>
</target>

<target name="compile" depends="setup">
<javac
srcdir="src/main"
destdir="${build.classes}"
debug="true"
/>
</target>

<target name="antlib" depends="compile">
<copy todir="${build.classes}">
<fileset dir="src/main" includes="**/antlib.xml"/>
</copy>
<jar
destfile="${jarname}"
basedir="${build.classes}"
/>
</target>

<target name="setup-for-tests" depends="setup">
<ant
antfile="../../../build.xml"
target="test-jar"
inheritall="false"
/>
</target>

<target name="compile-tests" depends="setup-for-tests, antlib">
<javac
srcdir="src/testcases"
destdir="${build.testclasses}"
debug="true"
>
<classpath>
<pathelement location="${jarname}"/>
<pathelement location="../../../build/lib/ant-testutil.jar"/>
</classpath>
</javac>
</target>

<target name="test" depends="compile-tests">
<junit
printsummary="false"
haltonfailure="false"
failureproperty="tests.failed"
filtertrace="false"
>
<classpath>
<pathelement location="${jarname}"/>
<pathelement location="../../../build/lib/ant-testutil.jar"/>
<pathelement location="${build.testclasses}"/>
</classpath>

<batchtest>
<fileset dir="src/testcases"/>
</batchtest>

<formatter type="plain" usefile="false"/>
</junit>

<fail if="tests.failed">At least one test has failed.</fail>
</target>
</project>
@@ -0,0 +1,32 @@
<html>
<head>
<meta http-equiv="Content-Language" content="en-us"></meta>
<title>DotNetExec Task</title>
</head>

<body>
<h2><a name="dotnetexec">DotNetExec</a></h2>

<h3>Description</h3>

<p>Executes a .NET assembly that's on your PATH or pointed to
directly by the executable attribute.</p>

<p>This task is an extension of Ant's <a
href="http://ant.apache.org/manual/CoreTasks/exec.html">exec</a>
task and supports all attributes and nested child elements of that
task. Use the executable attribute to specify the name of the
assembly (including the extension).</p>

<p>This task allows you to choose the .NET framework via the
<code>vm</code> attribute. The default value is "microsoft" on
Windows and "mono" on all other platforms. "microsoft" is a magic
name that means "run the assembly as executable directly" - this
may also work for Mono on Linux systems with the binfmt feature
described in the <a
href="http://www.go-mono.org/faq.html#q86">Mono FAQ</a>.</p>

<hr/>
<p align="center">Copyright &copy; 2003-2004 The Apache Software Foundation. All rights Reserved.</p>
</body>
</html>
@@ -0,0 +1,142 @@
<html>
<head>
<meta http-equiv="Content-Language" content="en-us"></meta>
<title>Dotnet Ant Library</title>
</head>

<body>
<h2>Introduction</h2>

<p>This is a library of Ant tasks that support using .NET
executables accross different platforms and in particular support
using common .NET development tools like <a
href="http://nant.sourceforge.net/">NAnt</a> or <a
href="http://www.nunit.org/">NUnit</a> from within Ant.</p>

<h2>Requirements</h2>

<p>The current version requires Ant 1.6.2 or later and may even
work better for a CVS build of Ant created from CVS HEAD.</p>

<h2>Where is it?</h2>

<p>The source code for the library currently lives in the
developer sandbox in Ant's CVS - <a
href="http://cvs.apache.org/viewcvs.cgi/ant/proposal/sandbox/dotnet/">http://cvs.apache.org/viewcvs.cgi/ant/proposal/sandbox/dotnet/</a>.
A binary can be found at <a
href="http://cvs.apache.org/~bodewig/dotnet/dotnet.jar">http://cvs.apache.org/~bodewig/dotnet/dotnet.jar</a>.
A zip file containing the docs is also <a
href="http://cvs.apache.org/~bodewig/dotnet/docs.zip">available</a>.</p>

<p>Note that these are temporary locations and may change later.</p>

<h2>Feedback</h2>

<p>Right now direct any feedback either directly to <a
href="mailto:bodewig@apache.org">me</a> or the <a
href="http://ant.apache.org/mail.html#Developer List">Ant
developer list</a>.

<h2>Installation</h2>

<p>If you are building this from sources, run the antlib target
and you'll get a file <code>dotnet.jar</code>. If you've
downloaded <code>dotnet.jar</code>, you are already ready.</p>

<p>There are several ways to use the tasks:</p>

<ul>
<li>The traditional way:
<pre>
&lt;taskdef
resource="org/apache/tools/ant/taskdefs/optional/dotnet/antlib.xml"&gt;
&lt;classpath&gt;
&lt;pathelement location="YOUR-PATH-TO/dotnet.jar"/&gt;
&lt;/classpath&gt;
&lt;/taskdef&gt;
</pre>

With this you can use the tasks like plain Ant tasks, they'll
live in the default namespace. I.e. if you can run
&lt;exec&gt; without any namespace prefix, you can do so for
&lt;dotnetexec&gt; as well.
</li>

<li>Similar, but assigning a namespace URI
<pre>
&lt;taskdef
uri="antlib:org.apache.tools.ant.taskdefs.optional.dotnet"
resource="org/apache/tools/ant/taskdefs/optional/dotnet/antlib.xml"&gt;
&lt;classpath&gt;
&lt;pathelement location="YOUR-PATH-TO/dotnet.jar"/&gt;
&lt;/classpath&gt;
&lt;/taskdef&gt;
</pre>

This puts you task into a separate namespace than Ant's
namespace. You would use the tasks like

<pre>
&lt;project
xmlns:dn="antlib:org.apache.tools.ant.taskdefs.optional.dotnet"
xmlns="antlib:org.apache.tools.ant"&gt;
...
&lt;dn:nant&gt;
&lt;dn:target name="my-target"/&gt;
&lt;/dn:nant&gt;
</pre>

or

<pre>
&lt;nant xmlns="antlib:org.apache.tools.ant.taskdefs.optional.dotnet"&gt;
&lt;target name="my-target"/&gt;
&lt;/nant&gt;
</pre>

or a variation thereof.
</li>

<li>Using Ant's autodiscovery. Place <code>dotnet.jar</code>
into a directory and use <code>ant -lib
DIR-CONTAINING-THE-JAR</code> or copy it into
<code>ANT_HOME/lib</code> - and then in your build file, simply
declare the namespace on the <code>project</code> tag:

<pre>
&lt;project
xmlns:dn="antlib:org.apache.tools.ant.taskdefs.optional.dotnet"
xmlns="antlib:org.apache.tools.ant"&gt;
</pre>

And all tasks of this library will automatically be available
in the <code>dn</code> namespace without any
<code>taskdef</code>.
</li>
</ul>

<h2>Tasks</h2>

<ul>
<li><a href="dotnetexec.html">dotnetexec</a> - run a .NET
assembly that's in your PATH. You can chose the framework that
is going to be used - defaults to Mono on non-Windows platforms
and Microsoft's on Windows.</li>

<li><a href="nant.html">nant</a> - execute the NAnt build
tool.</li>

<li><a href="msbuild.html">msbuild</a> - execute the MSBuild build
tool, untested.</li>

<li><a href="wix.html">wix</a> - execute the WiX toolset, untested.</li>

<li><a href="nunit.html">nunit</a> - execute the
nunit-console.exe <a href="http://www.nunit.org/">NUnit</a>
test runner.</li>
</ul>

<hr/>
<p align="center">Copyright &copy; 2003-2004 The Apache Software Foundation. All rights Reserved.</p>
</body>
</html>

0 comments on commit 65552cf

Please sign in to comment.