ajc

Name

ajc — compiler and bytecode weaver for the AspectJ and Java languages

Synopsis

ajc [Options] [file... | @file... | -argfile file...]

Description

The ajc command compiles AspectJ and Java language files, weaving aspects as necessary to produce .class files compliant with any Java VM (1.1 or later). To do bytecode weaving, it also accepts input classes or aspects in binary form.

The arguments after the options specify the source file(s) to compile. (Specify source classes using the -injars option, below.) Files may be listed directly on the command line, or listed in a file. The -argfile file and @file forms are equivalent, and are interpreted as meaning all the files listed in the specified file. Each line in these files should contain one option or filename. Comments, as in Java, start with // and extend to the end of the line.

NB: You must explicitly pass ajc all sources necessary for the compilation. When compiling source files containing aspects or pointcuts, be sure to include the source files for any types affected by the aspects or picked out by the pointcuts. (To exclude types from the scope affected by the aspect, change the corresponding pointcut or declaration.) This is necessary because, unlike javac, ajc does not search the sourcepath for classes. You may use the -sourceroots option to specify as source all the .aj and .java files in a set of directory trees.

Options

-injars JarList

Accept as source bytecode any .class files inside the specified .jar files. The output will include these classes, possibly as woven with any applicable aspects. JarList, like classpath, is a single argument containing a list of paths to jar files, delimited by the platform- specific classpath delimiter.

-aspectpath JarList

Weave binary aspects from JarList zip files into all sources. The aspects should have been output by the same version of the compiler. To run the output classes requires putting all the aspectpath entries on the run classpath. JarList, like classpath, is a single argument containing a list of paths to jar files, delimited by the platform- specific classpath delimiter.

-argfile File

The file is a line-delimited list of arguments. These arguments are inserted into the argument list.

-outjar output.jar

Put output classes in zip file output.jar.

-incremental

Run the compiler continuously. After the initial compilation, the compiler will wait to recompile until it reads a newline from the standard input, and will quit when it reads a 'q'. It will only recompile necessary components, so a recompile should be much faster than doing a second compile. This requires -sourceroots.

-sourceroots DirPaths

Find and build all .java or .aj source files under any directory listed in DirPaths. DirPaths, like classpath, is a single argument containing a list of paths to directories, delimited by the platform- specific classpath delimiter. Required by -incremental.

-emacssym

Generate .ajesym symbol files for emacs support

-Xlint

Same as -Xlint:warning (enabled by default)

-Xlint:{level}

Set default level for messages about potential programming mistakes in crosscutting code. {level} may be ignore, warning, or error. This overrides entries in org/aspectj/weaver/XlintDefault.properties from aspectjtools.jar, but does not override levels set using the -Xlintfile option.

-Xlintfile PropertyFile

Specify properties file to set levels for specific crosscutting messages. PropertyFile is a path to a Java .properties file that takes the same property names and values as org/aspectj/weaver/XlintDefault.properties from aspectjtools.jar, which it also overrides.

-help

Emit information on compiler options and usage

-version

Emit the version of the AspectJ compiler

-classpath Path

Specify where to find user class files. Path is a single argument containing a list of paths to zip files or directories, delimited by the platform-specific path delimiter.

-bootclasspath Path

 Next


Installing Ant Tasks

Install Jakarta Ant 1.5.1: Please see the official Jakarta Ant website for more information and the 1.5.1 distribution. This release is source-compatible with Ant 1.3 and Ant 1.4, but the task sources must be compiled with those versions of the Ant libraries to be used under those versions of Ant. Sources are available under the Common Public License v. 1.0 at http://eclipse.org/aspectj.

In Ant, third-party tasks can be declared using a taskdef entry in the build script, to identify the name and classes. When declaring a task, include the aspectjtools.jar either in the taskdef classpath or in ${ANT_HOME}/lib where it will be added to the system class path by the ant script. You may specify the task script names directly, or use the "resource" attribute to specify the default names:

    
  <taskdef 
      resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">

    

The current resource file retains the name "ajc" for the Ajc10 task, and uses "iajc" for the AspectJ 1.1 task.

For more information on using Ant, please refer to Jakarta's documentation on integrating user-defined Ant tasks into builds.

./usr/share/doc/aspectj-doc/devguide/antTasks.html0100644000000000000000000001133410045553665021053 0ustar rootroot Chapter 2. AspectJ Ant Tasks

Chapter 2. AspectJ Ant Tasks

Introduction

AspectJ contains a compiler, ajc, that can be run from Ant. Included in the aspectjtools.jar are Ant binaries to support three ways of running the compiler:

  1. AjcTask (iajc), a task to run the new AspectJ 1.1 compiler, which supports all the eclipse and ajc options, including incremental mode.

  2. Ajc11CompilerAdapter (javac), an adapter class to run the new compiler using Javac tasks by setting the build.compiler property

  3. Ajc10 (ajc), a task to run build scripts compatible with the AspectJ 1.0 tasks

This describes how to install and use the tasks and the adapter. For an example Ant script, see examples/build.xml.

./usr/share/doc/aspectj-doc/devguide/ajc-ref.html0100644000000000000000000006260610045553663020600 0ustar rootroot ajc

ajc

Name

ajc — compiler and bytecode weaver for the AspectJ and Java languages

Synopsis

ajc [Options] [file... | @file... | -argfile file...]

Description

The ajc command compiles AspectJ and Java language files, weaving aspects as necessary to produce .class files compliant with any Java VM (1.1 or later). To do bytecode weaving, it also accepts input classes or aspects in binary form.

The arguments after the options specify the source file(s) to compile. (Specify source classes using the -injars option, below.) Files may be listed directly on the command line, or listed in a file. The -argfile file and @file forms are equivalent, and are interpreted as meaning all the files listed in the specified file. Each line in these files should contain one option or filename. Comments, as in Java, start with // and extend to the end of the line.

NB: You must explicitly pass ajc all sources necessary for the compilation. When compiling source files containing aspects or pointcuts, be sure to include the source files for any types affected by the aspects or picked out by the pointcuts. (To exclude types from the scope affected by the aspect, change the corresponding pointcut or declaration.) This is necessary because, unlike javac, ajc does not search the sourcepath for classes. You may use the -sourceroots option to specify as source all the .aj and .java files in a set of directory trees.

Options

-injars JarList

Accept as source bytecode any .class files inside the specified .jar files. The output will include these classes, possibly as woven with any applicable aspects. JarList, like classpath, is a single argument containing a list of paths to jar files, delimited by the platform- specific classpath delimiter.

-aspectpath JarList

Weave binary aspects from JarList zip files into all sources. The aspects should have been output by the same version of the compiler. To run the output classes requires putting all the aspectpath entries on the run classpath. JarList, like classpath, is a single argument containing a list of paths to jar files, delimited by the platform- specific classpath delimiter.

-argfile File

The file is a line-delimited list of arguments. These arguments are inserted into the argument list.

-outjar output.jar

Put output classes in zip file output.jar.

-incremental

Run the compiler continuously. After the initial compilation, the compiler will wait to recompile until it reads a newline from the standard input, and will quit when it reads a 'q'. It will only recompile necessary components, so a recompile should be much faster than doing a second compile. This requires -sourceroots.

-sourceroots DirPaths

Find and build all .java or .aj source files under any directory listed in DirPaths. DirPaths, like classpath, is a single argument containing a list of paths to directories, delimited by the platform- specific classpath delimiter. Required by -incremental.

-emacssym

Generate .ajesym symbol files for emacs support

-Xlint

Same as -Xlint:warning (enabled by default)

-Xlint:{level}

Set default level for messages about potential programming mistakes in crosscutting code. {level} may be ignore, warning, or error. This overrides entries in org/aspectj/weaver/XlintDefault.properties from aspectjtools.jar, but does not override levels set using the -Xlintfile option.

-Xlintfile PropertyFile

Specify properties file to set levels for specific crosscutting messages. PropertyFile is a path to a Java .properties file that takes the same property names and values as org/aspectj/weaver/XlintDefault.properties from aspectjtools.jar, which it also overrides.

-help

Emit information on compiler options and usage

-version

Emit the version of the AspectJ compiler

-classpath Path

Specify where to find user class files. Path is a single argument containing a list of paths to zip files or directories, delimited by the platform-specific path delimiter.

-bootclasspath Path

 Next


Installing Ant Tasks

Install Jakarta Ant 1.5.1: Please see the official Jakarta Ant website for more information and the 1.5.1 distribution. This release is source-compatible with Ant 1.3 and Ant 1.4, but the task sources must be compiled with those versions of the Ant libraries to be used under those versions of Ant. Sources are available under the Common Public License v. 1.0 at http://eclipse.org/aspectj.

In Ant, third-party tasks can be declared using a taskdef entry in the build script, to identify the name and classes. When declaring a task, include the aspectjtools.jar either in the taskdef classpath or in ${ANT_HOME}/lib where it will be added to the system class path by the ant script. You may specify the task script names directly, or use the "resource" attribute to specify the default names:

    
  <taskdef 
      resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">

    

The current resource file retains the name "ajc" for the Ajc10 task, and uses "iajc" for the AspectJ 1.1 task.

For more information on using Ant, please refer to Jakarta's documentation on integrating user-defined Ant tasks into builds.