public class Rmic extends MatchingTask
Runs the rmic compiler against classes.
Rmic can be run on a single class (as specified with the classname
attribute) or a number of classes at once (all classes below base that
are neither _Stub nor _Skel classes). If you want to rmic a single
class and this class is a class nested into another class, you have to
specify the classname in the form Outer$$Inner
instead of
Outer.Inner
.
It is possible to refine the set of files that are being rmiced. This can be done with the includes, includesfile, excludes, excludesfile and defaultexcludes attributes. With the includes or includesfile attribute you specify the files you want to have included by using patterns. The exclude or excludesfile attribute is used to specify the files you want to have excluded. This is also done with patterns. And finally with the defaultexcludes attribute, you can specify whether you want to use default exclusions or not. See the section on directory based tasks, on how the inclusion/exclusion of files works, and how to write patterns.
This task forms an implicit FileSet and
supports all attributes of <fileset>
(dir
becomes base
) as well as the nested
<include>
, <exclude>
and
<patternset>
elements.
It is possible to use different compilers. This can be selected
with the "build.rmic" property or the compiler
attribute. There are three choices:
The miniRMI project contains a compiler implementation for this task as well, please consult miniRMI's documentation to learn how to use it.
Modifier and Type | Class and Description |
---|---|
class |
Rmic.ImplementationSpecificArgument
Adds an "compiler" attribute to Commandline$Attribute used to
filter command line attributes based on the current
implementation.
|
Modifier and Type | Field and Description |
---|---|
static String |
ERROR_BASE_NOT_SET
base attribute not set message
|
static String |
ERROR_LOADING_CAUSED_EXCEPTION
loaded error message
|
static String |
ERROR_NO_BASE_EXISTS
base not exists message
|
static String |
ERROR_NOT_A_DIR
base not a directory message
|
static String |
ERROR_NOT_DEFINED
not defined message
|
static String |
ERROR_NOT_FOUND
could not be found message
|
static String |
ERROR_RMIC_FAILED
rmic failed message
|
static String |
ERROR_UNABLE_TO_VERIFY_CLASS
unable to verify message
|
fileset
Constructor and Description |
---|
Rmic()
Constructor for Rmic.
|
Modifier and Type | Method and Description |
---|---|
void |
add(RmicAdapter adapter)
Set the compiler adapter explicitly.
|
protected void |
cleanup()
Cleans up resources.
|
Path |
createClasspath()
Creates a nested classpath element.
|
Rmic.ImplementationSpecificArgument |
createCompilerArg()
Adds an implementation specific command line argument.
|
Path |
createCompilerClasspath()
The classpath to use when loading the compiler implementation
if it is not a built-in one.
|
Path |
createExtdirs()
Maybe creates a nested extdirs element.
|
void |
execute()
execute by creating an instance of an implementation
class and getting to do the work
|
File |
getBase()
Gets the base directory to output generated class.
|
String |
getClassname()
Gets the class name to compile.
|
Path |
getClasspath()
Gets the classpath.
|
Vector |
getCompileList() |
String |
getCompiler()
get the name of the current compiler
|
String[] |
getCurrentCompilerArgs()
Get the additional implementation specific command line arguments.
|
boolean |
getDebug()
Gets the debug flag.
|
File |
getDestdir()
Gets the base directory to output the generated files.
|
String |
getExecutable()
Explicitly specified name of the executable to use when forking
- if any.
|
Path |
getExtdirs()
Gets the extension directories that will be used during the
compilation.
|
Vector |
getFileList()
Gets file list to compile.
|
boolean |
getFiltering()
Gets whether token filtering is set
|
boolean |
getIdl()
Gets IDL flags.
|
String |
getIdlopts()
Gets additional arguments for idl compile.
|
boolean |
getIiop()
Gets iiop flags.
|
String |
getIiopopts()
Gets additional arguments for iiop.
|
boolean |
getIncludeantruntime()
Gets whether or not the ant classpath is to be included in the
task's classpath.
|
boolean |
getIncludejavaruntime()
Gets whether or not the java runtime should be included in this
task's classpath.
|
java.lang.ClassLoader |
getLoader()
Classloader for the user-specified classpath.
|
File |
getOutputDir()
Gets the base directory to output the generated files,
favoring destdir if set, otherwise defaulting to basedir.
|
Class |
getRemoteInterface(Class testClass)
Returns the topmost interface that extends Remote for a given
class - if one exists.
|
File |
getSourceBase()
Gets the source dirs to find the source java files.
|
String |
getStubVersion()
Gets the JDK version for the generated stub code.
|
boolean |
getVerify()
Get verify flag.
|
boolean |
isValidRmiRemote(String classname)
Load named class and test whether it can be rmic'ed
|
protected void |
scanDir(File baseDir,
String[] files,
FileNameMapper mapper)
Scans the directory looking for class files to be compiled.
|
void |
setBase(File base)
Sets the location to store the compiled files; required
|
void |
setClassname(String classname)
Sets the class to run
rmic against;
optional |
void |
setClasspath(Path classpath)
Set the classpath to be used for this compilation.
|
void |
setClasspathRef(Reference pathRef)
Adds to the classpath a reference to
a <path> defined elsewhere.
|
void |
setCompiler(String compiler)
Sets the compiler implementation to use; optional,
defaults to the value of the
build.rmic property,
or failing that, default compiler for the current VM |
void |
setDebug(boolean debug)
Generate debug info (passes -g to rmic);
optional, defaults to false
|
void |
setDestdir(File destdir)
Sets the base directory to output the generated files.
|
void |
setExecutable(String ex)
Name of the executable to use when forking.
|
void |
setExtdirs(Path extDirs)
Sets the extension directories that will be used during the
compilation; optional.
|
void |
setFiltering(boolean filter)
Sets token filtering [optional], default=false
|
void |
setIdl(boolean idl)
Indicates that IDL output should be
generated.
|
void |
setIdlopts(String idlOpts)
pass additional arguments for IDL compile
|
void |
setIiop(boolean iiop)
Indicates that IIOP compatible stubs should
be generated; optional, defaults to false
if not set.
|
void |
setIiopopts(String iiopOpts)
Set additional arguments for iiop
|
void |
setIncludeantruntime(boolean include)
Sets whether or not to include ant's own classpath in this task's
classpath.
|
void |
setIncludejavaruntime(boolean include)
task's classpath.
|
void |
setListfiles(boolean list)
If true, list the source files being handed off to the compiler.
|
void |
setSourceBase(File sourceBase)
optional directory to save generated source files to.
|
void |
setStubVersion(String stubVersion)
Specify the JDK version for the generated stub code.
|
void |
setVerify(boolean verify)
Flag to enable verification so that the classes
found by the directory match are
checked to see if they implement java.rmi.Remote.
|
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
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
clone, getDescription, getLocation, getProject, setDescription, setLocation
public static final String ERROR_BASE_NOT_SET
public static final String ERROR_LOADING_CAUSED_EXCEPTION
public static final String ERROR_NO_BASE_EXISTS
public static final String ERROR_NOT_A_DIR
public static final String ERROR_NOT_DEFINED
public static final String ERROR_NOT_FOUND
public static final String ERROR_RMIC_FAILED
public static final String ERROR_UNABLE_TO_VERIFY_CLASS
public void add(RmicAdapter adapter)
protected void cleanup()
public Path createClasspath()
public Rmic.ImplementationSpecificArgument createCompilerArg()
public Path createCompilerClasspath()
public Path createExtdirs()
public void execute() throws BuildException
execute
in class Task
BuildException
- if there's a problem with baseDir or RMICpublic File getBase()
public String getClassname()
public Path getClasspath()
public Vector getCompileList()
public String getCompiler()
public String[] getCurrentCompilerArgs()
public boolean getDebug()
public File getDestdir()
public String getExecutable()
public Path getExtdirs()
public Vector getFileList()
public boolean getFiltering()
public boolean getIdl()
public String getIdlopts()
public boolean getIiop()
public String getIiopopts()
public boolean getIncludeantruntime()
public boolean getIncludejavaruntime()
public java.lang.ClassLoader getLoader()
public File getOutputDir()
public Class getRemoteInterface(Class testClass)
testClass
- the class to be testedpublic File getSourceBase()
public String getStubVersion()
public boolean getVerify()
public boolean isValidRmiRemote(String classname)
classname
- the name of the class to be testedprotected void scanDir(File baseDir, String[] files, FileNameMapper mapper)
baseDir
- the base directionfiles
- the list of files to scanmapper
- the mapper of files to target filespublic void setBase(File base)
base
- the location to store the compiled filespublic void setClassname(String classname)
rmic
against;
optionalclassname
- the name of the class for rmic to create code forpublic void setClasspath(Path classpath)
classpath
- the classpath used for this compilationpublic void setClasspathRef(Reference pathRef)
pathRef
- the reference to add to the classpathpublic void setCompiler(String compiler)
build.rmic
property,
or failing that, default compiler for the current VMcompiler
- the compiler implementation to usepublic void setDebug(boolean debug)
debug
- turn on debug infopublic void setDestdir(File destdir)
destdir
- the base directory to output the generated files.public void setExecutable(String ex)
public void setExtdirs(Path extDirs)
extDirs
- the extension directories to be usedpublic void setFiltering(boolean filter)
filter
- turn on token filteringpublic void setIdl(boolean idl)
idl
- generate IDL outputpublic void setIdlopts(String idlOpts)
idlOpts
- additional IDL argumentspublic void setIiop(boolean iiop)
iiop
- generate IIOP compatible stubspublic void setIiopopts(String iiopOpts)
iiopOpts
- additional arguments for iioppublic void setIncludeantruntime(boolean include)
true
.include
- if true include ant's classpathpublic void setIncludejavaruntime(boolean include)
include
- if true include default run-time librariespublic void setListfiles(boolean list)
list
- if true list the source filespublic void setSourceBase(File sourceBase)
sourceBase
- the directory to save source files to.public void setStubVersion(String stubVersion)
stubVersion
- the JDK versionpublic void setVerify(boolean verify)
verify
- turn on verification for classes