public abstract class DotnetCompile extends DotnetBaseMatchingTask
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. |
Modifier and Type | Class and Description |
---|---|
static class |
DotnetCompile.TargetTypes
Target types to build.
|
Modifier and Type | Field and Description |
---|---|
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
|
filesets, isWindows, outputFile, srcDir
Constructor and Description |
---|
DotnetCompile()
constructor inits everything and set up the search pattern
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
addCompilerSpecificOptions(NetCommand command)
add any compiler specifics
|
void |
addDefine(DotnetDefine define)
add a define to the list of definitions
|
void |
addReference(org.apache.tools.ant.types.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 void |
createResourceParameter(NetCommand command,
DotnetResource resource) |
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
|
protected java.lang.String[] |
getExtraOptionsParameters()
get any extra options or null for no argument needed, split
them if they represent multiple options.
|
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(org.apache.tools.ant.types.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
|
addFilesAndExecute, addFilesToCommand, addSrc, buildFileList, getDestFile, getOutputFileTimestamp, getSrcDir, setDestFile, setSrcDir
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
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
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
public DotnetCompile()
public void clear()
public void setReferences(java.lang.String s)
s
- The new References valueprotected java.lang.String getReferencesParameter()
public void setReferenceFiles(org.apache.tools.ant.types.Path path)
path
- another path to appendpublic void addReference(org.apache.tools.ant.types.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()
protected java.lang.String[] getExtraOptionsParameters()
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 org.apache.tools.ant.BuildException
ttype
- The new TargetType valueorg.apache.tools.ant.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 org.apache.tools.ant.BuildException
org.apache.tools.ant.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 inprotected void validate() throws org.apache.tools.ant.BuildException
org.apache.tools.ant.BuildException
- if validation failedpublic java.lang.String getFilePattern()
public boolean isUseResponseFile()
public void setUseResponseFile(boolean useResponseFile)
useResponseFile
- public void execute() throws org.apache.tools.ant.BuildException
execute
in class org.apache.tools.ant.Task
org.apache.tools.ant.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 void createResourceParameter(NetCommand command, DotnetResource resource)
protected int addReferenceFilesets(NetCommand command, long outputTimestamp)
outputTimestamp
- timestamp to compare againstprotected NetCommand createNetCommand()
protected abstract void addCompilerSpecificOptions(NetCommand command)
command
- public java.lang.String getDefinitionsDelimiter()
protected static boolean isFileManagedBinary(java.io.File file)