Java Instrumentation Launcher for Ant
Purpose
The Java Instrumentation Launcher (javic) for Ant provides integration of the Java Instrumentor with the Apache Jakarta Ant build utility.
Description
This adapter allows automation of the instrumented build process for Ant users by providing an Ant CompilerAdapter implementation called com.rational.testrealtime.Javic.
The Java Instrumentation Launcher for Ant provided with the product supports version 1.4.1 of Ant, but is delivered as source code, so that you can adapt it to any release of Ant. Source code for the Javic class is available at:
<InstallDir>/lib/java/ant/com/rational/testrealtime/Javic.java
Javic uses the build.actual.compiler property to obtain the name of your Java compiler. When using JDK 1.4.0, this name is modern. Please refer to Ant documentation for other values.
In some cases -opp=<file> and -destdir=<dir> can not be set in the Javi.options property:
The .opp instrumentation file is automatically set in the -opp=<file> option by the Javic class if and only if $ATLTGT/ana/atl.opp exists.
The instrumented file repository directory, where the javi.jir subdirectory is created, is automatically set by the Javic class if the destdir attribute is set in the javac task.
-classpath=<classpath> cannot be set in the Javi.options property.
The classpath used by the Java Instrumentor is a merge of the classpath attribute of the javac task with the $CLASSPATH and $EDG_CLASSPATH contents.
$ATLTGT must point to the Java TDP directory, for example: <InstallDir>/targets/jdk_1.4.0. On Windows platforms, this path must be provided in short-name DOS format.
Options
Options for the javic launcher require double quotes ("") on some platforms. For example:
-Djavi.settings="--att_on_the_fly=0"
The Launcher accepts the following options:
--atl_threads_max=<number>
Sets the maximum number of threads at the same time. The default value is 64.
--atl_buffer_size=<bytes>
Sets the size of the Dump Buffer in bytes. The default value is 16384.
--address=<IPaddress>
Address of the Socket Trace Receiver Host. The default address is 127.0.0.1.
--uploader_port=<port number>
Port number listened to by the Socket Trace Receiver Host. The default port number is 7777.
--atl_run_gc_at_exit=0|1
Set this setting to 1 to run finalizers invoking the Garbage Collector upon exit. 0 disables the option. Default is 1.
--atj_check_stub=0|1
Check Component Testing for Java stubs. Default is 0.
--atj_display_stub=0|1
Display Component Testing for Java stubs in Runtime Tracing. Default is 0.
--att_on_the_fly=0|1
If set to 1, implies that each tdf lines are flushed immediately in order to be read on-the-fly by Runtime Tracing. Default is 1.
--att_partial_dump=0|1
Partial Message Dump is on if set to 1 in Runtime Tracing. Default is 0.
--att_timestamp=0|1
If 1 record and display Time Stamp in Runtime Tracing. Default is 1.
--att_heap_size=0|1
Record and Display Current Heap Size in Runtime Tracing. Default is 1.
--att_thread_info=0|1
Record and Display Thread Information in Runtime Tracing. Default is 1.
--att_record_max_stack=0|1
Record and Display Max Stack in a note in Runtime Tracing. Default is 1.
To install the Javic class for Ant:
Download and install Ant v1.4.1 from http://jakarta.apache.org/ant/
Set ANT_HOME to the installation directory, for example: /usr/local/jakarta-ant-1.4.1.
Add $ANT_HOME/bin in your PATH
Compile and install the Javic class. In the ant directory, type:
ant
This adds the javic.jar to the $ANT_HOME/lib directory.
Example
The files for the following example are located in <InstallDir>/lib/java/ant/example.
The following command performs a standard build based on the build.xml file
ant
This produces the following output:
Buildfile: build.xml
clean:
cc:
[javac] Compiling 1 source file
all:
BUILD SUCCESSFUL
Total time: 2 seconds
To perform an instrumented build of the same build.xml, without modifying that file:
ant -DATLTGT=$ATLTGT -Dbuild.compiler=com.rational.testrealtime.Javic -Dbuild.actual.compiler=modern -Djavi.options=-trace -Djavi.settings="--att_on_the_fly=0"
This produces the following output:
Buildfile: build.xml
clean:
[delete] Deleting: Sample.class
cc:
[javac] Compiling 1 source file
[javi] Instrumenting 1 source file
[javac] Compiling 1 source file
all:
BUILD SUCCESSFUL
Total time: 4 seconds
Related Topics