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

Class VisualBasicCompile

Implemented Interfaces:
SelectorContainer

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>

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.tools.ant.taskdefs.optional.dotnet.DotnetCompile

DotnetCompile.TargetTypes

Field Summary

Fields inherited from class org.apache.tools.ant.taskdefs.optional.dotnet.DotnetCompile

REFERENCE_OPTION, additionalModules, debug, definitionList, executable, extraOptions, mainClass, referenceFilesets, resources, targetType, utf8output

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

VisualBasicCompile()
Constructor for VisualBasicCompile.

Method Summary

protected void
addCompilerSpecificOptions(NetCommand command)
implement VBC commands
void
clear()
reset all contents.
protected String
createResourceParameter(DotnetResource resource)
from a resource, get the resource param
String
getFileExtension()
Get the extension of filenames to compile.
String
getImports()
Get global imports for namespaces in referenced metadata files.
protected String
getImportsParameter()
Format the option for imports.
String
getOptionCompare()
"binary" or "text" for the string-comparison style.
protected String
getOptionCompareParameter()
Format the option for string comparison style.
boolean
getOptionExplicit()
Get the flag for whether to require explicit declaration of variables.
String
getOptionExplicitParameter()
Form the option string for optionExplicit..
boolean
getOptionStrict()
Get the flag for whether to enforce strict language semantics.
String
getOptionStrictParameter()
For the option string for optionStrict.
String
getReferenceDelimiter()
Get the delimiter that the compiler uses between references.
boolean
getRemoveIntChecks()
Get the flag for removing integer checks.
String
getRemoveIntChecksParameter()
Form the option string for removeIntChecks.
String
getRootNamespace()
Get the root namespace.
protected String
getRootNamespaceParameter()
Form the option string for rootNamespace.
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:"
void
setImports(String imports)
Declare global imports for namespaces in referenced metadata files.
void
setOptionCompare(String optionCompare)
Specify binary- or text-style string comparisons.
void
setOptionExplicit(boolean flag)
Whether to require explicit declaration of variables.
void
setOptionStrict(boolean flag)
Enforce strict language semantics.
void
setRemoveIntChecks(boolean flag)
Whether to remove integer checks.
void
setRootNamespace(String rootNamespace)
Specifies the root namespace for all type declarations.
protected void
validate()
validation code

Methods inherited from class org.apache.tools.ant.taskdefs.optional.dotnet.DotnetCompile

addCompilerSpecificOptions, addDefine, addReference, addReferenceFilesets, addResource, addResources, clear, createNetCommand, createResourceParameter, execute, fillInSharedParameters, getAdditionalModulesParameter, getDebug, getDebugParameter, getDefinitionsDelimiter, getDefinitionsParameter, getDestFileParameter, getExecutable, getExtraOptions, getExtraOptionsParameter, getExtraOptionsParameters, getFailOnError, getFileExtension, getFilePattern, getIncludeDefaultReferences, getIncludeDefaultReferencesParameter, getMainClass, getMainClassParameter, getOptimize, getOptimizeParameter, getReferenceDelimiter, getReferenceFilesParameter, getReferencesParameter, getTargetType, getTargetTypeParameter, getUtf8OutputParameter, getWarnLevel, getWarnLevelParameter, getWin32IconParameter, getWin32Res, getWin32ResParameter, isFileManagedBinary, isUseResponseFile, notEmpty, setAdditionalModules, setDebug, setDestDir, setExecutable, setExtraOptions, setFailOnError, setIncludeDefaultReferences, setMainClass, setOptimize, setReferenceFiles, setReferences, setTargetType, setTargetType, setUseResponseFile, setUtf8Output, setWarnLevel, setWin32Icon, setWin32Res, validate

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

Constructor Details

VisualBasicCompile

public VisualBasicCompile()
Constructor for VisualBasicCompile.

Method Details

addCompilerSpecificOptions

protected void addCompilerSpecificOptions(NetCommand command)
implement VBC commands
Overrides:
addCompilerSpecificOptions in interface DotnetCompile
Parameters:
command -

clear

public void clear()
reset all contents.
Overrides:
clear in interface DotnetCompile

createResourceParameter

protected String createResourceParameter(DotnetResource resource)
from a resource, get the resource param
Overrides:
createResourceParameter in interface DotnetCompile
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.
Overrides:
getFileExtension in interface DotnetCompile
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 ","
Overrides:
getReferenceDelimiter in interface DotnetCompile
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:"
Overrides:
getWin32ResParameter in interface DotnetCompile
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()
            throws BuildException
validation code
Overrides:
validate in interface DotnetCompile
Throws:
BuildException - if validation failed

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