|
||||||||||
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
Abstract superclass for dotnet compiler tasks. History
0.1 | First creation | Most of the code here was copied verbatim from v0.3 of Steve Loughran's CSharp optional task. Abstracted functionality to allow subclassing of other dotnet compiler types. |
Nested Class Summary | |
static class |
DotnetCompile.TargetTypes
Target types to build. |
Field Summary | |
protected java.lang.String |
additionalModules
list of extra modules to refer to |
protected boolean |
debug
debug flag. |
protected java.util.Vector |
definitionList
a list of definitions to support; |
protected java.lang.String |
executable
executable |
protected java.lang.String |
extraOptions
any extra command options? |
protected java.lang.String |
mainClass
main class (or null for automatic choice) |
protected static java.lang.String |
REFERENCE_OPTION
|
protected java.util.Vector |
referenceFilesets
filesets of references |
protected java.util.Vector |
resources
our resources |
protected java.lang.String |
targetType
type of target. |
protected boolean |
utf8output
utf out flag |
Fields inherited from class org.apache.tools.ant.taskdefs.optional.dotnet.DotnetBaseMatchingTask |
filesets, outputFile, srcDir |
Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
fileset |
Fields inherited from class org.apache.tools.ant.Task |
description, location, target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
project |
Constructor Summary | |
DotnetCompile()
constructor inits everything and set up the search pattern |
Method Summary | |
protected abstract void |
addCompilerSpecificOptions(NetCommand command)
add any compiler specifics |
void |
addDefine(DotnetDefine define)
add a define to the list of definitions |
void |
addReference(FileSet reference)
add a new reference fileset to the compilation |
protected int |
addReferenceFilesets(NetCommand command,
long outputTimestamp)
run through the list of reference files and add them to the command |
void |
addResource(DotnetResource resource)
link or embed a resource |
protected void |
addResources(NetCommand command)
for every resource declared, we get the (language specific) resource setting |
void |
clear()
reset all contents. |
protected NetCommand |
createNetCommand()
create our helper command |
protected abstract java.lang.String |
createResourceParameter(DotnetResource resource)
from a resource, get the |
void |
execute()
do the work by building the command line and then calling it |
protected void |
fillInSharedParameters(NetCommand command)
fill in the common information |
protected java.lang.String |
getAdditionalModulesParameter()
get the argument or null for no argument needed |
boolean |
getDebug()
query the debug flag |
protected java.lang.String |
getDebugParameter()
get the debug switch argument |
java.lang.String |
getDefinitionsDelimiter()
override point for delimiting definitions. |
protected java.lang.String |
getDefinitionsParameter()
get a list of definitions or null |
protected java.lang.String |
getDestFileParameter()
get the argument or null for no argument needed |
protected java.lang.String |
getExecutable()
This method gets the name of the executable. |
java.lang.String |
getExtraOptions()
Gets the ExtraOptions attribute |
protected java.lang.String |
getExtraOptionsParameter()
get any extra options or null for no argument needed |
boolean |
getFailOnError()
query fail on error flag |
abstract java.lang.String |
getFileExtension()
Get the extension of filenames to compile. |
java.lang.String |
getFilePattern()
Get the pattern for files to compile. |
boolean |
getIncludeDefaultReferences()
query automatic reference inclusion flag |
protected java.lang.String |
getIncludeDefaultReferencesParameter()
get the include default references flag or null for no argument needed |
java.lang.String |
getMainClass()
Gets the MainClass attribute |
protected java.lang.String |
getMainClassParameter()
get the /main argument or null for no argument needed |
boolean |
getOptimize()
query the optimise flag |
protected java.lang.String |
getOptimizeParameter()
get the optimise flag or null for no argument needed |
abstract java.lang.String |
getReferenceDelimiter()
Get the delimiter that the compiler uses between references. |
protected java.lang.String |
getReferenceFilesParameter()
turn the path list into a list of files and a /references argument |
protected java.lang.String |
getReferencesParameter()
get the reference string or null for no argument needed |
java.lang.String |
getTargetType()
Gets the TargetType attribute |
protected java.lang.String |
getTargetTypeParameter()
get the argument or null for no argument needed |
protected java.lang.String |
getUtf8OutputParameter()
Gets the utf8OutpuParameter attribute of the CSharp object |
int |
getWarnLevel()
query warn level |
protected java.lang.String |
getWarnLevelParameter()
get the warn level switch |
protected java.lang.String |
getWin32IconParameter()
get the argument or null for no argument needed |
java.io.File |
getWin32Res()
Gets the file of the win32 .res file to include. |
protected java.lang.String |
getWin32ResParameter()
get the argument or null for no argument needed |
protected static boolean |
isFileManagedBinary(java.io.File file)
test for a file being managed or not |
boolean |
isUseResponseFile()
getter for flag |
protected boolean |
notEmpty(java.lang.String s)
test for a string containing something useful |
void |
setAdditionalModules(java.lang.String params)
Semicolon separated list of modules to refer to. |
void |
setDebug(boolean f)
set the debug flag on or off. |
void |
setDestDir(java.io.File dirName)
Set the destination directory of files to be compiled. |
void |
setExecutable(java.lang.String executable)
set the name of the program, overriding the defaults. |
void |
setExtraOptions(java.lang.String extraOptions)
Any extra options which are not explicitly supported by this task. |
void |
setFailOnError(boolean b)
If true, fail on compilation errors. |
void |
setIncludeDefaultReferences(boolean f)
If true, automatically includes the common assemblies in dotnet, and tells the compiler to link in mscore.dll. |
void |
setMainClass(java.lang.String mainClass)
Sets the name of main class for executables. |
void |
setOptimize(boolean f)
If true, enables optimization flag. |
void |
setReferenceFiles(Path path)
Path of references to include. |
void |
setReferences(java.lang.String s)
Semicolon separated list of DLLs to refer to. |
void |
setTargetType(DotnetCompile.TargetTypes targetType)
set the target type to one of exe|library|module|winexe |
void |
setTargetType(java.lang.String ttype)
Set the type of target. |
void |
setUseResponseFile(boolean useResponseFile)
Flag to turn on response file use; default=false. |
void |
setUtf8Output(boolean enabled)
If true, require all compiler output to be in UTF8 format. |
void |
setWarnLevel(int warnLevel)
Level of warning currently between 1 and 4 with 4 being the strictest. |
void |
setWin32Icon(java.io.File fileName)
Set the filename of icon to include. |
void |
setWin32Res(java.io.File fileName)
Sets the filename of a win32 resource (.RES) file to include. |
protected void |
validate()
validation code |
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 |
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
getProject |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.Vector definitionList
protected java.util.Vector resources
protected java.lang.String executable
protected static final java.lang.String REFERENCE_OPTION
protected boolean debug
protected java.lang.String mainClass
protected java.lang.String extraOptions
protected java.lang.String targetType
protected boolean utf8output
protected java.lang.String additionalModules
protected java.util.Vector referenceFilesets
Constructor Detail |
public DotnetCompile()
Method Detail |
public void clear()
public void setReferences(java.lang.String s)
s
- The new References valueprotected java.lang.String getReferencesParameter()
public void setReferenceFiles(Path path)
path
- another path to appendpublic void addReference(FileSet reference)
reference
- protected java.lang.String getReferenceFilesParameter()
public void setIncludeDefaultReferences(boolean f)
f
- on/off flagpublic boolean getIncludeDefaultReferences()
protected java.lang.String getIncludeDefaultReferencesParameter()
public void setOptimize(boolean f)
f
- on/off flagpublic boolean getOptimize()
protected java.lang.String getOptimizeParameter()
public void setDebug(boolean f)
f
- on/off flagpublic boolean getDebug()
protected java.lang.String getDebugParameter()
public void setWarnLevel(int warnLevel)
warnLevel
- warn level -see .net docs for valid range (probably
0-4)public int getWarnLevel()
protected java.lang.String getWarnLevelParameter()
public void setMainClass(java.lang.String mainClass)
mainClass
- The new MainClass valuepublic java.lang.String getMainClass()
protected java.lang.String getMainClassParameter()
public void setExtraOptions(java.lang.String extraOptions)
extraOptions
- The new ExtraOptions valuepublic java.lang.String getExtraOptions()
protected java.lang.String getExtraOptionsParameter()
public void setDestDir(java.io.File dirName)
dirName
- The new DestDir valuepublic void setTargetType(DotnetCompile.TargetTypes targetType)
targetType
- public void setTargetType(java.lang.String ttype) throws BuildException
ttype
- The new TargetType value
BuildException
- if target is not one of
exe|library|module|winexepublic java.lang.String getTargetType()
protected java.lang.String getTargetTypeParameter()
public void setWin32Icon(java.io.File fileName)
fileName
- path to the file. Can be relative, absolute, whatever.protected java.lang.String getWin32IconParameter()
public void setWin32Res(java.io.File fileName)
fileName
- path to the file. Can be relative, absolute, whatever.public java.io.File getWin32Res()
protected java.lang.String getWin32ResParameter()
public void setUtf8Output(boolean enabled)
enabled
- The new utf8Output valueprotected java.lang.String getUtf8OutputParameter()
public void addDefine(DotnetDefine define)
define
- protected java.lang.String getDefinitionsParameter() throws BuildException
BuildException
public void setAdditionalModules(java.lang.String params)
params
- The new additionalModules valueprotected java.lang.String getAdditionalModulesParameter()
protected java.lang.String getDestFileParameter()
public void setFailOnError(boolean b)
b
- The new FailOnError valuepublic boolean getFailOnError()
public void addResource(DotnetResource resource)
resource
- protected java.lang.String getExecutable()
public void setExecutable(java.lang.String executable)
executable
- protected boolean notEmpty(java.lang.String s)
s
- string in
protected void validate() throws BuildException
BuildException
- if validation failedpublic java.lang.String getFilePattern()
public boolean isUseResponseFile()
public void setUseResponseFile(boolean useResponseFile)
useResponseFile
- public void execute() throws BuildException
execute
in class Task
BuildException
- if validation or execution failedpublic abstract java.lang.String getReferenceDelimiter()
public abstract java.lang.String getFileExtension()
protected void fillInSharedParameters(NetCommand command)
command
- protected void addResources(NetCommand command)
protected abstract java.lang.String createResourceParameter(DotnetResource resource)
resource
-
protected int addReferenceFilesets(NetCommand command, long outputTimestamp)
outputTimestamp
- timestamp to compare against
protected NetCommand createNetCommand()
protected abstract void addCompilerSpecificOptions(NetCommand command)
command
- public java.lang.String getDefinitionsDelimiter()
protected static boolean isFileManagedBinary(java.io.File file)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |