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

java.lang.Object
  |
  +--org.apache.tools.ant.ProjectComponent
        |
        +--org.apache.tools.ant.Task
              |
              +--org.apache.tools.ant.taskdefs.MatchingTask
                    |
                    +--org.apache.tools.ant.taskdefs.optional.dotnet.DotnetBaseMatchingTask
                          |
                          +--org.apache.tools.ant.taskdefs.optional.dotnet.DotnetCompile
                                |
                                +--org.apache.tools.ant.taskdefs.optional.dotnet.VisualBasicCompile
All 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. 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 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
additionalModules, debug, definitionList, executable, extraOptions, mainClass, REFERENCE_OPTION, 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  java.lang.String createResourceParameter(DotnetResource resource)
          from a resource, get the resource param
 java.lang.String getFileExtension()
          Get the extension of filenames to compile.
 java.lang.String getImports()
          Get global imports for namespaces in referenced metadata files.
protected  java.lang.String getImportsParameter()
          Format the option for imports.
 java.lang.String getOptionCompare()
          "binary" or "text" for the string-comparison style.
protected  java.lang.String getOptionCompareParameter()
          Format the option for string comparison style.
 boolean getOptionExplicit()
          Get the flag for whether to require explicit declaration of variables.
 java.lang.String getOptionExplicitParameter()
          Form the option string for optionExplicit..
 boolean getOptionStrict()
          Get the flag for whether to enforce strict language semantics.
 java.lang.String getOptionStrictParameter()
          For the option string for optionStrict.
 java.lang.String getReferenceDelimiter()
          Get the delimiter that the compiler uses between references.
 boolean getRemoveIntChecks()
          Get the flag for removing integer checks.
 java.lang.String getRemoveIntChecksParameter()
          Form the option string for removeIntChecks.
 java.lang.String getRootNamespace()
          Get the root namespace.
protected  java.lang.String getRootNamespaceParameter()
          Form the option string for rootNamespace.
protected  java.lang.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(java.lang.String imports)
          Declare global imports for namespaces in referenced metadata files.
 void setOptionCompare(java.lang.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(java.lang.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
addDefine, addReference, addReferenceFilesets, addResource, addResources, createNetCommand, execute, fillInSharedParameters, getAdditionalModulesParameter, getDebug, getDebugParameter, getDefinitionsDelimiter, getDefinitionsParameter, getDestFileParameter, getExecutable, getExtraOptions, getExtraOptionsParameter, getFailOnError, getFilePattern, getIncludeDefaultReferences, getIncludeDefaultReferencesParameter, getMainClass, getMainClassParameter, getOptimize, getOptimizeParameter, getReferenceFilesParameter, getReferencesParameter, getTargetType, getTargetTypeParameter, getUtf8OutputParameter, getWarnLevel, getWarnLevelParameter, getWin32IconParameter, getWin32Res, isFileManagedBinary, isUseResponseFile, notEmpty, setAdditionalModules, setDebug, setDestDir, setExecutable, setExtraOptions, setFailOnError, setIncludeDefaultReferences, setMainClass, setOptimize, setReferenceFiles, setReferences, setTargetType, setTargetType, setUseResponseFile, setUtf8Output, setWarnLevel, setWin32Icon, setWin32Res
 
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
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, XsetIgnore, XsetItems
 
Methods inherited from class org.apache.tools.ant.Task
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VisualBasicCompile

public VisualBasicCompile()
Constructor for VisualBasicCompile.

Method Detail

clear

public void clear()
reset all contents.

Overrides:
clear in class DotnetCompile

getWin32ResParameter

protected java.lang.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 class DotnetCompile
Returns:
The Win32Res Parameter to CSC

setRemoveIntChecks

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

Parameters:
flag - on/off flag

getRemoveIntChecks

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

Returns:
true if flag is turned on

getRemoveIntChecksParameter

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

Returns:
The parameter string.

setOptionExplicit

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

Parameters:
flag - on/off flag

getOptionExplicit

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

Returns:
true if flag is turned on

getOptionExplicitParameter

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

Returns:
The parameter string.

setOptionStrict

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

Parameters:
flag - on/off flag

getOptionStrict

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

Returns:
true if flag is turned on

getOptionStrictParameter

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

Returns:
The parameter string.

setRootNamespace

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

Parameters:
rootNamespace - a root namespace.

getRootNamespace

public java.lang.String getRootNamespace()
Get the root namespace.

Returns:
the root namespace.

getRootNamespaceParameter

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

Returns:
the root namespace option string.

setImports

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

Parameters:
imports - the imports string

getImports

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

Returns:
the imports string.

getImportsParameter

protected java.lang.String getImportsParameter()
Format the option for imports.

Returns:
the formatted import option.

setOptionCompare

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

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

getOptionCompare

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

Returns:
the option compare style.

getOptionCompareParameter

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

Returns:
The formatted option.

addCompilerSpecificOptions

protected void addCompilerSpecificOptions(NetCommand command)
implement VBC commands

Specified by:
addCompilerSpecificOptions in class DotnetCompile
Parameters:
command -

getReferenceDelimiter

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

Specified by:
getReferenceDelimiter in class DotnetCompile
Returns:
The string delimiter for the reference string.

getFileExtension

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

Specified by:
getFileExtension in class DotnetCompile
Returns:
The string extension of files to compile.

createResourceParameter

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

Specified by:
createResourceParameter in class DotnetCompile
Parameters:
resource -
Returns:
a string containing the resource param, or a null string to conditionally exclude a resource.

validate

protected void validate()
                 throws BuildException
validation code

Overrides:
validate in class DotnetCompile
Throws:
BuildException - if validation failed


Copyright © 2000-2004 Apache Software Foundation. All Rights Reserved.