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

Class VisualBasicCompile

public class VisualBasicCompile extends DotnetCompile

This task compiles Visual Basic.NET source into executables or modules. The task requires vbc.exe on the execute path, unless it or an equivalent program is specified in the executable parameter

All parameters are optional: <vbc/> should suffice to produce a debug build of all *.vb files.

The task is a directory based task, so attributes like includes="**\/*.vb" and excludes="broken.vb" can be used to control the files pulled in. By default, all *.vb files from the project folder down are included in the command. When this happens the destFile -if not specified- is taken as the first file in the list, which may be somewhat hard to control. Specifying the output file with destfile is prudent.

Also, dependency checking only works if destfile is set.

For historical reasons the pattern **/*.vb is preset as includes list and you can not override it with an explicit includes attribute. Use nested <src> elements instead of the basedir attribute if you need more control.

As with <csc> nested src filesets of source, reference filesets, definitions and resources can be provided.

Example

<vbc
   optimize="true"
   debug="false"
   warnLevel="4"
   targetType="exe"
   definitions="RELEASE"
   excludes="src/unicode_class.vb"
   mainClass = "MainApp"
   destFile="NetApp.exe"
   optionExplicit="true"
   optionCompare="text"
   references="System.Xml,System.Web.Xml"
   >
          <reference file="${testCSC.dll}" />
          <define name="RELEASE" />
          <define name="DEBUG" if="debug.property"/>
          <define name="def3" unless="def2.property"/>
   </vbc>
 

UNKNOWN: name="vbc" category="dotnet"

Constructor Summary
VisualBasicCompile()
Constructor for VisualBasicCompile.
Method Summary
protected voidaddCompilerSpecificOptions(NetCommand command)
implement VBC commands
voidclear()
reset all contents.
protected StringcreateResourceParameter(DotnetResource resource)
from a resource, get the resource param
StringgetFileExtension()
Get the extension of filenames to compile.
StringgetImports()
Get global imports for namespaces in referenced metadata files.
protected StringgetImportsParameter()
Format the option for imports.
StringgetOptionCompare()
"binary" or "text" for the string-comparison style.
protected StringgetOptionCompareParameter()
Format the option for string comparison style.
booleangetOptionExplicit()
Get the flag for whether to require explicit declaration of variables.
StringgetOptionExplicitParameter()
Form the option string for optionExplicit..
booleangetOptionStrict()
Get the flag for whether to enforce strict language semantics.
StringgetOptionStrictParameter()
For the option string for optionStrict.
StringgetReferenceDelimiter()
Get the delimiter that the compiler uses between references.
booleangetRemoveIntChecks()
Get the flag for removing integer checks.
StringgetRemoveIntChecksParameter()
Form the option string for removeIntChecks.
StringgetRootNamespace()
Get the root namespace.
protected StringgetRootNamespaceParameter()
Form the option string for rootNamespace.
protected StringgetWin32ResParameter()
get the argument or null for no argument needed This is overridden from DotnetCompile.java because VBC uses "/win32resource:" rather than "/win32res:"
voidsetImports(String imports)
Declare global imports for namespaces in referenced metadata files.
voidsetOptionCompare(String optionCompare)
Specify binary- or text-style string comparisons.
voidsetOptionExplicit(boolean flag)
Whether to require explicit declaration of variables.
voidsetOptionStrict(boolean flag)
Enforce strict language semantics.
voidsetRemoveIntChecks(boolean flag)
Whether to remove integer checks.
voidsetRootNamespace(String rootNamespace)
Specifies the root namespace for all type declarations.
protected voidvalidate()
validation code

Constructor Detail

VisualBasicCompile

public VisualBasicCompile()
Constructor for VisualBasicCompile.

Method Detail

addCompilerSpecificOptions

protected void addCompilerSpecificOptions(NetCommand command)
implement VBC commands

Parameters: command

clear

public void clear()
reset all contents.

createResourceParameter

protected String createResourceParameter(DotnetResource resource)
from a resource, get the resource param

Parameters: resource

Returns: a string containing the resource param, or a null string to conditionally exclude a resource.

getFileExtension

public String getFileExtension()
Get the extension of filenames to compile.

Returns: The string extension of files to compile.

getImports

public String getImports()
Get global imports for namespaces in referenced metadata files.

Returns: the imports string.

getImportsParameter

protected String getImportsParameter()
Format the option for imports.

Returns: the formatted import option.

getOptionCompare

public String getOptionCompare()
"binary" or "text" for the string-comparison style.

Returns: the option compare style.

getOptionCompareParameter

protected String getOptionCompareParameter()
Format the option for string comparison style.

Returns: The formatted option.

getOptionExplicit

public boolean getOptionExplicit()
Get the flag for whether to require explicit declaration of variables.

Returns: true if flag is turned on

getOptionExplicitParameter

public String getOptionExplicitParameter()
Form the option string for optionExplicit..

Returns: The parameter string.

getOptionStrict

public boolean getOptionStrict()
Get the flag for whether to enforce strict language semantics.

Returns: true if flag is turned on

getOptionStrictParameter

public String getOptionStrictParameter()
For the option string for optionStrict.

Returns: The parameter string.

getReferenceDelimiter

public String getReferenceDelimiter()
Get the delimiter that the compiler uses between references. For example, c# will return ";"; VB.NET will return ","

Returns: The string delimiter for the reference string.

getRemoveIntChecks

public boolean getRemoveIntChecks()
Get the flag for removing integer checks.

Returns: true if flag is turned on

getRemoveIntChecksParameter

public String getRemoveIntChecksParameter()
Form the option string for removeIntChecks.

Returns: The parameter string.

getRootNamespace

public String getRootNamespace()
Get the root namespace.

Returns: the root namespace.

getRootNamespaceParameter

protected String getRootNamespaceParameter()
Form the option string for rootNamespace.

Returns: the root namespace option string.

getWin32ResParameter

protected String getWin32ResParameter()
get the argument or null for no argument needed This is overridden from DotnetCompile.java because VBC uses "/win32resource:" rather than "/win32res:"

Returns: The Win32Res Parameter to CSC

setImports

public void setImports(String imports)
Declare global imports for namespaces in referenced metadata files.

Parameters: imports the imports string

setOptionCompare

public void setOptionCompare(String optionCompare)
Specify binary- or text-style string comparisons. Defaults to "binary"

Parameters: optionCompare the option compare style. "text" | "binary".

setOptionExplicit

public void setOptionExplicit(boolean flag)
Whether to require explicit declaration of variables.

Parameters: flag on/off flag

setOptionStrict

public void setOptionStrict(boolean flag)
Enforce strict language semantics.

Parameters: flag on/off flag

setRemoveIntChecks

public void setRemoveIntChecks(boolean flag)
Whether to remove integer checks. Default false.

Parameters: flag on/off flag

setRootNamespace

public void setRootNamespace(String rootNamespace)
Specifies the root namespace for all type declarations.

Parameters: rootNamespace a root namespace.

validate

protected void validate()
validation code

Throws: BuildException if validation failed

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