Author: bodewig Date: Thu Dec 15 20:31:10 2005 New Revision: 357118 URL: http://svn.apache.org/viewcvs?rev=357118&view=rev Log: fix msbuild task
Added: ant/antlibs/dotnet/trunk/src/etc/testcases/augment-path.xml (with props) Modified: ant/antlibs/dotnet/trunk/docs/index.html ant/antlibs/dotnet/trunk/docs/msbuild.html ant/antlibs/dotnet/trunk/src/etc/testcases/dotnetexec.xml ant/antlibs/dotnet/trunk/src/etc/testcases/msbuild.xml ant/antlibs/dotnet/trunk/src/etc/testcases/nant.xml ant/antlibs/dotnet/trunk/src/etc/testcases/nunit.xml ant/antlibs/dotnet/trunk/src/etc/testcases/src/msbuild.proj ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/AbstractBuildTask.java ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/MSBuildTask.java Modified: ant/antlibs/dotnet/trunk/docs/index.html URL: http://svn.apache.org/viewcvs/ant/antlibs/dotnet/trunk/docs/index.html?rev=357118&r1=357117&r2=357118&view=diff ============================================================================== --- ant/antlibs/dotnet/trunk/docs/index.html (original) +++ ant/antlibs/dotnet/trunk/docs/index.html Thu Dec 15 20:31:10 2005 @@ -15,16 +15,15 @@ <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> + <p>The current version requires Ant 1.7 or at least a version + built from svn trunk no earlier than 2005-12-16.</p> <h2>Where is it?</h2> - <p>The source code for the library currently lives in the - developer sandbox in Ant's SVN - <a - href="http://svn.apache.org/viewcvs.cgi/ant/sandbox/antlibs/dotnet/trunk/">http://svn.apache.org/viewcvs.cgi/ant/sandbox/antlibs/dotnet/trunk/</a> + <p>The source code for the library lives in Ant's SVN - <a + href="http://svn.apache.org/repos/asf/ant/antlibs/dotnet/trunk/">http://svn.apache.org/repos/asf/ant/antlibs/dotnet/trunk/</a> A binary can be found at <a - href="http://people.apache.org/~bodewig/dotnet/dotnet.jar">http://cvs.apache.org/~bodewig/dotnet/dotnet.jar</a>. + href="http://people.apache.org/~bodewig/dotnet/ant-dotnet.jar">http://cvs.apache.org/~bodewig/dotnet/ant-dotnet.jar</a>. A zip file containing the docs is also <a href="http://people.apache.org/~bodewig/dotnet/docs.zip">available</a>.</p> @@ -32,15 +31,14 @@ <h2>Feedback</h2> - <p>Right now direct any feedback either directly to <a - href="mailto:[EMAIL PROTECTED]">me</a> or the <a + <p>Please direct any feedback to 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 + and you'll get a file <code>ant-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> @@ -51,7 +49,7 @@ <taskdef resource="org/apache/ant/dotnet/antlib.xml"> <classpath> - <pathelement location="YOUR-PATH-TO/dotnet.jar"/> + <pathelement location="YOUR-PATH-TO/ant-dotnet.jar"/> </classpath> </taskdef> </pre> @@ -68,7 +66,7 @@ uri="antlib:org.apache.ant.dotnet" resource="org/apache/ant/dotnet/antlib.xml"> <classpath> - <pathelement location="YOUR-PATH-TO/dotnet.jar"/> + <pathelement location="YOUR-PATH-TO/ant-dotnet.jar"/> </classpath> </taskdef> </pre> @@ -97,7 +95,7 @@ or a variation thereof. </li> - <li>Using Ant's autodiscovery. Place <code>dotnet.jar</code> + <li>Using Ant's autodiscovery. Place <code>ant-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 @@ -127,7 +125,7 @@ tool.</li> <li><a href="msbuild.html">msbuild</a> - execute the MSBuild build - tool, untested.</li> + tool of Microsoft's .NET framework 2.0.</li> <li><a href="wix.html">wix</a> - execute the WiX toolset, untested.</li> Modified: ant/antlibs/dotnet/trunk/docs/msbuild.html URL: http://svn.apache.org/viewcvs/ant/antlibs/dotnet/trunk/docs/msbuild.html?rev=357118&r1=357117&r2=357118&view=diff ============================================================================== --- ant/antlibs/dotnet/trunk/docs/msbuild.html (original) +++ ant/antlibs/dotnet/trunk/docs/msbuild.html Thu Dec 15 20:31:10 2005 @@ -9,9 +9,8 @@ <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>Runs the MSBuild build tool of Microsoft's .NET framework + 2.0.</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, @@ -83,27 +82,28 @@ <msbuild> <target name="echo"> <build> - <Project DefaultTargets="empty"> + <Project DefaultTargets="empty" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Target Name="empty"/> <Target Name="echo"> - <Task Name="Echo" Message="This is MSBuild"/> + <Message Text="This is MSBuild"/> </Target> </Project> </build> </msbuild> </pre> - <p>Run MSBuild's Echo task (if there actually is one):</p> + <p>Run MSBuild's Message task:</p> <pre> <msbuild> <build> - <Task Name="Echo" Message="This is MSBuild"/> + <Message Text="This is MSBuild" + xmlns="http://schemas.microsoft.com/developer/msbuild/2003"/> </build> </msbuild> </pre> <hr/> - <p align="center">Copyright © 2003-2004 The Apache Software Foundation. All rights Reserved.</p> + <p align="center">Copyright © 2003-2005 The Apache Software Foundation. All rights Reserved.</p> </body> </html> Added: ant/antlibs/dotnet/trunk/src/etc/testcases/augment-path.xml URL: http://svn.apache.org/viewcvs/ant/antlibs/dotnet/trunk/src/etc/testcases/augment-path.xml?rev=357118&view=auto ============================================================================== --- ant/antlibs/dotnet/trunk/src/etc/testcases/augment-path.xml (added) +++ ant/antlibs/dotnet/trunk/src/etc/testcases/augment-path.xml Thu Dec 15 20:31:10 2005 @@ -0,0 +1,27 @@ +<?xml version="1.0"?> +<!-- + Copyright 2005 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> + <property environment="env"/> + <path id="augmented-PATH"> + <pathelement location="${framework.path}"/> + <pathelement location="${nunit.path}"/> + <pathelement location="${nant.path}"/> + <pathelement path="${env.PATH}"/> + <pathelement path="${env.Path}"/> + </path> + <property name="augmented.PATH" refid="augmented-PATH"/> +</project> \ No newline at end of file Propchange: ant/antlibs/dotnet/trunk/src/etc/testcases/augment-path.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ant/antlibs/dotnet/trunk/src/etc/testcases/augment-path.xml ------------------------------------------------------------------------------ svn:executable = * Modified: ant/antlibs/dotnet/trunk/src/etc/testcases/dotnetexec.xml URL: http://svn.apache.org/viewcvs/ant/antlibs/dotnet/trunk/src/etc/testcases/dotnetexec.xml?rev=357118&r1=357117&r2=357118&view=diff ============================================================================== --- ant/antlibs/dotnet/trunk/src/etc/testcases/dotnetexec.xml (original) +++ ant/antlibs/dotnet/trunk/src/etc/testcases/dotnetexec.xml Thu Dec 15 20:31:10 2005 @@ -18,7 +18,8 @@ <project name="dotnet" basedir="." default="testCSC" xmlns:dn="antlib:org.apache.ant.dotnet"> - <property environment="env"/> + <import file="augment-path.xml"/> + <property name="build.dir" location="build"/> <property name="src.dir" location="src"/> @@ -27,18 +28,18 @@ <property name="out.type" value="exe"/> <target name="probe_for_apps" > + <condition property="csc.found"> <or> - <available file="csc" filepath="${env.PATH}" /> - <available file="csc.exe" filepath="${env.PATH}" /> - <available file="csc.exe" filepath="${env.Path}" /> + <available file="csc" filepath="${augmented.PATH}"/> + <available file="csc.exe" filepath="${augmented.PATH}"/> </or> </condition> <echo> csc.found=${csc.found}</echo> <!-- Mono C# compiler --> <condition property="mcs.found"> - <available file="mcs" filepath="${env.PATH}" /> + <available file="mcs" filepath="${augmented.PATH}"/> </condition> <echo> mcs.found=${mcs.found}</echo> Modified: ant/antlibs/dotnet/trunk/src/etc/testcases/msbuild.xml URL: http://svn.apache.org/viewcvs/ant/antlibs/dotnet/trunk/src/etc/testcases/msbuild.xml?rev=357118&r1=357117&r2=357118&view=diff ============================================================================== --- ant/antlibs/dotnet/trunk/src/etc/testcases/msbuild.xml (original) +++ ant/antlibs/dotnet/trunk/src/etc/testcases/msbuild.xml Thu Dec 15 20:31:10 2005 @@ -17,49 +17,43 @@ <project name="msbuild" basedir="." default="echo" xmlns:dn="antlib:org.apache.ant.dotnet"> - <property environment="env"/> + <import file="augment-path.xml"/> <condition property="msbuild.found"> <or> - <available file="MSBuild.exe" filepath="${env.PATH}"/> - <available file="MSBuild.exe" filepath="${env.Path}"/> + <available file="MSBuild.exe" filepath="${augmented.PATH}"/> <available file="MSBuild.exe"/> </or> </condition> <target name="echo"> - <msbuild - buildfile="src/msbuild.proj" - xmlns="antlib:org.apache.ant.dotnet" - > - <target name="echo"/> - <property name="foo" value="bar"/> - </msbuild> + <dn:msbuild buildfile="src/msbuild.proj"> + <dn:target name="echo"/> + <dn:property name="foo" value="bar"/> + </dn:msbuild> </target> <target name="nested-file"> <property name="foo" value="bar"/> - <msbuild - xmlns="antlib:org.apache.ant.dotnet" - > - <build> - <Project DefaultTargets="echo"> + <dn:msbuild> + <dn:build> + <Project DefaultTargets="echo" + xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Target Name="echo"> - <Task Name="Echo" Message="foo is ${foo}"/> + <Message Text="foo is ${foo}"/> </Target> </Project> - </build> - </msbuild> + </dn:build> + </dn:msbuild> </target> <target name="nested-task"> <property name="foo" value="bar"/> - <msbuild - xmlns="antlib:org.apache.ant.dotnet" - > - <build> - <Task Name="Echo" Message="foo is ${foo}"/> - </build> - </msbuild> + <dn:msbuild> + <dn:build> + <Message Text="foo is ${foo}" + xmlns="http://schemas.microsoft.com/developer/msbuild/2003"/> + </dn:build> + </dn:msbuild> </target> </project> Modified: ant/antlibs/dotnet/trunk/src/etc/testcases/nant.xml URL: http://svn.apache.org/viewcvs/ant/antlibs/dotnet/trunk/src/etc/testcases/nant.xml?rev=357118&r1=357117&r2=357118&view=diff ============================================================================== --- ant/antlibs/dotnet/trunk/src/etc/testcases/nant.xml (original) +++ ant/antlibs/dotnet/trunk/src/etc/testcases/nant.xml Thu Dec 15 20:31:10 2005 @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. --> -<project name="nant" basedir="." default="echo" - xmlns:dn="antlib:org.apache.ant.dotnet"> +<project name="nant" basedir="." default="echo"> + + <import file="augment-path.xml"/> - <property environment="env"/> <condition property="nant.found"> <or> - <available file="NAnt.exe" filepath="${env.PATH}"/> - <available file="NAnt.exe" filepath="${env.Path}"/> + <available file="NAnt.exe" filepath="${augmented.PATH}"/> <available file="NAnt.exe"/> </or> </condition> Modified: ant/antlibs/dotnet/trunk/src/etc/testcases/nunit.xml URL: http://svn.apache.org/viewcvs/ant/antlibs/dotnet/trunk/src/etc/testcases/nunit.xml?rev=357118&r1=357117&r2=357118&view=diff ============================================================================== --- ant/antlibs/dotnet/trunk/src/etc/testcases/nunit.xml (original) +++ ant/antlibs/dotnet/trunk/src/etc/testcases/nunit.xml Thu Dec 15 20:31:10 2005 @@ -17,14 +17,15 @@ <project name="nunit" basedir="." default="echo" xmlns:dn="antlib:org.apache.ant.dotnet"> + <import file="augment-path.xml"/> + <property name="build.dir" value="build"/> <property name="src.dir" location="src"/> <property environment="env"/> <condition property="nunit.found"> <or> - <available file="nunit-console.exe" filepath="${env.PATH}"/> - <available file="nunit-console.exe" filepath="${env.Path}"/> + <available file="nunit-console.exe" filepath="${augmented.PATH}"/> <available file="nunit-console.exe"/> </or> </condition> Modified: ant/antlibs/dotnet/trunk/src/etc/testcases/src/msbuild.proj URL: http://svn.apache.org/viewcvs/ant/antlibs/dotnet/trunk/src/etc/testcases/src/msbuild.proj?rev=357118&r1=357117&r2=357118&view=diff ============================================================================== --- ant/antlibs/dotnet/trunk/src/etc/testcases/src/msbuild.proj (original) +++ ant/antlibs/dotnet/trunk/src/etc/testcases/src/msbuild.proj Thu Dec 15 20:31:10 2005 @@ -1,6 +1,6 @@ <?xml version="1.0"?> <!-- - Copyright 2003-2004 The Apache Software Foundation + Copyright 2003-2005 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. @@ -14,11 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. --> -<Project DefaultTargets="empty"> +<Project DefaultTargets="empty" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Target Name="empty"/> <Target Name="echo"> - <Task Name="Echo" Message="foo is ${foo}"/> + <Message Text="foo is $(foo)"/> </Target> </Project> Modified: ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/AbstractBuildTask.java URL: http://svn.apache.org/viewcvs/ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/AbstractBuildTask.java?rev=357118&r1=357117&r2=357118&view=diff ============================================================================== --- ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/AbstractBuildTask.java (original) +++ ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/AbstractBuildTask.java Thu Dec 15 20:31:10 2005 @@ -247,7 +247,11 @@ FileOutputStream out = null; try { out = new FileOutputStream(f); - (new DOMElementWriter()).write(e, out); + DOMElementWriter w = + new DOMElementWriter(true, + DOMElementWriter.XmlNamespacePolicy + .ONLY_QUALIFY_ELEMENTS); + w.write(e, out); } finally { if (out != null) { out.close(); Modified: ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/MSBuildTask.java URL: http://svn.apache.org/viewcvs/ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/MSBuildTask.java?rev=357118&r1=357117&r2=357118&view=diff ============================================================================== --- ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/MSBuildTask.java (original) +++ ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/MSBuildTask.java Thu Dec 15 20:31:10 2005 @@ -32,6 +32,9 @@ public class MSBuildTask extends AbstractBuildTask { private static final String TARGET = "generated-by-ant"; + private static final String ROOT = "Project"; + private static final String MSBUILD_NS = + "http://schemas.microsoft.com/developer/msbuild/2003"; public MSBuildTask() { super(); @@ -53,7 +56,7 @@ protected String[] getTargetArguments(List targets) { if (targets.size() > 0) { - StringBuffer sb = new StringBuffer("/targets:"); + StringBuffer sb = new StringBuffer("/target:"); Iterator iter = targets.iterator(); boolean first = true; while (iter.hasNext()) { @@ -102,13 +105,15 @@ NodeList nl = f.getChildNodes(); if (nl.getLength() == 1 && nl.item(0).getNodeType() == Node.ELEMENT_NODE - && nl.item(0).getNodeName().equals("Project")) { + && nl.item(0).getNodeName().equals(ROOT)) { return (Element) nl.item(0); } else { - Element p = f.getOwnerDocument().createElement("Project"); + Element p = f.getOwnerDocument().createElementNS(MSBUILD_NS, + ROOT); p.setAttribute("DefaultTargets", TARGET); - Element t = f.getOwnerDocument().createElement("Target"); + Element t = f.getOwnerDocument().createElementNS(MSBUILD_NS, + "Target"); t.setAttribute("Name", TARGET); p.appendChild(t); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]