|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tools.ant.ProjectComponent org.apache.tools.ant.Task org.apache.tools.ant.taskdefs.MatchingTask org.apache.tools.ant.taskdefs.optional.dotnet.DotnetBaseMatchingTask org.apache.tools.ant.taskdefs.optional.dotnet.DotnetCompile org.apache.tools.ant.taskdefs.optional.dotnet.CSharp
public class CSharp
Compiles C# source into executables or modules. 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 executable parameter
All parameters are optional: <csc/> should suffice to produce a debug build of all *.cs files. However, naming an destFilestops the csc compiler from choosing an output name from random, and allows the dependency checker to determine if the file is out of date.
The task is a directory based task, so attributes like includes="*.cs" and excludes="broken.cs" 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 destFile seems prudent.
For more complex source trees, nested src elemements can be supplied. When such an element is present, the implicit fileset is ignored. This makes sense, when you think about it :)
For historical reasons the pattern
**
/*.cs
is preset as includes list and
you can not override it with an explicit includes attribute. Use
nested <src>
elements instead of the basedir
attribute if you need more control.
References to external files can be made through the references attribute, or (since Ant1.6), via nested <reference> filesets. With the latter, the timestamps of the references are also used in the dependency checking algorithm.
Example
<csc optimize="true" debug="false" docFile="documentation.xml" warnLevel="4" unsafe="false" targetType="exe" incremental="false" mainClass = "MainApp" destFile="NetApp.exe" > <src dir="src" includes="*.cs" /> <reference file="${testCSC.dll}" /> <define name="RELEASE" /> <define name="DEBUG" if="debug.property"/> <define name="def3" unless="def3.property"/> </csc>
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.tools.ant.taskdefs.optional.dotnet.DotnetCompile |
---|
DotnetCompile.TargetTypes |
Field Summary | |
---|---|
protected boolean |
unsafe
enable unsafe code flag. |
Fields inherited from class org.apache.tools.ant.taskdefs.optional.dotnet.DotnetCompile |
---|
additionalModules, debug, definitionList, executable, extraOptions, mainClass, REFERENCE_OPTION, referenceFilesets, resources, targetType, utf8output |
Fields inherited from class org.apache.tools.ant.taskdefs.optional.dotnet.DotnetBaseMatchingTask |
---|
filesets, isWindows, outputFile, srcDir |
Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
---|
fileset |
Fields inherited from class org.apache.tools.ant.Task |
---|
target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
---|
description, location, project |
Constructor Summary | |
---|---|
CSharp()
constructor inits everything and set up the search pattern |
Method Summary | |
---|---|
void |
addCompilerSpecificOptions(NetCommand command)
add Commands unique to C#. |
void |
clear()
full cleanup |
protected void |
createResourceParameter(NetCommand command,
DotnetResource resource)
Build a C# style parameter. |
protected java.lang.String |
getDefinitionsParameter()
override the superclasses version of this method (which we call) with a check for a definitions attribute, the contents of which are appended to the list. |
protected java.lang.String |
getDocFileParameter()
get the argument or null for no argument needed |
protected java.lang.String |
getFileAlignParameter()
get the argument or null for no argument needed |
java.lang.String |
getFileExtension()
This method indicates the filename extension for C# files. |
protected java.lang.String |
getFullPathsParameter()
Gets the fullPathsParameter attribute of the CSharp object |
boolean |
getIncremental()
query the incrementalflag |
protected java.lang.String |
getIncrementalParameter()
get the incremental build argument |
protected java.lang.String |
getNoConfigParameter()
Gets the noConfigParameter attribute of the CSharp object |
java.lang.String |
getReferenceDelimiter()
Returns the delimiter which C# uses to separate references, i.e., a semi colon. |
boolean |
getUnsafe()
query the Unsafe attribute |
protected java.lang.String |
getUnsafeParameter()
get the argument or null for no argument needed |
void |
setDefinitions(java.lang.String params)
Semicolon separated list of defined constants. |
void |
setDocFile(java.io.File f)
file for generated XML documentation |
void |
setFileAlign(int fileAlign)
Set the file alignment. |
void |
setFullPaths(boolean enabled)
If true, print the full path of files on errors. |
void |
setIncremental(boolean incremental)
set the incremental compilation flag on or off. |
void |
setNoConfig(boolean enabled)
A flag that tells the compiler not to read in the compiler settings files 'csc.rsp' in its bin directory and then the local directory |
void |
setOutputFile(java.io.File params)
The output file. |
void |
setUnsafe(boolean unsafe)
If true, enables the unsafe keyword. |
Methods inherited from class org.apache.tools.ant.taskdefs.optional.dotnet.DotnetBaseMatchingTask |
---|
addFilesAndExecute, addFilesToCommand, addSrc, buildFileList, getDestFile, getOutputFileTimestamp, getSrcDir, setDestFile, setSrcDir |
Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
---|
add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems |
Methods inherited from class org.apache.tools.ant.Task |
---|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
---|
clone, getDescription, getLocation, getProject, setDescription, setLocation |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean unsafe
Constructor Detail |
---|
public CSharp()
Method Detail |
---|
public void clear()
clear
in class DotnetCompile
public void setDocFile(java.io.File f)
f
- output fileprotected java.lang.String getDocFileParameter()
public void setFileAlign(int fileAlign)
fileAlign
- the value to use.protected java.lang.String getFileAlignParameter()
public void setFullPaths(boolean enabled)
enabled
- The new fullPaths valueprotected java.lang.String getFullPathsParameter()
public void setIncremental(boolean incremental)
incremental
- on/off flagpublic boolean getIncremental()
protected java.lang.String getIncrementalParameter()
public void setOutputFile(java.io.File params)
params
- The new outputFile valuepublic void setUnsafe(boolean unsafe)
unsafe
- The new Unsafe valuepublic boolean getUnsafe()
protected java.lang.String getUnsafeParameter()
public void setNoConfig(boolean enabled)
enabled
- The new noConfig valueprotected java.lang.String getNoConfigParameter()
public void setDefinitions(java.lang.String params)
params
- The new definitions valueprotected java.lang.String getDefinitionsParameter()
getDefinitionsParameter
in class DotnetCompile
public void addCompilerSpecificOptions(NetCommand command)
addCompilerSpecificOptions
in class DotnetCompile
command
- ongoing commandpublic java.lang.String getReferenceDelimiter()
getReferenceDelimiter
in class DotnetCompile
public java.lang.String getFileExtension()
getFileExtension
in class DotnetCompile
protected void createResourceParameter(NetCommand command, DotnetResource resource)
createResourceParameter
in class DotnetCompile
command
- the command.resource
- the resource.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |