ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r357119 - in /ant/antlibs/dotnet/branches/Ant_1.6.2_compatible: docs/ src/etc/testcases/ src/etc/testcases/src/ src/main/org/apache/ant/dotnet/ src/testcases/org/apache/ant/dotnet/
Date Fri, 16 Dec 2005 04:33:02 GMT
Author: bodewig
Date: Thu Dec 15 20:32:51 2005
New Revision: 357119

URL: http://svn.apache.org/viewcvs?rev=357119&view=rev
Log:
fix msbuild task

Modified:
    ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/docs/index.html
    ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/docs/msbuild.html
    ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/msbuild.xml
    ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/msbuild.proj
    ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/ant/dotnet/MSBuildTask.java
    ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/ant/dotnet/MSBuildTaskTest.java

Modified: ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/docs/index.html
URL: http://svn.apache.org/viewcvs/ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/docs/index.html?rev=357119&r1=357118&r2=357119&view=diff
==============================================================================
--- ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/docs/index.html (original)
+++ ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/docs/index.html Thu Dec 15 20:32:51 2005
@@ -15,32 +15,31 @@
 
     <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>This version requires Ant 1.6.2 or later.  If you are running
+    Ant 1.7 or later you may want to use the latest version of this
+    library instead.</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/branches/Ant_1.6.2_compatible/">http://svn.apache.org/repos/asf/ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/</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/1.6_compatible/ant-dotnet.jar">http://people.apache.org/~bodewig/dotnet/1.6_compatible/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>
+    href="http://people.apache.org/~bodewig/dotnet/1.6_compatible/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
+    <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 +50,7 @@
           &lt;taskdef 
             resource="org/apache/ant/dotnet/antlib.xml"&gt;
             &lt;classpath&gt;
-              &lt;pathelement location="YOUR-PATH-TO/dotnet.jar"/&gt;
+              &lt;pathelement location="YOUR-PATH-TO/ant-dotnet.jar"/&gt;
             &lt;/classpath&gt;
           &lt;/taskdef&gt;
         </pre>
@@ -68,7 +67,7 @@
             uri="antlib:org.apache.ant.dotnet"
             resource="org/apache/ant/dotnet/antlib.xml"&gt;
             &lt;classpath&gt;
-              &lt;pathelement location="YOUR-PATH-TO/dotnet.jar"/&gt;
+              &lt;pathelement location="YOUR-PATH-TO/ant-dotnet.jar"/&gt;
             &lt;/classpath&gt;
           &lt;/taskdef&gt;
         </pre>
@@ -97,7 +96,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 +126,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/branches/Ant_1.6.2_compatible/docs/msbuild.html
URL: http://svn.apache.org/viewcvs/ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/docs/msbuild.html?rev=357119&r1=357118&r2=357119&view=diff
==============================================================================
--- ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/docs/msbuild.html (original)
+++ ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/docs/msbuild.html Thu Dec 15 20:32:51
2005
@@ -9,13 +9,19 @@
 
     <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>
+    <p>Runs the MSBuild build tool of Microsoft's .NET framework
+    2.0.</p>
+
+    <p>Unlike the nant task, this task doesn't support nested build
+    files.  MSBuild requires a certain default namespace and there is
+    no easy way to write an XML file of that type within Ant 1.6.x -
+    without repeating code that is already present in Ant 1.7 or some
+    ugly hacks, that is.  Use the Ant 1.7+ version of this antlib and
+    Ant 1.7+ if you want nested build file snippets, alternatively use
+    the echo task to write the build file (see example below).</p>
+
+    <p>If you don't specify a build file, MSBuild's default build file
+    search algorithm will apply.</p>
 
     <h3>Parameters</h3>
     <table border="1" cellpadding="2" cellspacing="0">
@@ -50,13 +56,6 @@
     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
@@ -76,34 +75,24 @@
       &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>
+    <p>Define a build file embeded into an Ant build file, let MSBuild
+    execute the echo target of that build file.</p>
 
     <pre>
-      &lt;msbuild&gt;
-        &lt;build&gt;
-          &lt;Task Name="Echo" Message="This is MSBuild"/&gt;
-        &lt;/build&gt;
-      &lt;/msbuild&gt;
+      &lt;tempfile property="ms.proj" suffix=".proj"/&gt;
+      &lt;echo file="${ms.proj}"&gt;&lt;![CDATA[
+        &lt;Project DefaultTargets="echo" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
+          &lt;Target Name="echo"&gt;
+            &lt;Message Text="This is MSBuild"/&gt;
+          &lt;/Target&gt;
+        &lt;/Project&gt;]]&gt;&lt;/echo&gt;
+      &lt;msbuild buildfile="${ms.proj}"
+        xmlns="antlib:org.apache.ant.dotnet"
+        /&gt;
+      &lt;delete file="${ms.proj}"/&gt;
     </pre>
 
     <hr/>
-      <p align="center">Copyright &copy; 2003-2004 The Apache Software Foundation.
All rights Reserved.</p>
+      <p align="center">Copyright &copy; 2003-2005 The Apache Software Foundation.
All rights Reserved.</p>
   </body>
 </html>

Modified: ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/msbuild.xml
URL: http://svn.apache.org/viewcvs/ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/msbuild.xml?rev=357119&r1=357118&r2=357119&view=diff
==============================================================================
--- ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/msbuild.xml (original)
+++ ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/msbuild.xml Thu Dec
15 20:32:51 2005
@@ -38,28 +38,17 @@
 
   <target name="nested-file">
     <property name="foo" value="bar"/>
-    <msbuild 
+    <tempfile property="ms.proj" suffix=".proj"/>
+    <echo file="${ms.proj}"><![CDATA[
+<Project DefaultTargets="echo" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Target Name="echo">
+    <Message Text="foo is ${foo}"/>
+  </Target>
+</Project>]]></echo>
+    <msbuild buildfile="${ms.proj}"
       xmlns="antlib:org.apache.ant.dotnet"
-      >
-      <build>
-        <Project DefaultTargets="echo">
-          <Target Name="echo">
-            <Task Name="Echo" Message="foo is ${foo}"/>
-          </Target>
-        </Project>
-      </build>
-    </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>
+      />
+    <delete file="${ms.proj}"/>
   </target>
 
 </project>

Modified: ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/msbuild.proj
URL: http://svn.apache.org/viewcvs/ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/msbuild.proj?rev=357119&r1=357118&r2=357119&view=diff
==============================================================================
--- ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/msbuild.proj (original)
+++ ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/etc/testcases/src/msbuild.proj Thu
Dec 15 20:32:51 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/branches/Ant_1.6.2_compatible/src/main/org/apache/ant/dotnet/MSBuildTask.java
URL: http://svn.apache.org/viewcvs/ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/ant/dotnet/MSBuildTask.java?rev=357119&r1=357118&r2=357119&view=diff
==============================================================================
--- ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/ant/dotnet/MSBuildTask.java
(original)
+++ ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/main/org/apache/ant/dotnet/MSBuildTask.java
Thu Dec 15 20:32:51 2005
@@ -22,6 +22,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.tools.ant.BuildException;
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -54,7 +55,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()) {
@@ -100,21 +101,9 @@
      * 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;
-        }
+        throw new BuildException("MSBuild requires build files to have"
+                                 + " a certain default namespace, which"
+                                 + " cannot be achieved with Ant prior to"
+                                 + " Ant 1.7.");
     }
 }

Modified: ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/ant/dotnet/MSBuildTaskTest.java
URL: http://svn.apache.org/viewcvs/ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/ant/dotnet/MSBuildTaskTest.java?rev=357119&r1=357118&r2=357119&view=diff
==============================================================================
--- ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/ant/dotnet/MSBuildTaskTest.java
(original)
+++ ant/antlibs/dotnet/branches/Ant_1.6.2_compatible/src/testcases/org/apache/ant/dotnet/MSBuildTaskTest.java
Thu Dec 15 20:32:51 2005
@@ -56,9 +56,4 @@
         }
     }
 
-    public void testNestedTask() throws Exception {
-        if (getProject().getProperty("msbuild.found") != null) {
-            expectLogContaining("nested-task", "foo is bar");
-        }
-    }
 }



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


Mime
View raw message