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

Class Ilasm

Implemented Interfaces:
SelectorContainer

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&gt filesets to refer to source.

Nested Class Summary

static class
Ilasm.TargetTypes
Target types to build.

Field Summary

protected boolean
debug
debug flag.
protected static String
exe_name
Name of the executable.
protected static String
exe_title
title of task for external presentation
protected String
extraOptions
any extra command options?
protected boolean
failOnError
flag to control action on execution trouble
protected static String
file_ext
what is the file extension we search on?
protected static String
file_pattern
and now derive the search pattern from the extension
protected boolean
listing
listing flag
protected Vector
referenceFilesets
filesets of references
protected File
resourceFile
resource file (.res format) to include in the app.
protected String
targetType
type of target.
protected boolean
verbose
verbose 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

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

Method Summary

void
Clear()
reset all contents.
void
addReference(FileSet reference)
add a new reference fileset to the compilation
void
execute()
This is the execution entry point.
boolean
getDebug()
query the debug flag
protected String
getDebugParameter()
get the argument or null for no argument needed
String
getExtraOptions()
Gets the ExtraOptions attribute
protected String
getExtraOptionsParameter()
get any extra options or null for no argument needed
boolean
getFailOnError()
query fail on error flag
protected String
getKeyfileParameter()
get the argument or null for no argument needed
protected String
getListingParameter()
turn the listing flag into a parameter for ILASM
protected String
getOutputFileParameter()
get the output file
protected String
getResourceFileParameter()
Gets the resourceFileParameter attribute of the Ilasm task
String
getTargetType()
accessor method for target type
protected String
getTargetTypeParameter()
g get the target type or null for no argument needed
protected String
getVerboseParameter()
turn the verbose flag into a parameter for ILASM
protected static boolean
isFileManagedBinary(File file)
test for a file being managed or not
protected boolean
notEmpty(String s)
test for a string containing something useful
void
setDebug(boolean f)
set the debug flag on or off.
void
setExtraOptions(String extraOptions)
Any extra options which are not explicitly supported by this task.
void
setFailOnError(boolean b)
If true, fails if ilasm tool fails.
void
setKeyfile(File keyfile)
the name of a file containing a private key.
void
setListing(boolean b)
If true, produce a listing (off by default).
void
setOutputFile(File params)
Set the output file; identical to setDestFile
void
setOwner(String s)
Sets the Owner attribute.
void
setResourceFile(File fileName)
name of resource file to include.
void
setTargetType(String targetType)
Sets the type of target, either "exe" or "library".
void
setTargetType(Ilasm.TargetTypes targetType)
set the target type to one of exe|library
void
setVerbose(boolean b)
If true, enable verbose ILASM output.

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

XsetIgnore, XsetItems, 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

Methods inherited from class org.apache.tools.ant.Task

execute, 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, log, log, setProject

Field Details

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 Details

Ilasm

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

Method Details

Clear

public void Clear()
reset all contents.

addReference

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

execute

public void execute()
            throws BuildException
This is the execution entry point. Build a list of files and call ilasm on each of them.
Overrides:
execute in interface Task
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
To do:
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

setOwner

public void setOwner(String s)
Sets the Owner attribute.
Parameters:
s - The new Owner value

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)
            throws BuildException
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-2008 Apache Software Foundation. All Rights Reserved.