Browse Source

Make <csc> default to mcs on non-Windows platforms

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275682 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 21 years ago
parent
commit
22b86b33e3
4 changed files with 8 additions and 7 deletions
  1. +3
    -0
      WHATSNEW
  2. +1
    -1
      docs/manual/OptionalTasks/csc.html
  3. +0
    -4
      src/etc/testcases/taskdefs/optional/dotnet.xml
  4. +4
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java

+ 3
- 0
WHATSNEW View File

@@ -289,6 +289,9 @@ automatic use of response files. Bugzilla report #19630

Other changes:
--------------

* Shipped XML parser is now Xerces 2.6.0

* All tasks can be used outside of <target>s. Note that some tasks
will not work at all outside of targets as they would cause infinite
loops (<antcall> as well as <ant> and <subant> if they invoke the


+ 1
- 1
docs/manual/OptionalTasks/csc.html View File

@@ -46,7 +46,7 @@
</td></tr>

<tr><td><blockquote>
Compiles C# source into executables or modules. csc.exe must be on the execute path, unless another executable or the full path to that executable is specified in the <tt>executable</tt> parameter <p> All parameters are optional: &lt;csc/&gt; should suffice to produce a debug build of all *.cs files. However, naming an <tt>destFile</tt>stops the csc compiler from choosing an output name from random, and allows the dependency checker to determine if the file is out of date. <p> The task is a directory based task, so attributes like <b>includes="*.cs" </b> and <b>excludes="broken.cs"</b> can be used to control the files pulled in. By default, all *.cs files from the project folder down are included in the command. When this happens the output file -if not specified- is taken as the first file in the list, which may be somewhat hard to control. Specifying the output file with <tt>destFile</tt> seems prudent. <p> <p> For more complex source trees, nested <tt>src</tt> elemements can be supplied. When such an element is present, the implicit fileset is ignored. This makes sense, when you think about it :) <p> References to external files can be made through the references attribute, or (since Ant1.6), via nested &lt;reference&gt; filesets. With the latter, the timestamps of the references are also used in the dependency checking algorithm. <p> Example <pre>&lt;csc optimize=&quot;true&quot; debug=&quot;false&quot; docFile=&quot;documentation.xml&quot; warnLevel=&quot;4&quot; unsafe=&quot;false&quot; targetType=&quot;exe&quot; incremental=&quot;false&quot; mainClass = &quot;MainApp&quot; destFile=&quot;NetApp.exe&quot; &gt; &lt;src dir="src" includes="*.cs" /&gt; &lt;reference file="${testCSC.dll}" /&gt; &lt;define name="RELEASE" /&gt; &lt;define name="DEBUG" if="debug.property"/&gt; &lt;define name="def3" unless="def3.property"/&gt; &lt;/csc&gt; </pre>
Compiles C# source into executables or modules. csc.exe on Windows or mcs on any other platform must be on the execute path, unless another executable or the full path to that executable is specified in the <tt>executable</tt> parameter <p> All parameters are optional: &lt;csc/&gt; should suffice to produce a debug build of all *.cs files. However, naming an <tt>destFile</tt>stops the csc compiler from choosing an output name from random, and allows the dependency checker to determine if the file is out of date. <p> The task is a directory based task, so attributes like <b>includes="*.cs" </b> and <b>excludes="broken.cs"</b> can be used to control the files pulled in. By default, all *.cs files from the project folder down are included in the command. When this happens the output file -if not specified- is taken as the first file in the list, which may be somewhat hard to control. Specifying the output file with <tt>destFile</tt> seems prudent. <p> <p> For more complex source trees, nested <tt>src</tt> elemements can be supplied. When such an element is present, the implicit fileset is ignored. This makes sense, when you think about it :) <p> References to external files can be made through the references attribute, or (since Ant1.6), via nested &lt;reference&gt; filesets. With the latter, the timestamps of the references are also used in the dependency checking algorithm. <p> Example <pre>&lt;csc optimize=&quot;true&quot; debug=&quot;false&quot; docFile=&quot;documentation.xml&quot; warnLevel=&quot;4&quot; unsafe=&quot;false&quot; targetType=&quot;exe&quot; incremental=&quot;false&quot; mainClass = &quot;MainApp&quot; destFile=&quot;NetApp.exe&quot; &gt; &lt;src dir="src" includes="*.cs" /&gt; &lt;reference file="${testCSC.dll}" /&gt; &lt;define name="RELEASE" /&gt; &lt;define name="DEBUG" if="debug.property"/&gt; &lt;define name="def3" unless="def3.property"/&gt; &lt;/csc&gt; </pre>
</blockquote></td></tr>

</table>


+ 0
- 4
src/etc/testcases/taskdefs/optional/dotnet.xml View File

@@ -156,7 +156,6 @@
<csc
destFile="${testCSC.exe}"
targetType="exe"
executable="mcs"
includedefaultreferences="true"
>
</csc>
@@ -193,7 +192,6 @@
destFile="${testCSC.exe}"
targetType="exe"
srcDir="."
executable="mcs"
includedefaultreferences="true"
>
</csc>
@@ -227,7 +225,6 @@
<csc
destFile="${testCSC.dll}"
targetType="library"
executable="mcs"
includedefaultreferences="true"
>
<src dir="${src.dir}" includes="example2.cs"/>
@@ -265,7 +262,6 @@
<csc
destFile="${testCscReferences.exe}"
targetType="exe"
executable="mcs"
includedefaultreferences="true"
>
<src file="${src.dir}/example.cs"/>


+ 4
- 2
src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java View File

@@ -70,12 +70,14 @@ package org.apache.tools.ant.taskdefs.optional.dotnet;

import java.io.File;

import org.apache.tools.ant.taskdefs.condition.Os;

// ====================================================================

/**
* Compiles C# source into executables or modules.
*
* csc.exe must be on the execute path, unless another executable
* csc.exe on Windows or mcs on other platforms must be on the execute path, unless another executable
* or the full path to that executable is specified in the <tt>executable</tt>
* parameter
* <p>
@@ -190,7 +192,7 @@ public class CSharp extends DotnetCompile {
unsafe = false;
noconfig = false;
definitions = null;
setExecutable("csc");
setExecutable(Os.isFamily("windows") ? "csc" : "mcs");
}




Loading…
Cancel
Save