ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r161469 [2/5] - in ant/sandbox/antlibs: antunit/ antunit/branches/ antunit/tags/ antunit/trunk/ antunit/trunk/src/ antunit/trunk/src/etc/ antunit/trunk/src/etc/testcases/ antunit/trunk/src/main/ antunit/trunk/src/main/org/ antunit/trunk/src/main/org/apache/ antunit/trunk/src/main/org/apache/ant/ antunit/trunk/src/main/org/apache/ant/antlib/ antunit/trunk/src/main/org/apache/ant/antlib/antunit/ antunit/trunk/src/testcases/ antunit/trunk/src/testcases/org/ antunit/trunk/src/testcases/org/apache/ antunit/trunk/src/testcases/org/apache/ant/ antunit/trunk/src/testcases/org/apache/ant/antlib/ antunit/trunk/src/testcases/org/apache/ant/antlib/antunit/ dotnet/ dotnet/branches/ dotnet/branches/Ant_1.6.2_compatible/ dotnet/branches/Ant_1.6.2_compatible/docs/ dotnet/branches/Ant_1.6.2_compatible/src/ dotnet/branches/Ant_1.6.2_compatible/src/etc/ dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/ dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/ dotnet/branches/Ant_1.6.2_compatible/src/main/ dotnet/branches/Ant_1.6.2_compatible/src/main/org/ dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/ dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/ dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/ dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/ dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/ dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/util/ dotnet/branches/Ant_1.6.2_compatible/src/testcases/ dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/ dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/ dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/ dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/ dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/ dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/ dotnet/tags/ dotnet/trunk/ dotnet/trunk/docs/ dotnet/trunk/src/ dotnet/trunk/src/etc/ dotnet/trunk/src/etc/testcases/ dotnet/trunk/src/etc/testcases/src/ dotnet/trunk/src/main/ dotnet/trunk/src/main/org/ dotnet/trunk/src/main/org/apache/ dotnet/trunk/src/main/org/apache/tools/ dotnet/trunk/src/main/org/apache/tools/ant/ dotnet/trunk/src/main/org/apache/tools/ant/taskdefs/ dotnet/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ dotnet/trunk/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/ dotnet/trunk/src/testcases/ dotnet/trunk/src/testcases/org/ dotnet/trunk/src/testcases/org/apache/ dotnet/trunk/src/testcases/org/apache/tools/ dotnet/trunk/src/testcases/org/apache/tools/ant/ dotnet/trunk/src/testcases/org/apache/tools/ant/taskdefs/ dotnet/trunk/src/testcases/org/apache/tools/ant/taskdefs/optional/ dotnet/trunk/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/ svn/ svn/branches/ svn/tags/ svn/trunk/ svn/trunk/docs/ svn/trunk/src/ svn/trunk/src/etc/ svn/trunk/src/etc/testcases/ svn/trunk/src/main/ svn/trunk/src/main/org/ svn/trunk/src/main/org/apache/ svn/trunk/src/main/org/apache/tools/ svn/trunk/src/main/org/apache/tools/ant/ svn/trunk/src/main/org/apache/tools/ant/taskdefs/ svn/trunk/src/main/org/apache/tools/ant/taskdefs/svn/ svn/trunk/src/testcases/ svn/trunk/src/testcases/org/ svn/trunk/src/testcases/org/apache/ svn/trunk/src/testcases/org/apache/tools/ svn/trunk/src/testcases/org/apache/tools/ant/ svn/trunk/src/testcases/org/apache/tools/ant/taskdefs/ svn/trunk/src/testcases/org/apache/tools/ant/taskdefs/svn/
Date Fri, 15 Apr 2005 14:33:06 GMT
Added: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/fail.cs
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/fail.cs?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/fail.cs (added)
+++ ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/fail.cs Fri Apr 15 07:32:50 2005
@@ -0,0 +1,30 @@
+/*
+ * Copyright  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.
+ *
+ */
+
+using System;
+using NUnit.Framework;
+
+[TestFixture]
+public class FailingTest
+{
+
+    [Test]
+    public void Fail() 
+    {
+        Assert.IsTrue(false);
+    }
+}

Propchange: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/fail.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/msbuild.proj
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/msbuild.proj?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/msbuild.proj (added)
+++ ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/msbuild.proj Fri Apr 15 07:32:50 2005
@@ -0,0 +1,24 @@
+<?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 DefaultTargets="empty">
+
+  <Target Name="empty"/>
+
+  <Target Name="echo">
+    <Task Name="Echo" Message="foo is ${foo}"/>
+  </Target>
+</Project>

Added: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/nant.build
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/nant.build?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/nant.build (added)
+++ ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/nant.build Fri Apr 15 07:32:50 2005
@@ -0,0 +1,24 @@
+<?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 basedir="." default="empty">
+
+  <target name="empty"/>
+
+  <target name="echo">
+    <echo message="foo is ${foo}"/>
+  </target>
+</project>

Added: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/pass.cs
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/pass.cs?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/pass.cs (added)
+++ ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/pass.cs Fri Apr 15 07:32:50 2005
@@ -0,0 +1,30 @@
+/*
+ * Copyright  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.
+ *
+ */
+
+using System;
+using NUnit.Framework;
+
+[TestFixture]
+public class PassingTest
+{
+
+    [Test]
+    public void Pass() 
+    {
+        Assert.IsTrue(true);
+    }
+}

Propchange: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/pass.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/AbstractBuildTask.java
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/AbstractBuildTask.java?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/AbstractBuildTask.java (added)
+++ ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/AbstractBuildTask.java Fri Apr 15 07:32:50 2005
@@ -0,0 +1,259 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.tools.ant.taskdefs.optional.dotnet;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.util.DOMElementWriter;
+import org.apache.tools.ant.util.FileUtils;
+import org.apache.tools.ant.util.XMLFragment;
+
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Element;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Base class for NAntTask and MSBuildTask.
+ */
+public abstract class AbstractBuildTask extends Task {
+
+    /**
+     * The buildfile to invoke the build tool for.
+     */
+    private File buildFile;
+
+    /**
+     * The targets to execute.
+     */
+    private List targets = new ArrayList();
+
+    /**
+     * Properties to set.
+     */
+    private List properties = new ArrayList(1);
+
+    /**
+     * Nested build file fragment.
+     */
+    private XMLFragment buildSnippet;
+
+    /**
+     * The vm attribute - if given.
+     */
+    private String vm;
+
+    /**
+     * Empty constructor.
+     */
+    protected AbstractBuildTask() {
+    }
+
+    /**
+     * Sets the name of the build file.
+     */
+    public final void setBuildfile(File f) {
+        buildFile = f;
+    }
+
+    /**
+     * Adds a build file fragment.
+     */
+    public void addBuild(XMLFragment f) {
+        if (buildSnippet == null) {
+            buildSnippet = f;
+        } else {
+            throw new BuildException("You must not specify more than one "
+                                     + "build element");
+        }
+    }
+
+    /**
+     * Set the name of the executable for the virtual machine.
+     *
+     * @param value the name of the executable for the virtual machine
+     */
+    public void setVm(String value) {
+        this.vm = value;
+    }
+
+    /**
+     * A target.
+     */
+    public static class Target {
+        private String name;
+
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+    }
+
+    /**
+     * A target to execute.
+     */
+    public final void addTarget(Target t) {
+        targets.add(t);
+    }
+
+    /**
+     * A property.
+     */
+    // XXX, could have reused Property or Environment.Variable 
+    //      - not decided so far
+    public static class Property {
+        private String name;
+        private String value;
+
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public void setValue(String value) {
+            this.value = value;
+        }
+
+        public String getValue() {
+            return value;
+        }
+    }
+
+    /**
+     * A target to execute.
+     */
+    public final void addProperty(Property t) {
+        properties.add(t);
+    }
+
+    /**
+     * Must return the executable.
+     *
+     * @return must not return null
+     */
+    protected abstract String getExecutable();
+
+    /**
+     * Must return buildfile argument(s).
+     *
+     * @param buildFile the absolute File for the buildfile or null if
+     * the user didn't specify a buildfile.
+     *
+     * @return must not return null
+     */
+    protected abstract String[] getBuildfileArguments(File buildFile);
+
+    /**
+     * Must return target argument(s).
+     *
+     * @return must not return null
+     */
+    protected abstract String[] getTargetArguments(List targets);
+
+    /**
+     * Must return property argument(s).
+     *
+     * @return must not return null
+     */
+    protected abstract String[] getPropertyArguments(List properties);
+
+    /**
+     * Turn the DoucmentFragment into a DOM tree suitable as a build
+     * file when serialized.
+     *
+     * <p>Must throw a BuildException if the snippet can not be turned
+     * into a build file.</p>
+     */
+    protected abstract Element makeTree(DocumentFragment f);
+
+    /**
+     * Perform the build.
+     */
+    public void execute() {
+        if (buildFile != null && buildSnippet != null) {
+            throw new BuildException("You must not specify the build file"
+                                     + " attribute and a nested build at the"
+                                     + " same time");
+        }
+
+        DotNetExecTask exec = DotNetExecTask.getTask(this, vm, 
+                                                     getExecutable(), null);
+        String[] args = getPropertyArguments(properties);
+        for (int i = 0; i < args.length; i++) {
+            exec.createArg().setValue(args[i]);
+        }
+        args = getTargetArguments(targets);
+        for (int i = 0; i < args.length; i++) {
+            exec.createArg().setValue(args[i]);
+        }
+
+        File generatedFile = null;
+        if (buildSnippet != null) {
+            try {
+                generatedFile = getBuildFile();
+            } catch (IOException e) {
+                throw new BuildException(e);
+            }
+            args = getBuildfileArguments(generatedFile);
+        } else {
+            args = getBuildfileArguments(buildFile);
+        }        
+
+        for (int i = 0; i < args.length; i++) {
+            exec.createArg().setValue(args[i]);
+        }
+
+        try {
+            exec.execute();
+        } finally {
+            if (generatedFile != null) {
+                generatedFile.delete();
+            }
+        }
+    }
+
+    private File getBuildFile() throws IOException {
+        File f = null;
+        if (buildSnippet != null) {
+            Element e = makeTree(buildSnippet.getFragment());
+            f = FileUtils.newFileUtils().createTempFile("build", ".xml", null);
+            f.deleteOnExit();
+            FileOutputStream out = null;
+            try {
+                out = new FileOutputStream(f);
+                (new DOMElementWriter()).write(e, out);
+            } finally {
+                if (out != null) {
+                    out.close();
+                }
+            }
+        }
+        return f;
+    }
+}

Propchange: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/AbstractBuildTask.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotNetExecTask.java
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotNetExecTask.java?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotNetExecTask.java (added)
+++ ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotNetExecTask.java Fri Apr 15 07:32:50 2005
@@ -0,0 +1,150 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.tools.ant.taskdefs.optional.dotnet;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.ExecTask;
+import org.apache.tools.ant.taskdefs.condition.Os;
+import org.apache.tools.ant.types.Environment;
+
+/**
+ * Specialized <exec> that knows how to deal with Mono vs. Microsoft's
+ * VM - and maybe Rotor at some point.
+ */
+public class DotNetExecTask extends ExecTask {
+
+    /**
+     * "Magic" VM argument for Microsoft's VM.
+     */
+    private static final String MS_VM = "microsoft";
+
+    /**
+     * The user supplied executable attribute.
+     */
+    private String executable;
+
+    /**
+     * The .NET VM to use.
+     *
+     * <p>Defaults to Microsoft's on Windows and mono on any other
+     * platform.</p>
+     */
+    private String vm = Os.isFamily("windows") ? MS_VM : "mono";
+
+    /**
+     * Empty Constructor.
+     */
+    public DotNetExecTask() {
+        super();
+    }
+
+    /**
+     * Set the name of the executable program.
+     * @param value the name of the executable program
+     */
+    public void setExecutable(String value) {
+        this.executable = value;
+    }
+
+    /**
+     * Set the name of the executable for the virtual machine or the
+     * magic name "microsoft" which implies that we can invoke the
+     * executable directly.
+     *
+     * @param value the name of the executable for the virtual machine
+     */
+    public void setVm(String value) {
+        this.vm = value;
+    }
+
+    /**
+     * Do the work.
+     *
+     * @throws BuildException if executable is empty or &lt;exec&gt;
+     * throws an exception.
+     */
+    public void execute() throws BuildException {
+        if (executable == null) {
+            throw new BuildException("The executable attribute is required");
+        }
+        setupCommandline();
+        super.execute();
+    }
+
+    /**
+     * If the inherited Commandline doesn't know about the executable
+     * yet, set it and deal with the vm attribute.
+     *
+     * <p>The inherited Commandline may know the executable already if
+     * this task instance is getting reused.</p>
+     */
+    protected void setupCommandline() {
+        if (cmdl.getExecutable() == null) {
+            if (vm.equals(MS_VM)) {
+                // can invoke executable directly
+                super.setExecutable(executable);
+            } else {
+                boolean b = getResolveExecutable();
+                // Mono wants the absolte path of the assembly
+                setResolveExecutable(b || isMono(vm));
+                super.setExecutable(vm);
+                cmdl.createArgument(true)
+                    .setValue(resolveExecutable(executable, isMono(vm)));
+                setResolveExecutable(b);
+            }
+        }
+    }
+
+    /**
+     * Whether the given vm looks like the Mono executable.
+     */
+    protected final static boolean isMono(String vm) {
+        return "mono".equals(vm) || "mint".equals(vm);
+    }
+
+    /**
+     * Creates an instance of this task based on a different tasks settings.
+     */
+    public static DotNetExecTask getTask(Task t, String vm, 
+                                         String executable,
+                                         Environment env) {
+        DotNetExecTask exec = new DotNetExecTask();
+        if (vm != null) {
+            exec.setVm(vm);
+        }
+        exec.setProject(t.getProject());
+        exec.setExecutable(executable);
+        exec.setTaskName(t.getTaskName());
+        if (env != null) {
+            String[] environment = env.getVariables();
+            if (environment != null) {
+                for (int i = 0; i < environment.length; i++) {
+                    int idx = environment[i].indexOf("=");
+                    Environment.Variable v = new Environment.Variable();
+                    v.setKey(environment[i].substring(0, idx));
+                    v.setValue(environment[i].substring(idx + 1));
+                    exec.addEnv(v);
+                }
+            }
+        }
+        
+        return exec;
+    }
+
+}

Propchange: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotNetExecTask.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/MSBuildTask.java
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/MSBuildTask.java?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/MSBuildTask.java (added)
+++ ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/MSBuildTask.java Fri Apr 15 07:32:50 2005
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.tools.ant.taskdefs.optional.dotnet;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Runs a MSBuild build process.
+ */
+public class MSBuildTask extends AbstractBuildTask {
+
+    private static final String TARGET = "generated-by-ant";
+
+    public MSBuildTask() {
+        super();
+    }
+
+    protected String getExecutable() {
+        return "MSBuild.exe";
+    }
+
+    protected String[] getBuildfileArguments(File buildFile) {
+        if (buildFile != null) {
+            return new String[] {
+                buildFile.getAbsolutePath()
+            };
+        } else {
+            return new String[0];
+        }
+    }
+
+    protected String[] getTargetArguments(List targets) {
+        if (targets.size() > 0) {
+            StringBuffer sb = new StringBuffer("/targets:");
+            Iterator iter = targets.iterator();
+            boolean first = true;
+            while (iter.hasNext()) {
+                AbstractBuildTask.Target t = 
+                    (AbstractBuildTask.Target) iter.next();
+                if (!first) {
+                    sb.append(";");
+                }
+                sb.append(t.getName());
+            }
+            return new String[]{sb.toString()};
+        } else {
+            return new String[0];
+        }
+    }
+
+    protected String[] getPropertyArguments(List properties) {
+        if (properties.size() > 0) {
+            StringBuffer sb = new StringBuffer("/property:");
+            Iterator iter = properties.iterator();
+            boolean first = true;
+            while (iter.hasNext()) {
+                AbstractBuildTask.Property p = 
+                    (AbstractBuildTask.Property) iter.next();
+                if (!first) {
+                    sb.append(";");
+                }
+                sb.append(p.getName()).append("=").append(p.getValue());
+            }
+            return new String[]{sb.toString()};
+        } else {
+            return new String[0];
+        }
+    }
+
+    /**
+     * Turn the DocumentFragment into a DOM tree suitable as a build
+     * file when serialized.
+     *
+     * <p>If we have exactly one <Project> child, return that.
+     * Otherwise if we have only <Task> children, wrap them into a
+     * <Target> which in turn gets wrapped into a <Project>.
+     * Otherwise, fail.</p>
+     */
+    protected Element makeTree(DocumentFragment f) {
+        NodeList nl = f.getChildNodes();
+        if (nl.getLength() == 1 
+            && nl.item(0).getNodeType() == Node.ELEMENT_NODE
+            && nl.item(0).getNodeName().equals("Project")) {
+            return (Element) nl.item(0);
+        } else {
+            Element p = f.getOwnerDocument().createElement("Project");
+            p.setAttribute("DefaultTargets", TARGET);
+
+            Element t = f.getOwnerDocument().createElement("Target");
+            t.setAttribute("Name", TARGET);
+
+            p.appendChild(t);
+            t.appendChild(f);
+            return p;
+        }
+    }
+}

Propchange: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/MSBuildTask.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NAntTask.java
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NAntTask.java?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NAntTask.java (added)
+++ ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NAntTask.java Fri Apr 15 07:32:50 2005
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.tools.ant.taskdefs.optional.dotnet;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Runs a NAnt build process.
+ */
+public class NAntTask extends AbstractBuildTask {
+
+    public NAntTask() {
+        super();
+    }
+
+    protected String getExecutable() {
+        return "NAnt.exe";
+    }
+
+    protected String[] getBuildfileArguments(File buildFile) {
+        if (buildFile != null) {
+            return new String[] {
+                "-buildfile:" + buildFile.getAbsolutePath()
+            };
+        } else {
+            return new String[0];
+        }
+    }
+
+    protected String[] getTargetArguments(List targets) {
+        ArrayList al = new ArrayList(targets.size());
+        Iterator iter = targets.iterator();
+        while (iter.hasNext()) {
+            AbstractBuildTask.Target t = (AbstractBuildTask.Target) iter.next();
+            al.add(t.getName());
+        }
+        return (String[]) al.toArray(new String[al.size()]);
+    }
+
+    protected String[] getPropertyArguments(List properties) {
+        ArrayList al = new ArrayList(properties.size());
+        Iterator iter = properties.iterator();
+        while (iter.hasNext()) {
+            AbstractBuildTask.Property p = 
+                (AbstractBuildTask.Property) iter.next();
+            al.add("-D:" + p.getName() + "=" + p.getValue());
+        }
+        return (String[]) al.toArray(new String[al.size()]);
+    }
+
+    /**
+     * Turn the DocumentFragment into a DOM tree suitable as a build
+     * file when serialized.
+     *
+     * <p>If we have exactly one <project> child, return that.
+     * Otherwise assume that this is a valid build file snippet that
+     * just needs an empty project wrapped around it.</p>
+     */
+    protected Element makeTree(DocumentFragment f) {
+        NodeList nl = f.getChildNodes();
+        if (nl.getLength() == 1 
+            && nl.item(0).getNodeType() == Node.ELEMENT_NODE
+            && nl.item(0).getNodeName().equals("project")) {
+            return (Element) nl.item(0);
+        } else {
+            Element e = f.getOwnerDocument().createElement("project");
+            e.appendChild(f);
+            return e;
+        }
+    }
+}

Propchange: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NAntTask.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NUnitTask.java
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NUnitTask.java?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NUnitTask.java (added)
+++ ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NUnitTask.java Fri Apr 15 07:32:50 2005
@@ -0,0 +1,335 @@
+/*
+ * Copyright  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.
+ *
+ */
+
+package org.apache.tools.ant.taskdefs.optional.dotnet;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Environment;
+import org.apache.tools.ant.types.RedirectorElement;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * Task to run the NUnit Console test runner.
+ *
+ * @see http://www.nunit.org/
+ */
+public class NUnitTask extends Task {
+
+    /**
+     * The vm attribute - if given.
+     */
+    private String vm;
+
+    /**
+     * Test assemblies.
+     */
+    private ArrayList testAssemblies = new ArrayList();
+
+    /**
+     * The /config argument.
+     */
+    private File configFile;
+
+    /**
+     * The /output argument.
+     */
+    private File out;
+
+    /**
+     * The /err argument.
+     */
+    private File err;
+
+    /**
+     * The /xml argument.
+     */
+    private File xmlOut;
+
+    /**
+     * The /transform argument.
+     */
+    private File transform;
+
+    /**
+     * The /thread argument.
+     */
+    private boolean thread = false;
+
+    /**
+     * The /fixture argument.
+     */
+    private String fixture;
+
+    /**
+     * Categories to include.
+     */
+    private ArrayList includes = new ArrayList();
+
+    /**
+     * Categories to exclude.
+     */
+    private ArrayList excludes = new ArrayList();
+
+    /**
+     * The /noshadow argument.
+     */
+    private boolean noshadow = false;
+
+    /**
+     * The /labels argument.
+     */
+    private boolean labels = false;
+
+    /**
+     * Redirects everything that NUnit wants to send to the console.
+     */
+    private RedirectorElement redirectorElement;
+
+    /**
+     * Whether a failure should stop the build.
+     */
+    private boolean failOnError = false;
+
+    /**
+     * Support for nested environment variables.
+     */
+    private Environment env = new Environment();
+
+    public NUnitTask() {
+        super();
+    }
+
+    /**
+     * Set the name of the executable for the virtual machine.
+     *
+     * @param value the name of the executable for the virtual machine
+     */
+    public void setVm(String value) {
+        this.vm = value;
+    }
+
+    /**
+     * Sets the name of the config file.
+     */
+    public void setConfig(File c) {
+        configFile = c;
+    }
+
+    /**
+     * The /output argument.
+     */
+    public void setOut(File out) {
+        this.out = out;
+    }
+
+    /**
+     * The /err argument.
+     */
+    public void setError(File err) {
+        this.err = err;
+    }
+
+    /**
+     * The /xml argument.
+     */
+    public void setXmlOut(File out) {
+        this.xmlOut = out;
+    }
+
+    /**
+     * The /transform argument.
+     */
+    public void setTransform(File transform) {
+        this.transform = transform;
+    }
+
+    /**
+     * The /thread argument.
+     */
+    public void setThread(boolean thread) {
+        this.thread = thread;
+    }
+
+    /**
+     * The /fixture argument.
+     */
+    public void setFixture(String fixture) {
+        this.fixture = fixture;
+    }
+
+    /**
+     * The /noshadow argument.
+     */
+    public void setNoshadow(boolean noshadow) {
+        this.noshadow = noshadow;
+    }
+
+    /**
+     * The /labels argument.
+     */
+    public void setLabels(boolean labels) {
+        this.labels = labels;
+    }
+
+    /**
+     * Whether a failure should stop the build.
+     */
+    public void setFailOnError(boolean b) {
+        failOnError = b;
+    }
+
+    /**
+     * Adds a test assembly by name.
+     */
+    public void addTestAssembly(NamedElement a) {
+        testAssemblies.add(a);
+    }
+
+    /**
+     * Adds a category to the include list.
+     */
+    public void addInclude(NamedElement a) {
+        includes.add(a);
+    }
+
+    /**
+     * Adds a category to the exclude list.
+     */
+    public void addExclude(NamedElement a) {
+        excludes.add(a);
+    }
+
+    /**
+     * Add an environment variable to the launched process.
+     *
+     * @param var new environment variable
+     */
+    public void addEnv(Environment.Variable var) {
+        env.addVariable(var);
+    }
+
+    /**
+     * Add a <code>RedirectorElement</code> to this task.
+     *
+     * <p>This does not use the <code>out</code> and
+     * <code>error</code> attributes, it only captures NUnits output
+     * that has not been redirected by those attributes.</p>
+     */
+    public void addConfiguredRedirector(RedirectorElement redirectorElement) {
+        if (this.redirectorElement != null) {
+            throw new BuildException("cannot have > 1 nested <redirector>s");
+        } else {
+            this.redirectorElement = redirectorElement;
+        }
+    }
+
+    public void execute() {
+        if (testAssemblies.size() == 0) {
+            throw new BuildException("You must specify at least one test "
+                                     + "assembly.");
+        }
+        
+        DotNetExecTask exec = DotNetExecTask.getTask(this, vm, 
+                                                     "nunit-console.exe",
+                                                     env);
+        Iterator iter = testAssemblies.iterator();
+        while (iter.hasNext()) {
+            NamedElement a = (NamedElement) iter.next();
+            exec.createArg().setValue(a.getName());
+        }
+        if (configFile != null) {
+            exec.createArg().setValue("/config=" 
+                                      + configFile.getAbsolutePath());
+        }
+        exec.createArg().setValue("/nologo");
+
+        if (out != null) {
+            exec.createArg().setValue("/output=" + out.getAbsolutePath());
+        }
+        if (err != null) {
+            exec.createArg().setValue("/err=" + err.getAbsolutePath());
+        }
+        if (xmlOut != null) {
+            exec.createArg().setValue("/xml=" + xmlOut.getAbsolutePath());
+        }
+        if (transform != null) {
+            exec.createArg().setValue("/transform=" 
+                                      + transform.getAbsolutePath());
+        }
+
+        if (thread) {
+            exec.createArg().setValue("/thread");
+        }
+        if (noshadow) {
+            exec.createArg().setValue("/noshadow");
+        }
+        if (labels) {
+            exec.createArg().setValue("/labels");
+        }
+        if (fixture != null) {
+            exec.createArg().setValue("/fixture=" + fixture);
+        }
+        
+        if (includes.size() > 0) {
+            StringBuffer sb = new StringBuffer("/include=");
+            iter = includes.iterator();
+            boolean first = false;
+            while (iter.hasNext()) {
+                if (first) {
+                    first = false;
+                } else {
+                    sb.append(",");
+                }
+                NamedElement a = (NamedElement) iter.next();
+                sb.append(a.getName());
+            }
+            exec.createArg().setValue(sb.toString());
+        }
+        if (excludes.size() > 0) {
+            StringBuffer sb = new StringBuffer("/exclude=");
+            iter = excludes.iterator();
+            boolean first = false;
+            while (iter.hasNext()) {
+                if (first) {
+                    first = false;
+                } else {
+                    sb.append(",");
+                }
+                NamedElement a = (NamedElement) iter.next();
+                sb.append(a.getName());
+            }
+            exec.createArg().setValue(sb.toString());
+        }
+
+        if (redirectorElement != null) {
+            exec.addConfiguredRedirector(redirectorElement);
+        }
+        exec.setFailonerror(failOnError);
+
+        exec.execute();
+    }
+
+    public static class NamedElement {
+        private String name;
+        public String getName() {return name;}
+        public void setName(String s) {name = s;}
+    }
+}
\ No newline at end of file

Propchange: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NUnitTask.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/WixTask.java
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/WixTask.java?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/WixTask.java (added)
+++ ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/WixTask.java Fri Apr 15 07:32:50 2005
@@ -0,0 +1,296 @@
+/*
+ * Copyright  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.
+ *
+ */
+
+package org.apache.tools.ant.taskdefs.optional.dotnet;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.EnumeratedAttribute;
+import org.apache.tools.ant.types.FileSet;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Task to run the WiX utility to create MSI files from an XML description.
+ *
+ * @see http://sf.net/projects/wix
+ */
+public class WixTask extends Task {
+
+    /**
+     * The vm attribute - if given.
+     */
+    private String vm;
+
+    /**
+     * The source files.
+     */
+    private ArrayList sources = new ArrayList();
+
+    /**
+     * Additional source files (include files in the case of candle,
+     * or media/files/whatever in the case of light).
+     */
+    private ArrayList moreSources = new ArrayList();
+
+    /**
+     * A single source file.
+     */
+    private File source;
+
+    /**
+     * The target file.
+     */
+    private File target;
+
+    /**
+     * What to do.
+     */
+    private Mode mode;
+
+    public WixTask() {
+        super();
+    }
+
+    /**
+     * Set the name of the executable for the virtual machine.
+     *
+     * @param value the name of the executable for the virtual machine
+     */
+    public void setVm(String value) {
+        this.vm = value;
+    }
+
+    /**
+     * The main source file.
+     *
+     * <p><code>candle</code> may include more files than this one,
+     * the main source is the one passed on the command line.</p>
+     *
+     * @param File object of the main source file.
+     */
+    public void setSource(File f) {
+        source = f;
+    }
+
+    /**
+     * A set of source files.
+     */
+    public void addSources(FileSet fs) {
+        sources.add(fs);
+    }
+
+    /**
+     * A set of additional source files (include files in the case of
+     * candle, or media/files/whatever in the case of light).
+     *
+     * <p>Unlike the files specified as sources, these will not be
+     * passed on the command line, they only help Ant to determine
+     * whether the target is out-of-date.</p>
+     */
+    public void addMoreSources(FileSet fs) {
+        moreSources.add(fs);
+    }
+
+    public void execute() {
+        if (source == null && sources.size() == 0) {
+            throw new BuildException("You must specify at least one source"
+                                     + " file.");
+        }
+        String m = Mode.BOTH;
+        if (mode != null) {
+            m = mode.getValue();
+        }
+
+        if (target == null && !m.equals(Mode.CANDLE)) {
+            throw new BuildException("You must specify the target if you want"
+                                     + " to run light.");
+        }
+
+        List lightSources = new ArrayList();
+        if (!m.equals(Mode.LIGHT)) {
+            doCandle(lightSources);
+        } else {
+            if (source != null) {
+                lightSources.add(source);
+            }
+            if (sources.size() > 0) {
+                lightSources.addAll(grabFiles(sources));
+            }
+        }
+        List moreLightSources = new ArrayList();
+        if (moreSources.size() > 0) {
+            moreLightSources = grabFiles(moreSources);
+        }
+        if (!m.equals(Mode.CANDLE)) {
+            doLight(lightSources, moreLightSources);
+        }
+    }
+
+    /**
+     * Invoke candle on all sources that are newer than their targets.
+     *
+     * @param lightSources list that will be filled with File objects
+     * pointing to the generated object files.
+     */
+    private void doCandle(List lightSources) {
+        List s = new ArrayList();
+        if (source != null) {
+            s.add(source);
+        }
+        if (sources != null) {
+            s.addAll(grabFiles(sources));
+        }
+        List ms = new ArrayList();
+        if (moreSources != null) {
+            ms.addAll(grabFiles(moreSources));
+        }
+        Iterator iter = s.iterator();
+        List toProcess = new ArrayList();
+        while (iter.hasNext()) {
+            File thisSource = (File) iter.next();
+            File t = target;
+            if (t == null) {
+                t = getTarget(thisSource);
+            }
+            if (isOutOfDate(t, thisSource, ms)) {
+                toProcess.add(thisSource);
+                lightSources.add(t);
+            }
+        }
+        if (toProcess.size() != 0) {
+            runCandle(toProcess);
+        }
+    }
+
+    /**
+     * Invoke light on all sources that are newer than their targets.
+     */
+    private void doLight(List lightSources, List moreLightSources) {
+        List tmp = new ArrayList(lightSources);
+        tmp.addAll(moreLightSources);
+        if (isOutOfDate(target, tmp)) {
+            runLight(lightSources);
+        }
+    }
+
+    /**
+     * Run candle passing all files in list on the command line.
+     */
+    private void runCandle(List s) {
+        run("candle.exe", s, null);
+    }
+
+    /**
+     * Run light passing all files in list on the command line.
+     */
+    private void runLight(List s) {
+        run("light.exe", s, target);
+    }
+
+    /**
+     * Runs the specified command passing list on the command line an
+     * potentially adding an /out parameter.
+     */
+    private void run(String executable, List s, File target) {
+        DotNetExecTask exec = DotNetExecTask.getTask(this, vm, 
+                                                     executable, null);
+        Iterator iter = s.iterator();
+        while (iter.hasNext()) {
+            File f = (File) iter.next();
+            exec.createArg().setValue(f.getAbsolutePath());
+        }
+        if (target != null) {
+            exec.createArg().setValue("/out");
+            exec.createArg().setValue(target.getAbsolutePath());
+        }
+        
+        exec.execute();
+    }
+
+    /**
+     * Is t older than s or any of the files in list?
+     */
+    private boolean isOutOfDate(File t, File s, List l) {
+        return t.lastModified() < s.lastModified() || isOutOfDate(t, l);
+    }
+
+    /**
+     * Is t older than any of the files in list?
+     */
+    private boolean isOutOfDate(File t, List l) {
+        Iterator iter = l.iterator();
+        while (iter.hasNext()) {
+            File f = (File) iter.next();
+            if (t.lastModified() < f.lastModified()) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Turn the fileset collection into a list of Files.
+     */
+    private List grabFiles(List s) {
+        List r = new ArrayList();
+        Iterator iter = s.iterator();
+        while (iter.hasNext()) {
+            FileSet fs = (FileSet) iter.next();
+            DirectoryScanner ds = fs.getDirectoryScanner(getProject());
+            String[] f = ds.getIncludedFiles();
+            File base = fs.getDir(getProject());
+            for (int i = 0; i < f.length; i++) {
+                r.add(new File(base, f[i]));
+            }
+        }
+        return r;
+    }
+
+    /**
+     * Generates the name of a candle target from the source file.
+     *
+     * <p>Simply chops of the extension and adds .wixobj.</p>
+     */
+    private File getTarget(File s) {
+        String name = s.getAbsolutePath();
+        int dot = name.lastIndexOf(".");
+        if (dot > -1) {
+            return new File(name.substring(0, dot) + ".wixobj");
+        } else {
+            return new File(name + ".wixobj");
+        }
+    }
+
+    public static class Mode extends EnumeratedAttribute {
+        private final static String CANDLE = "candle";
+        private final static String LIGHT = "light";
+        private final static String BOTH = "both";
+
+        public Mode() {
+            super();
+        }
+
+        public String[] getValues() {
+            return new String[] {CANDLE, LIGHT, BOTH,};
+        }
+    }
+}
\ No newline at end of file

Propchange: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/WixTask.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/antlib.xml
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/antlib.xml?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/antlib.xml (added)
+++ ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/antlib.xml Fri Apr 15 07:32:50 2005
@@ -0,0 +1,38 @@
+<?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.
+-->
+<antlib>
+  <taskdef
+    name="dotnetexec"
+    classname="org.apache.tools.ant.taskdefs.optional.dotnet.DotNetExecTask"
+    />
+  <taskdef
+    name="msbuild"
+    classname="org.apache.tools.ant.taskdefs.optional.dotnet.MSBuildTask"
+    />
+  <taskdef
+    name="nant"
+    classname="org.apache.tools.ant.taskdefs.optional.dotnet.NAntTask"
+    />
+  <taskdef
+    name="wix"
+    classname="org.apache.tools.ant.taskdefs.optional.dotnet.WixTask"
+    />
+  <taskdef
+    name="nunit"
+    classname="org.apache.tools.ant.taskdefs.optional.dotnet.NUnitTask"
+    />
+</antlib>

Propchange: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/antlib.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/util/XMLFragment.java
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/util/XMLFragment.java?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/util/XMLFragment.java (added)
+++ ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/util/XMLFragment.java Fri Apr 15 07:32:50 2005
@@ -0,0 +1,131 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.tools.ant.util;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DynamicConfiguratorNS;
+import org.apache.tools.ant.ProjectHelper;
+
+/**
+ * Use this class as a nested element if you want to get a literal DOM
+ * fragment of something nested into your task/type.
+ *
+ * <p>This is useful for tasks that want to deal with the "real" XML
+ * from the build file instead of objects.</p>
+ *
+ * <p>Code heavily influenced by code written by Dominique Devienne.</p>
+ *
+ * @since Ant 1.7
+ */
+public class XMLFragment implements DynamicConfiguratorNS {
+
+    private Document doc;
+    private DocumentFragment fragment;
+
+    public XMLFragment() {
+        doc = JAXPUtils.getDocumentBuilder().newDocument();
+        fragment = doc.createDocumentFragment();
+    }
+
+    /**
+     * Return the DocumentFragment that corresponds to the nested
+     * structure.
+     */
+    public DocumentFragment getFragment() {
+        return fragment;
+    }
+
+    /**
+     * Add nested text.
+     */
+    public void addText(String s) {
+        addText(fragment, s);
+    }
+
+    /**
+     * No attributes for the wrapping element.
+     */
+    public void setDynamicAttribute(String uri, String name, String qName, String value)
+        throws BuildException {
+        throw new BuildException("Attribute " + name + " is not supported.");
+    }
+
+    /**
+     * Creates a nested element.
+     */
+    public Object createDynamicElement(String uri, String name, String qName) {
+        Element e = doc.createElementNS(uri, qName);
+        fragment.appendChild(e);
+        return new Child(e);
+    }
+
+    private void addText(Node n, String s) {
+        if (s != null && !s.trim().equals("")) {
+            Text t = doc.createTextNode(s);
+            n.appendChild(t);
+        }
+    }
+
+    public class Child implements DynamicConfiguratorNS {
+        private Element e;
+
+        Child(Element e) {
+            this.e = e;
+        }
+
+        /**
+         * Add nested text.
+         */
+        public void addText(String s) {
+            XMLFragment.this.addText(e, s);
+        }
+
+        /**
+         * Sets the attribute
+         */
+        public void setDynamicAttribute(
+            String uri, String name, String qName, String value) {
+            if (uri.equals("")) {
+                e.setAttribute(name, value);
+            } else {
+                e.setAttributeNS(uri, qName, value);
+            }
+        }
+
+        /**
+         * Creates a nested element.
+         */
+        public Object createDynamicElement(String uri, String name, String qName) {
+            Element e2 = null;
+            if (uri.equals("")) {
+                e2 = doc.createElement(name);
+            } else {
+                e2 = doc.createElementNS(uri, qName);
+            }
+            e.appendChild(e2);
+            return new Child(e2);
+        }
+    }
+
+}

Propchange: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/tools/ant/util/XMLFragment.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/DotNetExecTaskTest.java
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/DotNetExecTaskTest.java?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/DotNetExecTaskTest.java (added)
+++ ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/DotNetExecTaskTest.java Fri Apr 15 07:32:50 2005
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ *
+ */
+package org.apache.tools.ant.taskdefs.optional.dotnet;
+
+import org.apache.tools.ant.BuildFileTest;
+
+/**
+ * Tests the DotNetExecTask task, based off Ant's DotnetTest.
+ *
+ */
+public class DotNetExecTaskTest extends BuildFileTest {
+
+    /**
+     * Description of the Field
+     */
+    private final static String TASKDEFS_DIR = "src/etc/testcases/";
+
+
+    /**
+     * Constructor 
+     *
+     * @param name testname
+     */
+    public DotNetExecTaskTest(String name) {
+        super(name);
+    }
+
+
+    /**
+     * The JUnit setup method
+     */
+    public void setUp() {
+        configureProject(TASKDEFS_DIR + "dotnetexec.xml");
+    }
+
+
+    /**
+     * The teardown method for JUnit
+     */
+    public void tearDown() {
+        executeTarget("teardown");
+    }
+
+
+    /**
+     * A unit test for JUnit
+     */
+    public void testCSC() throws Exception {
+        executeTarget("testCSC");
+    }
+}

Propchange: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/DotNetExecTaskTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/MSBuildTaskTest.java
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/MSBuildTaskTest.java?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/MSBuildTaskTest.java (added)
+++ ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/MSBuildTaskTest.java Fri Apr 15 07:32:50 2005
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ *
+ */
+package org.apache.tools.ant.taskdefs.optional.dotnet;
+
+import org.apache.tools.ant.BuildFileTest;
+
+/**
+ * Tests the MSBuildTask task.
+ */
+public class MSBuildTaskTest extends BuildFileTest {
+
+    /**
+     * Description of the Field
+     */
+    private final static String TASKDEFS_DIR = "src/etc/testcases/";
+
+    /**
+     * Constructor 
+     *
+     * @param name testname
+     */
+    public MSBuildTaskTest(String name) {
+        super(name);
+    }
+
+    /**
+     * The JUnit setup method
+     */
+    public void setUp() {
+        configureProject(TASKDEFS_DIR + "msbuild.xml");
+    }
+
+    public void testEcho() throws Exception {
+        if (getProject().getProperty("msbuild.found") != null) {
+            expectLogContaining("echo", "foo is bar");
+        }
+    }
+
+    public void testNestedFile() throws Exception {
+        if (getProject().getProperty("msbuild.found") != null) {
+            expectLogContaining("nested-file", "foo is bar");
+        }
+    }
+
+    public void testNestedTask() throws Exception {
+        if (getProject().getProperty("msbuild.found") != null) {
+            expectLogContaining("nested-task", "foo is bar");
+        }
+    }
+}

Propchange: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/MSBuildTaskTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/NAntTaskTest.java
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/NAntTaskTest.java?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/NAntTaskTest.java (added)
+++ ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/NAntTaskTest.java Fri Apr 15 07:32:50 2005
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ *
+ */
+package org.apache.tools.ant.taskdefs.optional.dotnet;
+
+import org.apache.tools.ant.BuildFileTest;
+
+/**
+ * Tests the NAntTask task.
+ */
+public class NAntTaskTest extends BuildFileTest {
+
+    /**
+     * Description of the Field
+     */
+    private final static String TASKDEFS_DIR = "src/etc/testcases/";
+
+    /**
+     * Constructor 
+     *
+     * @param name testname
+     */
+    public NAntTaskTest(String name) {
+        super(name);
+    }
+
+    /**
+     * The JUnit setup method
+     */
+    public void setUp() {
+        configureProject(TASKDEFS_DIR + "nant.xml");
+    }
+
+    public void testEcho() throws Exception {
+        if (getProject().getProperty("nant.found") != null) {
+            expectLogContaining("echo", "foo is bar");
+        }
+    }
+
+    public void testNestedFile() throws Exception {
+        if (getProject().getProperty("nant.found") != null) {
+            expectLogContaining("nested-file", "foo is bar");
+        }
+    }
+
+    public void testNestedTask() throws Exception {
+        if (getProject().getProperty("nant.found") != null) {
+            expectLogContaining("nested-task", "foo is bar");
+        }
+    }
+}

Propchange: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/NAntTaskTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/NUnitTaskTest.java
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/NUnitTaskTest.java?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/NUnitTaskTest.java (added)
+++ ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/NUnitTaskTest.java Fri Apr 15 07:32:50 2005
@@ -0,0 +1,79 @@
+/*
+ * Copyright  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.
+ *
+ */
+package org.apache.tools.ant.taskdefs.optional.dotnet;
+
+import org.apache.tools.ant.BuildFileTest;
+
+/**
+ * Tests the NUnitTask task.
+ */
+public class NUnitTaskTest extends BuildFileTest {
+
+    /**
+     * Description of the Field
+     */
+    private final static String TASKDEFS_DIR = "src/etc/testcases/";
+
+    /**
+     * Constructor 
+     *
+     * @param name testname
+     */
+    public NUnitTaskTest(String name) {
+        super(name);
+    }
+
+    /**
+     * The JUnit setup method
+     */
+    public void setUp() {
+        configureProject(TASKDEFS_DIR + "nunit.xml");
+    }
+
+    /**
+     * The teardown method for JUnit
+     */
+    public void tearDown() {
+        executeTarget("teardown");
+    }
+
+    public void testNoAssembly() {
+        expectSpecificBuildException("no-assembly", "no assembly", 
+                                     "You must specify at least one test assembly.");
+    }
+
+    public void testPass() {
+        if (getProject().getProperty("nunit.found") != null) {
+            expectLogContaining("passing-test", 
+                                "Tests run: 1, Failures: 0, Not run: 0");
+        }
+    }
+
+    public void testFail() {
+        if (getProject().getProperty("nunit.found") != null) {
+            expectLogContaining("failing-test", 
+                                "Tests run: 1, Failures: 1, Not run: 0");
+        }
+    }
+
+    public void testFailOnFail() {
+        if (getProject().getProperty("nunit.found") != null) {
+            expectBuildException("failing-test-with-fail", "test should fail");
+        }
+    }
+
+}

Propchange: ant/sandbox/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/tools/ant/taskdefs/optional/dotnet/NUnitTaskTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/dotnet/trunk/README
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/trunk/README?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/trunk/README (added)
+++ ant/sandbox/antlibs/dotnet/trunk/README Fri Apr 15 07:32:50 2005
@@ -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.

Propchange: ant/sandbox/antlibs/dotnet/trunk/README
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/dotnet/trunk/build.xml
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/trunk/build.xml?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/trunk/build.xml (added)
+++ ant/sandbox/antlibs/dotnet/trunk/build.xml Fri Apr 15 07:32:50 2005
@@ -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>
\ No newline at end of file

Propchange: ant/sandbox/antlibs/dotnet/trunk/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/dotnet/trunk/docs/dotnetexec.html
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/trunk/docs/dotnetexec.html?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/trunk/docs/dotnetexec.html (added)
+++ ant/sandbox/antlibs/dotnet/trunk/docs/dotnetexec.html Fri Apr 15 07:32:50 2005
@@ -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>
\ No newline at end of file

Propchange: ant/sandbox/antlibs/dotnet/trunk/docs/dotnetexec.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/dotnet/trunk/docs/index.html
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/trunk/docs/index.html?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/trunk/docs/index.html (added)
+++ ant/sandbox/antlibs/dotnet/trunk/docs/index.html Fri Apr 15 07:32:50 2005
@@ -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>

Propchange: ant/sandbox/antlibs/dotnet/trunk/docs/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/dotnet/trunk/docs/msbuild.html
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/trunk/docs/msbuild.html?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/trunk/docs/msbuild.html (added)
+++ ant/sandbox/antlibs/dotnet/trunk/docs/msbuild.html Fri Apr 15 07:32:50 2005
@@ -0,0 +1,109 @@
+<html>
+  <head>
+    <meta http-equiv="Content-Language" content="en-us"></meta>
+    <title>MSBuild Task</title>
+  </head>
+
+  <body>
+    <h2><a name="dotnetexec">MSBuild</a></h2>
+
+    <h3>Description</h3>
+
+    <p>Runs the MSBuild build tool presented at the 2003 PDC.  This
+    task is completely untested as the developers have no access to
+    the tool, it has been implemented by looking at the docs only.</p>
+
+    <p>You can either use an existing build file or nest a build file
+    (snippet) as a child into the task.  If you don't specify either,
+    MSBuild's default build file search algorithm will apply.</p>
+
+    <h3>Parameters</h3>
+    <table border="1" cellpadding="2" cellspacing="0">
+      <tr>
+        <td valign="top"><b>Attribute</b></td>
+        <td valign="top"><b>Description</b></td>
+        <td align="center" valign="top"><b>Required</b></td>
+      </tr>
+      <tr>
+        <td valign="top">buildfile</td>
+        <td valign="top">External build file to invoke MSBuild on.</td>
+        <td align="center">No.</td>
+      </tr>
+      <tr>
+        <td valign="top">vm</td>
+        <td valign="top">Same as <a
+            href="dotnetexec.html">dotnetexec</a>'s vm attribute.
+          Specify the framework to use.</td>
+        <td align="center">No.</td>
+      </tr>
+    </table>
+
+    <h3>Parameters specified as nested elements</h3>
+    <h4>target</h4>
+
+    <p><code>target</code> has a single required attribute name -
+    specifies a target to be run.</p>
+
+    <h4>property</h4>
+
+    <p><code>property</code> has two required attributes.  name and
+    value that specify name and value of a property that is to be
+    defined in the MSBuild invocation.</p>
+
+    <h4>build</h4>
+
+    <p>This element allows no attributes.  You can nest a MSBuild build
+    file into it and MSBuild will be executed on that.  You can also nest
+    a build file snippet instead and Ant will wrap the necessary MSBuild
+    <code>&lt;Project&gt; around it.</code></p>
+
+    <h3>Examples</h3>
+
+    <p>Let MSBuild search for a *.proj file in the (Ant) project's base
+    directory and execute the default target in it:</p>
+
+    <pre>&lt;msbuild/&gt;</pre>
+    
+    <p>Let MSBuild execute the targets named foo and bar in the build
+    file msbuild.proj in Ant's basedir and pass the property
+    <code>/property:test=testvalue</code> to it:</p>
+
+    <pre>
+      &lt;msbuild buildfile="msbuild.proj"&gt;
+        &lt;target name="foo"/&gt;
+        &lt;target name="bar"/&gt;
+        &lt;property name="test" value="testvalue"/&gt;
+      &lt;/msbuild&gt;
+    </pre>
+
+    <p>Define a build file embeded into the task, let MSBuild execute the
+    echo target of that build file.</p>
+
+    <pre>
+      &lt;msbuild&gt;
+        &lt;target name="echo"&gt;
+        &lt;build&gt;
+          &lt;Project DefaultTargets="empty"&gt;
+            &lt;Target Name="empty"/&gt;
+            &lt;Target Name="echo"&gt;
+              &lt;Task Name="Echo" Message="This is MSBuild"/&gt;
+            &lt;/Target&gt;
+          &lt;/Project&gt;
+        &lt;/build&gt;
+      &lt;/msbuild&gt;
+    </pre>
+
+    <p>Run MSBuild's Echo task (if there actually is one):</p>
+
+    <pre>
+      &lt;msbuild&gt;
+        &lt;build&gt;
+          &lt;Task Name="Echo" Message="This is MSBuild"/&gt;
+        &lt;/build&gt;
+      &lt;/msbuild&gt;
+    </pre>
+
+    <hr/>
+      <p align="center">Copyright &copy; 2003-2004 The Apache Software Foundation. All rights Reserved.</p>
+  </body>
+</html>
\ No newline at end of file

Propchange: ant/sandbox/antlibs/dotnet/trunk/docs/msbuild.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/sandbox/antlibs/dotnet/trunk/docs/nant.html
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/dotnet/trunk/docs/nant.html?view=auto&rev=161469
==============================================================================
--- ant/sandbox/antlibs/dotnet/trunk/docs/nant.html (added)
+++ ant/sandbox/antlibs/dotnet/trunk/docs/nant.html Fri Apr 15 07:32:50 2005
@@ -0,0 +1,108 @@
+<html>
+  <head>
+    <meta http-equiv="Content-Language" content="en-us"></meta>
+    <title>NAnt Task</title>
+  </head>
+
+  <body>
+    <h2><a name="dotnetexec">NAnt</a></h2>
+
+    <h3>Description</h3>
+
+    <p>Runs the <a href="http://nant.sourceforge.net/">NAnt</a> build
+    tool.</p>
+
+    <p>You can either use an existing build file or nest a build file
+    (snippet) as a child into the task.  If you don't specify either,
+    NAnt's default build file search algorithm will apply.</p>
+
+    <h3>Parameters</h3>
+    <table border="1" cellpadding="2" cellspacing="0">
+      <tr>
+        <td valign="top"><b>Attribute</b></td>
+        <td valign="top"><b>Description</b></td>
+        <td align="center" valign="top"><b>Required</b></td>
+      </tr>
+      <tr>
+        <td valign="top">buildfile</td>
+        <td valign="top">External build file to invoke NAnt on.</td>
+        <td align="center">No.</td>
+      </tr>
+      <tr>
+        <td valign="top">vm</td>
+        <td valign="top">Same as <a
+            href="dotnetexec.html">dotnetexec</a>'s vm attribute.
+          Specify the framework to use.</td>
+        <td align="center">No.</td>
+      </tr>
+    </table>
+
+    <h3>Parameters specified as nested elements</h3>
+    <h4>target</h4>
+
+    <p><code>target</code> has a single required attribute name -
+    specifies a target to be run.</p>
+
+    <h4>property</h4>
+
+    <p><code>property</code> has two required attributes.  name and
+    value that specify name and value of a property that is to be
+    defined in the NAnt invocation.</p>
+
+    <h4>build</h4>
+
+    <p>This element allows no attributes.  You can nest a NAnt build
+    file into it and NAnt will be executed on that.  You can also nest
+    a build file snippet instead and Ant will wrap the necessary NAnt
+    <code>&lt;project&gt; around it.</code></p>
+
+    <h3>Examples</h3>
+
+    <p>Let NAnt search for a *.build file in the (Ant) project's base
+    directory and execute the default target in it:</p>
+
+    <pre>&lt;nant/&gt;</pre>
+    
+    <p>Let NAnt execute the targets named foo and bar in the build
+    file nant.build in Ant's basedir and pass the property
+    <code>-D:test=testvalue</code> to it:</p>
+
+    <pre>
+      &lt;nant buildfile="nant.build"&gt;
+        &lt;target name="foo"/&gt;
+        &lt;target name="bar"/&gt;
+        &lt;property name="test" value="testvalue"/&gt;
+      &lt;/nant&gt;
+    </pre>
+
+    <p>Define a build file embeded into the task, let NAnt execute the
+    echo target of that build file.</p>
+
+    <pre>
+      &lt;nant&gt;
+        &lt;target name="echo"&gt;
+        &lt;build&gt;
+          &lt;project basedir="." default="empty"&gt;
+            &lt;target name="empty"/&gt;
+            &lt;target name="echo"&gt;
+              &lt;echo message="this is NAnt"/&gt;
+            &lt;/target&gt;
+          &lt;/project&gt;
+        &lt;/build&gt;
+      &lt;/nant&gt;
+    </pre>
+
+    <p>Run NAnt's echo task:</p>
+
+    <pre>
+      &lt;nant&gt;
+        &lt;build&gt;
+          &lt;echo message="this is NAnt"/&gt;
+        &lt;/build&gt;
+      &lt;/nant&gt;
+    </pre>
+
+    <hr/>
+      <p align="center">Copyright &copy; 2003-2004 The Apache Software Foundation. All rights Reserved.</p>
+  </body>
+</html>
\ No newline at end of file

Propchange: ant/sandbox/antlibs/dotnet/trunk/docs/nant.html
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message