org.apache.tools.ant.taskdefs.optional.dotnet
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. |
Version: 0.1
Nested Class Summary | |
---|---|
static class | DotnetCompile.TargetTypes
Target types to build.
valid build types are exe|library|module|winexe |
Field Summary | |
---|---|
protected String | additionalModules
list of extra modules to refer to |
protected boolean | debug
debug flag. |
protected Vector | definitionList
a list of definitions to support; |
protected String | executable
executable |
protected String | extraOptions
any extra command options? |
protected String | mainClass
main class (or null for automatic choice) |
protected Vector | referenceFilesets
filesets of references |
protected Vector | resources
our resources |
protected static String | REFERENCE_OPTION |
protected String | targetType
type of target. |
protected boolean | utf8output
utf out flag |
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 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 String | getAdditionalModulesParameter()
get the argument or null for no argument needed
|
boolean | getDebug()
query the debug flag
|
protected String | getDebugParameter()
get the debug switch argument
|
String | getDefinitionsDelimiter()
override point for delimiting definitions. |
protected String | getDefinitionsParameter()
get a list of definitions or null |
protected String | getDestFileParameter()
get the argument or null for no argument needed
|
protected String | getExecutable()
This method gets the name of the executable. |
String | getExtraOptions()
Gets the ExtraOptions attribute
|
protected String | getExtraOptionsParameter()
get any extra options or null for no argument needed
|
protected 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 String | getFileExtension()
Get the extension of filenames to compile. |
String | getFilePattern()
Get the pattern for files to compile. |
boolean | getIncludeDefaultReferences()
query automatic reference inclusion flag
|
protected String | getIncludeDefaultReferencesParameter()
get the include default references flag or null for no argument needed
|
String | getMainClass()
Gets the MainClass attribute
|
protected String | getMainClassParameter()
get the /main argument or null for no argument needed
|
boolean | getOptimize()
query the optimise flag
|
protected String | getOptimizeParameter()
get the optimise flag or null for no argument needed
|
abstract String | getReferenceDelimiter()
Get the delimiter that the compiler uses between references.
|
protected String | getReferenceFilesParameter()
turn the path list into a list of files and a /references argument
|
protected String | getReferencesParameter()
get the reference string or null for no argument needed
|
String | getTargetType()
Gets the TargetType attribute
|
protected String | getTargetTypeParameter()
get the argument or null for no argument needed
|
protected String | getUtf8OutputParameter()
Gets the utf8OutpuParameter attribute of the CSharp object
|
int | getWarnLevel()
query warn level
|
protected String | getWarnLevelParameter()
get the warn level switch
|
protected String | getWin32IconParameter()
get the argument or null for no argument needed
|
File | getWin32Res()
Gets the file of the win32 .res file to include. |
protected String | getWin32ResParameter()
get the argument or null for no argument needed
|
protected static boolean | isFileManagedBinary(File file)
test for a file being managed or not |
boolean | isUseResponseFile()
getter for flag |
protected boolean | notEmpty(String s)
test for a string containing something useful
|
void | setAdditionalModules(String params)
Semicolon separated list of modules to refer to.
|
void | setDebug(boolean f)
set the debug flag on or off.
|
void | setDestDir(File dirName)
Set the destination directory of files to be compiled.
|
void | setExecutable(String executable)
set the name of the program, overriding the defaults.
|
void | setExtraOptions(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.
set the automatic reference inclusion flag on or off this flag controls
the /nostdlib option in CSC
|
void | setMainClass(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(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(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(File fileName)
Set the filename of icon to include.
|
void | setWin32Res(File fileName)
Sets the filename of a win32 resource (.RES) file to include.
|
protected void | validate()
validation code |
Parameters: command
Parameters: define
Parameters: reference
Parameters: outputTimestamp timestamp to compare against
Returns: number of files out of date
Parameters: resource
Returns: a command prefilled with the exe name and task name
Parameters: resource
Returns: a string containing the resource param, or a null string to conditionally exclude a resource.
Throws: BuildException if validation or execution failed
Parameters: command
Returns: The AdditionalModules Parameter to CSC
Returns: true if debug is turned on
Returns: The Debug Parameter to CSC
Returns: The definitions limiter, i.e., ";"
Returns: a string beginning /D: or null for no definitions
Returns: The OutputFile Parameter to CSC
Returns: the name of the executable
Returns: The ExtraOptions value
Returns: The ExtraOptions Parameter to CSC
Returns: The ExtraOptions Parameter to CSC
Returns: The FailFailOnError value
Returns: The string extension of files to compile.
Returns: The compilation file pattern.
Returns: true if flag is turned on
Returns: The Parameter to CSC
Returns: The MainClass value
Returns: The MainClass Parameter to CSC
Returns: true if optimise is turned on
Returns: The Optimize Parameter to CSC
Returns: The string delimiter for the reference string.
Returns: null or a string of references.
Returns: The References Parameter to CSC
Returns: The TargetType value
Returns: The TargetType Parameter to CSC
Returns: The utf8OutpuParameter value
Returns: current value
Returns: The WarnLevel Parameter to CSC
Returns: The Win32Icon Parameter to CSC
Returns: path to the file.
Returns: The Win32Res Parameter to CSC
Returns: true if we think this is a managed executable, and thus OK for linking
UNKNOWN: look at the PE header of the exe and see if it is managed or not.
Returns: The flag indicating whether the compilation is using a response file.
Parameters: s string in
Returns: true if the argument is not null or empty
Parameters: params The new additionalModules value
Parameters: f on/off flag
Parameters: dirName The new DestDir value
Parameters: executable
Parameters: extraOptions The new ExtraOptions value
Parameters: b The new FailOnError value
Parameters: f on/off flag
Parameters: mainClass The new MainClass value
Parameters: f on/off flag
Parameters: path another path to append
Parameters: s The new References value
Parameters: targetType
Parameters: ttype The new TargetType value
Throws: BuildException if target is not one of exe|library|module|winexe
Parameters: useResponseFile
Parameters: enabled The new utf8Output value
Parameters: warnLevel warn level -see .net docs for valid range (probably 0-4)
Parameters: fileName path to the file. Can be relative, absolute, whatever.
Parameters: fileName path to the file. Can be relative, absolute, whatever.
Throws: BuildException if validation failed