org.apache.tools.ant.taskdefs.optional.dotnet

Class Ilasm

public class Ilasm extends DotnetBaseMatchingTask

Assembles .NET Intermediate Language files. ilasm.exe 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: <il/> should suffice to produce a debug build of all *.il files. The option set is roughly compatible with the CSharp class; even though the command line options are only vaguely equivalent. [The low level commands take things like /OUT=file, csc wants /out:file ... /verbose is used some places; /quiet here in ildasm... etc.] It would be nice if someone made all the command line tools consistent (and not as brittle as the java cmdline tools)

The task is a directory based task, so attributes like includes="*.il" and excludes="broken.il" can be used to control the files pulled in. You can also use nested <src> filesets to refer to source.

UNKNOWN: name="ilasm" category="dotnet"

Nested Class Summary
static classIlasm.TargetTypes
Target types to build. valid build types are exe|library|module|winexe
Field Summary
protected booleandebug
debug flag.
protected static Stringexe_name
Name of the executable.
protected static Stringexe_title
title of task for external presentation
protected StringextraOptions
any extra command options?
protected booleanfailOnError
flag to control action on execution trouble
protected static Stringfile_ext
what is the file extension we search on?
protected static Stringfile_pattern
and now derive the search pattern from the extension
protected booleanlisting
listing flag
protected VectorreferenceFilesets
filesets of references
protected FileresourceFile
resource file (.res format) to include in the app.
protected StringtargetType
type of target.
protected booleanverbose
verbose flag
Constructor Summary
Ilasm()
constructor inits everything and set up the search pattern
Method Summary
voidaddReference(FileSet reference)
add a new reference fileset to the compilation
voidClear()
reset all contents.
voidexecute()
This is the execution entry point.
booleangetDebug()
query the debug flag
protected StringgetDebugParameter()
get the argument or null for no argument needed
StringgetExtraOptions()
Gets the ExtraOptions attribute
protected StringgetExtraOptionsParameter()
get any extra options or null for no argument needed
booleangetFailOnError()
query fail on error flag
protected StringgetKeyfileParameter()
get the argument or null for no argument needed
protected StringgetListingParameter()
turn the listing flag into a parameter for ILASM
protected StringgetOutputFileParameter()
get the output file
protected StringgetResourceFileParameter()
Gets the resourceFileParameter attribute of the Ilasm task
StringgetTargetType()
accessor method for target type
protected StringgetTargetTypeParameter()
g get the target type or null for no argument needed
protected StringgetVerboseParameter()
turn the verbose flag into a parameter for ILASM
protected static booleanisFileManagedBinary(File file)
test for a file being managed or not
protected booleannotEmpty(String s)
test for a string containing something useful
voidsetDebug(boolean f)
set the debug flag on or off.
voidsetExtraOptions(String extraOptions)
Any extra options which are not explicitly supported by this task.
voidsetFailOnError(boolean b)
If true, fails if ilasm tool fails.
voidsetKeyfile(File keyfile)
the name of a file containing a private key.
voidsetListing(boolean b)
If true, produce a listing (off by default).
voidsetOutputFile(File params)
Set the output file; identical to setDestFile
voidsetOwner(String s)
Sets the Owner attribute.
voidsetResourceFile(File fileName)
name of resource file to include.
voidsetTargetType(String targetType)
Sets the type of target, either "exe" or "library".
voidsetTargetType(Ilasm.TargetTypes targetType)
set the target type to one of exe|library
voidsetVerbose(boolean b)
If true, enable verbose ILASM output.

Field Detail

debug

protected boolean debug
debug flag. Controls generation of debug information.

exe_name

protected static final String exe_name
Name of the executable. The .exe suffix is deliberately not included in anticipation of the unix version

exe_title

protected static final String exe_title
title of task for external presentation

extraOptions

protected String extraOptions
any extra command options?

failOnError

protected boolean failOnError
flag to control action on execution trouble

file_ext

protected static final String file_ext
what is the file extension we search on?

file_pattern

protected static final String file_pattern
and now derive the search pattern from the extension

listing

protected boolean listing
listing flag

referenceFilesets

protected Vector referenceFilesets
filesets of references

resourceFile

protected File resourceFile
resource file (.res format) to include in the app.

targetType

protected String targetType
type of target. Should be one of exe|library|module|winexe|(null) default is exe; the actual value (if not null) is fed to the command line.
See /target

verbose

protected boolean verbose
verbose flag

Constructor Detail

Ilasm

public Ilasm()
constructor inits everything and set up the search pattern

Method Detail

addReference

public void addReference(FileSet reference)
add a new reference fileset to the compilation

Parameters: reference

Clear

public void Clear()
reset all contents.

execute

public void execute()
This is the execution entry point. Build a list of files and call ilasm on each of them.

Throws: BuildException if the assembly failed and FailOnError is true

getDebug

public boolean getDebug()
query the debug flag

Returns: true if debug is turned on

getDebugParameter

protected String getDebugParameter()
get the argument or null for no argument needed

Returns: The debugParameter value

getExtraOptions

public String getExtraOptions()
Gets the ExtraOptions attribute

Returns: The ExtraOptions value

getExtraOptionsParameter

protected String getExtraOptionsParameter()
get any extra options or null for no argument needed

Returns: The ExtraOptions Parameter to CSC

getFailOnError

public boolean getFailOnError()
query fail on error flag

Returns: The failFailOnError value

getKeyfileParameter

protected String getKeyfileParameter()
get the argument or null for no argument needed

Returns: The keyfileParameter value

getListingParameter

protected String getListingParameter()
turn the listing flag into a parameter for ILASM

Returns: the appropriate string from the state of the listing flag

getOutputFileParameter

protected String getOutputFileParameter()
get the output file

Returns: the argument string or null for no argument

getResourceFileParameter

protected String getResourceFileParameter()
Gets the resourceFileParameter attribute of the Ilasm task

Returns: The resourceFileParameter value

getTargetType

public String getTargetType()
accessor method for target type

Returns: the current target option

getTargetTypeParameter

protected String getTargetTypeParameter()
g get the target type or null for no argument needed

Returns: The TargetTypeParameter value

getVerboseParameter

protected String getVerboseParameter()
turn the verbose flag into a parameter for ILASM

Returns: null or the appropriate command line string

isFileManagedBinary

protected static boolean isFileManagedBinary(File file)
test for a file being managed or not

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.

notEmpty

protected boolean notEmpty(String s)
test for a string containing something useful

Parameters: s any string

Returns: true if the argument is not null or empty

setDebug

public void setDebug(boolean f)
set the debug flag on or off.

Parameters: f on/off flag

setExtraOptions

public void setExtraOptions(String extraOptions)
Any extra options which are not explicitly supported by this task.

Parameters: extraOptions The new ExtraOptions value

setFailOnError

public void setFailOnError(boolean b)
If true, fails if ilasm tool fails.

Parameters: b The new failOnError value

setKeyfile

public void setKeyfile(File keyfile)
the name of a file containing a private key.

Parameters: keyfile The new keyfile value

setListing

public void setListing(boolean b)
If true, produce a listing (off by default).

Parameters: b flag set to true for listing on

setOutputFile

public void setOutputFile(File params)
Set the output file; identical to setDestFile

Parameters: params The new outputFile value

See Also: DotnetBaseMatchingTask

setOwner

public void setOwner(String s)
Sets the Owner attribute.

Parameters: s The new Owner value

UNKNOWN: ignore="true"

setResourceFile

public void setResourceFile(File fileName)
name of resource file to include.

Parameters: fileName path to the file. Can be relative, absolute, whatever.

setTargetType

public void setTargetType(String targetType)
Sets the type of target, either "exe" or "library".

Parameters: targetType one of exe|library|

Throws: BuildException if target is not one of exe|library

setTargetType

public void setTargetType(Ilasm.TargetTypes targetType)
set the target type to one of exe|library

Parameters: targetType

setVerbose

public void setVerbose(boolean b)
If true, enable verbose ILASM output.

Parameters: b flag set to true for verbose on

Copyright B) 2000-2007 Apache Software Foundation. All Rights Reserved.