public class AjcTask
extends MatchingTask
See the development environment guide for usage documentation.
| Modifier and Type | Class and Description |
|---|---|
static class |
AjcTask.GuardedCommand
Commandline wrapper that only permits addition of non-empty values and converts to argfile form if necessary.
|
| Modifier and Type | Field and Description |
|---|---|
protected AjcTask.GuardedCommand |
cmd |
static java.lang.String |
COMMAND_EDITOR_NAME |
| Constructor and Description |
|---|
AjcTask() |
| Modifier and Type | Method and Description |
|---|---|
protected static void |
addFlaggedPath(java.lang.String flag,
Path path,
java.util.List list) |
protected void |
addListArgs(java.util.List list)
Add to list any path or plural arguments.
|
protected boolean |
check(java.io.File file,
java.lang.String name,
boolean isDir,
Location loc)
Throw BuildException unless file is valid.
|
Path |
createArgfiles() |
Path |
createAspectpath() |
Path |
createBootclasspath() |
Path |
createClasspath() |
Path |
createExtdirs() |
Path |
createForkclasspath() |
Path |
createInjars() |
Path |
createInpath() |
Path |
createInxml() |
Commandline.Argument |
createJvmarg()
support for nested <jvmarg> elements
|
Path |
createSourceRoots() |
Path |
createSrc() |
Path |
createSrcdir() |
protected void |
doCompletionTasks()
Called when compile or incremental compile is completing, this completes the output jar or directory by copying resources if
requested.
|
protected int |
execInOtherVM(java.lang.String[] args)
Execute in another process using the same JDK and the base directory of the project.
|
void |
execute()
Compile using ajc per settings.
|
protected void |
executeInOtherVM(java.lang.String[] args)
Execute in a separate VM.
|
protected void |
executeInSameVM(java.lang.String[] args)
Run the compile in the same VM by loading the compiler (Main), setting up any message holders, doing the compile, and
converting abort/failure and error messages to BuildException, as appropriate.
|
static java.io.File |
findAspectjtoolsJar()
Find aspectjtools.jar on the task or system classpath.
|
protected void |
ignore(java.lang.String ignored) |
protected Path |
incPath(Path source,
Path toAdd)
Add path elements to source path and return result.
|
boolean |
isForked() |
boolean |
isInIncrementalFileMode() |
boolean |
isInIncrementalMode() |
protected void |
logVerbose(java.lang.String text) |
boolean |
quit()
Halt processing.
|
void |
readArguments(java.lang.String[] args)
Read arguments in as if from a command line, mainly to support compiler adapter compilerarg subelement.
|
void |
reset()
to use this same Task more than once (testing)
|
void |
setArgfiles(Path path) |
void |
setArgfilesref(Reference ref) |
void |
setAspectpath(Path path) |
void |
setAspectpathref(Reference ref) |
void |
setBootclasspath(Path path) |
void |
setBootclasspathref(Reference bootclasspathref) |
void |
setCheckRuntimeVersion(boolean b) |
void |
setClasspath(Path path) |
void |
setClasspathref(Reference classpathref) |
void |
setCommandEditor(ICommandEditor editor)
direct API for testing
|
void |
setCommandEditorClass(java.lang.String className)
Setup command-line filter.
|
void |
setCompliance(java.lang.String input)
Language compliance level.
|
void |
setCopyInjars(boolean doCopy)
Flag to copy all non-.class contents of injars to outjar after compile completes.
|
void |
setCrossrefs(boolean on) |
void |
setDebug(boolean debug) |
void |
setDebugLevel(java.lang.String level) |
void |
setDeprecation(boolean deprecation) |
void |
setDestdir(java.io.File dir) |
void |
setEmacssym(boolean emacssym) |
void |
setEncoding(java.lang.String encoding) |
void |
setExtdirs(Path path) |
void |
setExtdirsref(Reference ref) |
void |
setFailonerror(boolean failonerror) |
void |
setFork(boolean fork) |
void |
setForkclasspath(Path path) |
void |
setForkclasspathref(Reference forkclasspathref) |
void |
setHelp(boolean help) |
void |
setIncremental(boolean incremental) |
void |
setInjars(Path path) |
void |
setInjarsref(Reference ref) |
void |
setInpath(Path path) |
void |
setInpathDirCopyFilter(java.lang.String filter)
Option to copy all files from all inpath directories except the files specified here.
|
void |
setInpathref(Reference ref) |
void |
setInxml(Path path) |
void |
setInxmlref(Reference ref) |
void |
setListFileArgs(boolean listFileArgs) |
void |
setLog(java.io.File file) |
void |
setLogCommand(boolean logCommand) |
void |
setMaxmem(java.lang.String maxMem) |
void |
setMessageHolder(IMessageHolder holder)
direct API for testing
|
void |
setMessageHolderClass(java.lang.String className)
Setup custom message handling.
|
void |
setNoExit(boolean noExit) |
void |
setNoImportError(boolean noImportError) |
void |
setNowarn(boolean nowarn) |
void |
setNoWeave(boolean b) |
void |
setOutjar(java.io.File file) |
void |
setOutxml(boolean outxml) |
void |
setOutxmlfile(java.lang.String name) |
void |
setParameters(boolean b) |
void |
setPreserveAllLocals(boolean preserveAllLocals) |
void |
setProc(java.lang.String proc)
Controls whether annotation processing and/or compilation is done.
|
void |
setProceedOnError(boolean proceedOnError) |
void |
setProcessor(java.lang.String processors)
-processor class1[,class2,class3...]
Names of the annotation processors to run.
|
void |
setProcessorpath(java.lang.String processorpath)
-processorpath path
Specify where to find annotation processors; if this option is not used, the class path will be searched for processors.
|
void |
setReferenceInfo(boolean referenceInfo) |
void |
setS(java.lang.String s)
-s dir
Specify the directory where to place generated source files.
|
void |
setShowWeaveInfo(boolean showweaveinfo) |
void |
setSource(java.lang.String input)
Source compliance level.
|
void |
setSourceRootCopyFilter(java.lang.String filter)
Option to copy all files from all source root directories except those specified here.
|
void |
setSourceRoots(Path roots) |
void |
setSourcerootsref(Reference ref) |
void |
setSrcDir(Path path) |
void |
setTagFile(java.io.File file) |
void |
setTarget(java.lang.String input) |
void |
setTime(boolean time) |
void |
setTimers(boolean timers) |
java.lang.String |
setupAjc(Javac javac)
This method extracts javac arguments to ajc, and add arguments to make ajc behave more like javac in copying resources.
|
protected void |
setupOptions()
Create any pseudo-options required to implement some of the macro options
|
void |
setVerbose(boolean verbose) |
void |
setVersion(boolean version) |
void |
setWarn(java.lang.String warnings) |
void |
setX(java.lang.String input) |
void |
setXaddSerialVersionUID(boolean addUID) |
void |
setXDoneSignal(java.lang.String doneSignal) |
void |
setXJoinpoints(java.lang.String optionalJoinpoints) |
void |
setXlint(java.lang.String xlint)
-Xlint:{error|warning|info} - set default level for -Xlint messages
|
void |
setXlintfile(java.io.File xlintFile)
-Xlintfile {lint.properties} - enable or disable specific forms of -Xlint messages based on a lint properties file (default
is
org/aspectj/weaver/XLintDefault.properties) |
void |
setXlintwarnings(boolean xlintwarnings)
-Xlint - set default level of -Xlint messages to warning (same as -Xlint:warning)
|
void |
setXmlConfigured(boolean xmlConfigured) |
void |
setXNoInline(boolean noInline) |
void |
setXNotReweavable(boolean notReweavable) |
void |
setXNoWeave(boolean b) |
void |
setXReweavable(boolean reweavable) |
void |
setXTerminateAfterCompilation(boolean b) |
void |
setXWeaveDir(java.io.File file) |
protected java.lang.String |
validCommaList(java.lang.String list,
java.util.List valid,
java.lang.String label) |
protected java.lang.String |
validCommaList(java.lang.String list,
java.util.List valid,
java.lang.String label,
int max) |
protected void |
verifyOptions() |
protected java.io.File |
zipDirectory(java.io.File dir) |
public static final java.lang.String COMMAND_EDITOR_NAME
protected AjcTask.GuardedCommand cmd
public java.lang.String setupAjc(Javac javac)
Pass ajc-specific options using compilerarg sub-element:
<javac srcdir="src">
<compilerarg compiler="..." line="-argfile src/args.lst"/>
<javac>
Some javac arguments are not supported in this component (yet):
String memoryInitialSize; boolean includeAntRuntime = true; boolean includeJavaRuntime = false;Other javac arguments are not supported in ajc 1.1:
boolean optimize; String forkedExecutable; FacadeTaskHelper facade; boolean depend; String debugLevel; Path compileSourcepath;
javac - the Javac command to implement (not null)ajc - the AjcTask to adapt (not null)destDir - the File class destination directory (may be null)public static java.io.File findAspectjtoolsJar()
aspectj{-}tools{...}.jar mainly to support build
systems using maven-style re-naming (e.g., aspectj-tools-1.1.0.jar. Note that we search the task classpath
first, though an entry on the system classpath would be loaded first, because it seems more correct as the more specific one.public void reset()
protected void ignore(java.lang.String ignored)
protected java.lang.String validCommaList(java.lang.String list,
java.util.List valid,
java.lang.String label)
protected java.lang.String validCommaList(java.lang.String list,
java.util.List valid,
java.lang.String label,
int max)
public void setProc(java.lang.String proc)
public void setProcessor(java.lang.String processors)
public void setProcessorpath(java.lang.String processorpath)
public void setS(java.lang.String s)
public void setIncremental(boolean incremental)
public void setLogCommand(boolean logCommand)
public void setHelp(boolean help)
public void setVersion(boolean version)
public void setXTerminateAfterCompilation(boolean b)
public void setXReweavable(boolean reweavable)
public void setXmlConfigured(boolean xmlConfigured)
public void setXJoinpoints(java.lang.String optionalJoinpoints)
public void setCheckRuntimeVersion(boolean b)
public void setXNoWeave(boolean b)
public void setNoWeave(boolean b)
public void setXNotReweavable(boolean notReweavable)
public void setXaddSerialVersionUID(boolean addUID)
public void setXNoInline(boolean noInline)
public void setShowWeaveInfo(boolean showweaveinfo)
public void setNowarn(boolean nowarn)
public void setDeprecation(boolean deprecation)
public void setWarn(java.lang.String warnings)
public void setDebug(boolean debug)
public void setDebugLevel(java.lang.String level)
public void setEmacssym(boolean emacssym)
public void setCrossrefs(boolean on)
public void setXlintwarnings(boolean xlintwarnings)
public void setXlint(java.lang.String xlint)
xlint - the String with one of error, warning, ignoredpublic void setXlintfile(java.io.File xlintFile)
org/aspectj/weaver/XLintDefault.properties)xlintFile - the File with lint propertiespublic void setPreserveAllLocals(boolean preserveAllLocals)
public void setNoImportError(boolean noImportError)
public void setEncoding(java.lang.String encoding)
public void setLog(java.io.File file)
public void setProceedOnError(boolean proceedOnError)
public void setVerbose(boolean verbose)
public void setTimers(boolean timers)
public void setListFileArgs(boolean listFileArgs)
public void setReferenceInfo(boolean referenceInfo)
public void setTime(boolean time)
public void setNoExit(boolean noExit)
public void setFailonerror(boolean failonerror)
public boolean isForked()
public void setFork(boolean fork)
public void setMaxmem(java.lang.String maxMem)
public Commandline.Argument createJvmarg()
public void setTagFile(java.io.File file)
public void setOutjar(java.io.File file)
public void setOutxml(boolean outxml)
public void setOutxmlfile(java.lang.String name)
public void setDestdir(java.io.File dir)
public void setTarget(java.lang.String input)
input - a String in TARGET_INPUTSpublic void setCompliance(java.lang.String input)
input - a String in COMPLIANCE_INPUTSpublic void setSource(java.lang.String input)
input - a String in SOURCE_INPUTSpublic void setParameters(boolean b)
public void setCopyInjars(boolean doCopy)
doCopy - public void setSourceRootCopyFilter(java.lang.String filter)
filter - a String acceptable as an excludes filter for an Ant Zip fileset.public void setInpathDirCopyFilter(java.lang.String filter)
filter - a String acceptable as an excludes filter for an Ant Zip fileset.public void setX(java.lang.String input)
public void setXDoneSignal(java.lang.String doneSignal)
public void setMessageHolder(IMessageHolder holder)
public void setMessageHolderClass(java.lang.String className)
className - the String fully-qualified-name of a class reachable from this object's class loader, implementing
IMessageHolder, and having a public no-argument constructor.BuildException - if unable to create instance of classNamepublic void setCommandEditor(ICommandEditor editor)
public void setCommandEditorClass(java.lang.String className)
org.aspectj.tools.ant.taskdefs.AjcTask.COMMAND_EDITOR with the className parameter.className - the String fully-qualified-name of a class reachable from this object's class loader, implementing
ICommandEditor, and having a public no-argument constructor.BuildException - if unable to create instance of classNameprotected Path incPath(Path source,
Path toAdd)
source - the Path to add to - may be nulltoAdd - the Path to add - may be nullpublic void setSourcerootsref(Reference ref)
public void setSourceRoots(Path roots)
public Path createSourceRoots()
public void setXWeaveDir(java.io.File file)
public void setInjarsref(Reference ref)
public void setInpathref(Reference ref)
public void setInjars(Path path)
public void setInpath(Path path)
public Path createInjars()
public Path createInpath()
public void setClasspath(Path path)
public void setClasspathref(Reference classpathref)
public Path createClasspath()
public void setBootclasspath(Path path)
public void setBootclasspathref(Reference bootclasspathref)
public Path createBootclasspath()
public void setForkclasspath(Path path)
public void setForkclasspathref(Reference forkclasspathref)
public Path createForkclasspath()
public void setExtdirs(Path path)
public void setExtdirsref(Reference ref)
public Path createExtdirs()
public void setAspectpathref(Reference ref)
public void setAspectpath(Path path)
public Path createAspectpath()
public void setSrcDir(Path path)
public Path createSrc()
public Path createSrcdir()
public boolean isInIncrementalMode()
public boolean isInIncrementalFileMode()
public void setArgfilesref(Reference ref)
public void setArgfiles(Path path)
public Path createArgfiles()
public void setInxmlref(Reference ref)
public void setInxml(Path path)
public Path createInxml()
public void execute()
throws BuildException
BuildException - if the compilation has problems or if there were compiler errors and failonerror is true.public boolean quit()
protected void setupOptions()
BuildException - if options conflictprotected java.io.File zipDirectory(java.io.File dir)
protected void verifyOptions()
protected void executeInSameVM(java.lang.String[] args)
BuildException - if abort or failure messages or if errors and failonerror.protected void executeInOtherVM(java.lang.String[] args)
args - String[] of the complete compiler command to executeBuildException - if ajc aborts (negative value) or if failonerror and there were compile errors.DefaultCompilerAdapter#executeExternalCompile(String[], int)protected int execInOtherVM(java.lang.String[] args)
args - protected static void addFlaggedPath(java.lang.String flag,
Path path,
java.util.List list)
protected void addListArgs(java.util.List list)
throws BuildException
BuildExceptionprotected final boolean check(java.io.File file,
java.lang.String name,
boolean isDir,
Location loc)
file - the File to checkname - the symbolic name to print on errorisDir - if true, verify file is a directoryloc - the Location used to create sensible BuildExceptionBuildException - unless file validprotected void doCompletionTasks()
public void readArguments(java.lang.String[] args)
args - the String[] of arguments to readprotected void logVerbose(java.lang.String text)