Globalyzer Ant Client
Lingoport provides the ability to run Globalyzer from within
the Ant build tool to allow you to integrate Globalyzer
functionality into your build/integration process. This help tells
you how to enable Globalyzer with Ant, describes the available
tasks, and gives example usages.
Enabling Globalyzer for Ant
To use Globalyzer from Ant, you will need to define a path with the
id
globalyzer.install.path
that points to the directory where the Globalyzer Client has been
installed. The following listing gives an example of defining this
on a Windows machine with the Globalyzer Client installed to the
default location:
<property
name="globalyzer.install.dir" value="C:/Program
Files/Lingoport/Globalyzer 4.9"/> <path
id="globalyzer.install.path"> <fileset
dir="${globalyzer.install.dir}" includes="**.jar"/>
</path>
The following tasks are defined for the Globalyzer Ant
library:
- globalyzer-list-projects
- globalyzer-list-scans
- globalyzer-list-rulesets
- globalyzer-list-reports
- globalyzer-scan
- globalyzer-scan-history
- globalyzer-scan-diff
- globalyzer-rule-set-diff
- globalyzer-delete-scan-results
- globalyzer-delete-project
- globalyzer-run-report
- globalyzer-export
- globalyzer-import
To use one of these tasks, you must first add a
taskdef
tag to associate the task with its corresponding class, as in the
example below for the
globalyzer-export
task:
<taskdef
name="globalyzer-export"
classname="com.lingoport.scanner.ui.ant.GlobalyzerExportScanTask"
classpathref="globalyzer.install.path"/>
It is recommended that you import these definitions from the
provided file globalyzer-typedefs.xml, as follows:
<taskdef
file="${globalyzer.install.dir}/globalyzer-typedefs.xml"
format="xml"/>
Important Note: If you are going to run Globalyzer
Ant tasks from a directory other than the Globalyzer
Client program directory
(where you installed Globalyzer), you must
use the logfile or logurl attribute with all
ant globalyzer tasks so that they have access to Globalyzer's
log4j2.xml file. See the Command
Line Client help for more information on using this option as well
as on changing the Globalyzer data directory from its [userhome]./globalyzer
default location by using the datadir attribute.
Attribute |
Description |
datadir
|
Full path to Globalyzer Data directory |
logfile
|
Full path to Globalyzer's log4j2.xml file |
logurl
|
URL path to Globalyzer's log4j2.xml file |
Globalyzer Ant Tasks
This section provides a description of the available
Globalyzer Ant tasks. All tasks have the following attribute
options:
Attribute |
Description |
Nested jvmargs element
|
the arguments to pass to the forked Java VM (jvmargs attribute is
obsolete but still supported) |
classpath
|
the classpath pointing to the Globalyzer installation
(nested classpath element is also supported) |
classpathref
|
the classpath reference pointing to the Globalyzer
installation |
Globalyzer Ant tasks are sub-classes of Ant core java task, see Ant
java task documentation for details.
Note that the examples provided assume you have included the
path
and
taskdef
definitions.
globalyzer-list-projects
The
globalyzer-list-projects
task will list the projects defined in a particular Globalyzer
installed instance.
Attribute |
Description |
verbose
|
true | false, whether to have verbose output (optional;
defaults to false) |
Example:
<globalyzer-list-projects
classpathref="globalyzer.install.path" verbose="true" />
globalyzer-list-scans
The
globalyzer-list-scans
task will list the available scans for a particular project. It
includes the following attribute options:
Attribute |
Description |
project-name
|
the project name (required) |
verbose
|
true | false, whether to have verbose output (optional;
defaults to false) |
Example:
<globalyzer-list-scans
project-name="Java project 1"
classpathref="globalyzer.install.path" verbose="true" />
globalyzer-list-rulesets
The
globalyzer-list-rulesets
task lists the defined rule sets for a particular user.
Example:
<globalyzer-list-rulesets
classpathref="globalyzer.install.path" />
globalyzer-list-reports
The
globalyzer-list-reports
task allows you to list the available reports for a particular
project. It includes the following attribute options:
Attribute |
Description |
project-name
|
the project name (required) |
verbose
|
true | false, whether to have verbose output (optional;
defaults to false) |
Example:
<globalyzer-list-reports
project-name="Java project 1"
classpathref="globalyzer.install.path" verbose="true" />
globalyzer-scan
The
globalyzer-scan
task allows you to run a particular scan. It includes the following
attribute options:
Attribute |
Description |
project-name
|
the project name (required) |
scan-name
|
the scan name, if not specified, all scans for the
specified project are scanned |
verbose
|
true | false, whether to have verbose output (optional;
defaults to false) |
Example:
<globalyzer-scan
project-name="Java project 1" scan-name="Scan 1" verbose="true"
classpathref="globalyzer.install.path" jvmargs="-Xmx512m" />
globalyzer-scan-history
The
globalyzer-scan-history
task allows you to list scan history for a particular scan. It
includes the following attribute options:
Attribute |
Description |
project-name
|
the project name (required) |
scan-name
|
the scan name (required) |
result-type
|
the result-type (optional; "embedded", "method",
"general", or "static"; if omitted "embedded" is assumed) |
xml-name
|
the name/path to an XML file to generate (optional; if
omitted outputs to console) |
ascending
|
true | false, whether to list scan history in ascending
order (oldest to newest) (optional; defaults to false) |
xsl-file
|
XSL transformation file name |
report-file
|
Report file name |
Example:
<globalyzer-scan-history
project-name="Java project 1" scan-name="Scan 1"
classpathref="globalyzer.install.path" />
You can use XSL transformation (
-xslfile, --xsl-file
) to generate a report in output format (html, text, etc) defined
in your XSL transformation file. XSL transformation uses XML format
as input to the transformation. See xsl/globalyzer_scan_history.xsd
XML schema for details. See xsl directory .xsl files for examples
of XSL transformation and for available .xsl files.
globalyzer-scan-diff
The
globalyzer-scan-diff
displays the numeric difference between two scan instances. you can
specify a from-date and to-date to get the difference between scan
results matching these days. or you can specify from-id and to-id
to compare specific scans by id. This task includes the following
attribute options:
Attribute |
Description |
project-name
|
the project name (required) |
scan-name
|
the scan name (required) |
result-type
|
the result-type (optional; "embedded", "method",
"general", or "static"; if omitted "embedded" is assumed) |
from-date
|
the starting date/time as "YYYY-MM-DD[ hh:mm:ss]" (either
this or from-id required; finds the scan session
with the closest matching date/time) |
to-date
|
the ending date/time as "YYYY-MM-DD[ hh:mm:ss]"
(optional; finds the scan session with the closest matching
date/time, if omitted the most recent scan is assumed) |
from-id
|
the scan id of the first scan to compare (either this or
from-date required) |
to-id
|
the scan id of the second scan to compare (optional; if
omitted the most recent scan is assumed) |
xml-name
|
the name/path to an XML file to generate (optional; if
omitted outputs to console) |
xsl-file
|
XSL transformation file name |
report-file
|
Report file name |
Example:
<globalyzer-scan-diff
project-name="Java project 1" scan-name="Scan 1"
result-type="embedded" from-date="2009-01-01" to-date="2009-06-01
14:00" classpathref="globalyzer.install.path" />
You can use XSL transformation (
-xslfile, --xsl-file
) to generate a report in output format (html, text, etc) defined
in your XSL transformation file. XSL transformation uses XML format
as input to the transformation. See xsl/globalyzer_scan_diffs.xsd
XML schema for details. See xsl directory .xsl files for examples
of XSL transformation and for available .xsl files.
globalyzer-rule-set-diff
The
globalyzer-rule-set-diff
displays the differences between two rule sets.
This task includes the following
attribute options:
Attribute |
Description |
rule-set-1
|
the name of the first rule set (required) |
rule-set-2
|
the name of the second rule set (required) |
html-file
|
the name of an HTML file to generate (optional; if
omitted outputs to console) |
Example:
<globalyzer-rule-set-diff
rule-set-1="my_java_ruleset" rule-set-2="my_other_java_ruleset"
classpathref="globalyzer.install.path" />
globalyzer-delete-scan-results
The
globalyzer-delete-scan-results
task will delete the results for a particular scan defined for a
particular project. This allows you to rescan all code instead of
doing incremental scanning. It includes the following attribute
options:
Attribute |
Description |
project-name
|
the project name (required) |
scan-name
|
the scan name (required) |
Example:
<globalyzer-delete-scan-results project-name="Java project 1"
scan-name="Scan 1" classpathref="globalyzer.install.path" />
globalyzer-delete-project
The
globalyzer-delete-project
task will delete a project. It includes the following attribute
options:
Attribute |
Description |
project-name
|
the project name (required) |
Example:
<globalyzer-delete-project
project-name="Java project 1"
classpathref="globalyzer.install.path" />
globalyzer-run-report
The
globalyzer-run-report
task allows you to generate a report from Globalyzer scan results.
It includes the following attribute options:
Attribute |
Description |
project-name
|
the project name (required) |
scan-name
|
the scan name (required for all report types except
aggregate) |
stored-report
|
the name of a saved report (optional) |
report-type
|
a report type: aggregate | summary | csv | excel | html |
text | xml (required) |
result-type
|
a result type: all | embedded | method | general | static |
report-title
|
a title for the report (optional; currently only used for
HTML summary reports) |
encoding
|
the output encoding of the generated report (optional) |
xsl-file
|
XSL transformation file name |
report-file
|
Report file name |
Example:
<globalyzer-run-report
project-name="Java project 1" scan-name="Scan 1" report-type="csv"
report-file="scan1-report.csv"
classpathref="globalyzer.install.path" jvmargs="-Xmx512m" />
You can use XSL transformation (
-xslfile, --xsl-file
) to generate a report in output format (html, text, etc) defined
in your XSL transformation file. XSL transformation uses XML format
as input to the transformation. See xsl/globalyzer_scan_report.xsd
XML schema for details. This command passes two parameters to your
XSL file (if they are specified as option on command line),
report-dir
and/or
report-file
. See xsl directory .xsl files for examples of XSL transformation
and for available .xsl files.
globalyzer-export
The
globalyzer-export
task allows you to export a scan and its results so that it can be
imported by another Globalyzer instance. It includes the following
task attribute options:
Attribute |
Description |
project-name
|
the project name (optional; if omitted a .gbak is
created (an backup of the entire client database; if only the
project name is specified then a .gproj file is created) |
scan-name
|
the scan name (if specified then a .gscan file is
created) |
export-name
|
the name of the file to export to (required) |
include-results
|
whether to include scan results in export file (optional;
defaults to false) |
Example:
<globalyzer-export
project-name="Java project" scan-name="Scan 1" export-name="Java
project-Scan 1.gscan" include-results="true"
classpathref="globalyzer.install.path" jvmargs="-Xmx512m" />
globalyzer-import
The
globalyzer-import
task will import a Globalyzer export file (.gbak, .gproj,
or .gscan). It includes the following task attribute
options:
Attribute |
Description |
project-name
|
the project name |
import-name
|
the name of the file to import from (required) |
include-results
|
whether to import scan results (optional; defaults to
false) |
reconcile-import
|
the name of a file with reconcile information (optional;
maps rule sets to projects/scans, see command line help for more
information) |
Example:
<globalyzer-import
project-name="Java project" scan-name="Scan 1" import-name="Java
project-Scan 1.gscan" include-results="true"
classpathref="globalyzer.install.path" />
|