source: release-kits/lirk3/resources/gs3-release-maker/apache-ant-1.6.5/docs/manual/OptionalTasks/mmetrics.html@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 5.3 KB
Line 
1<html>
2
3<head>
4<meta http-equiv="Content-Language" content="en-us">
5<title>MMetrics Task</title>
6<link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
7</head>
8
9<body>
10
11<h2>MMetrics</h2>
12<ul>
13 <li>Stephane Bailliez (<a href="mailto:[email protected]">[email protected]</a>)</li>
14</ul>
15<h3>Requirements</h3>
16<p>This task requires Metamata Development environment 2.0/Webgain Quality Analyzer 2.0.
17An evaluation version is available at <a href="http://www.webgain.com/products/quality_analyzer/">Webgain</a>.
18(Though you will not be able to use Metrics from the command line if you do not have a registered version).
19You also need a TRaX compliant processor(such as <a href="http://xml.apache.org/xalan-j/">Xalan 2.x</a>) via JAXP 1.1</p>
20<h3>Description</h3>
21<p>
22 Invokes the Metamata Metrics / WebGain Quality Analyzer source code
23 analyzer on a set of Java files.
24</p>
25<p>
26 <i>mmetrics</i> will compute the metrics of a set of Java files and write the results to an XML
27 file. As a convenience, a stylesheet is given in <tt>etc</tt> directory, so that an HTML report can be generated from the XML file.
28</p>
29
30<h3>Parameters</h3>
31<table border="1" cellpadding="2" cellspacing="0">
32 <tr>
33 <td valign="top"><b>Attribute</b></td>
34 <td valign="top"><b>Description</b></td>
35 <td align="center" valign="top"><b>Required</b></td>
36 </tr>
37 <tr>
38 <td valign="top">metamatahome</td>
39 <td valign="top">The home directory containing the Metamata distribution.</td>
40 <td valign="top" align="center">Yes</td>
41 </tr>
42 <tr>
43 <td valign="top">tofile</td>
44 <td valign="top">The XML were the resulting metrics will be written to.</td>
45 <td valign="top" align="center">Yes</td>
46 </tr>
47 <tr>
48 <td valign="top">granularity</td>
49 <td valign="top">Metrics granularity of the source files. Must be either
50 <i>files</i> (compilation-units), <i>types</i> (types and compilation-units) or <i>methods</i>
51 (methods, types and compilation-units).
52 </td>
53 <td valign="top" align="center">Yes</td>
54 </tr>
55 <tr>
56 <td valign="top">maxmemory</td>
57 <td valign="top">Set the maximum memory for the JVM. this is a convenient
58 way to set the -mx or -Xmx argument.</td>
59 <td valign="top" align="center">No</td>
60 </tr>
61</table>
62<h3>Nested elements</h3>
63For specifying the source code to analyze, you can either use a <tt>path</tt> or <tt>fileset</tt> elements (though a single path element is preferred, see note below).
64<h4>jvmarg</h4>
65<p>Additional parameters may be passed to the VM via nested <code>&lt;jvmarg&gt;</code>
66attributes. <code>&lt;jvmarg&gt;</code> allows all attributes described in <a href="../using.html#arg">Command
67line arguments</a>.</p>
68<h4>classpath</h4>
69<p>Sets class path (also source path unless one explicitly set). Overrides
70METAPATH/CLASSPATH environment variables. The <tt>classpath</tt> element represents a <a href="../using.html#path">PATH like
71structure</a>.</p>
72<h4>sourcepath</h4>
73<p>Sets source path. Overrides the SOURCEPATH environment variable. The <tt>sourcepath</tt> element represents a <a href="../using.html#path">PATH like
74structure</a>.</p>
75
76<h4>path</h4>
77<p>Sets the list of directories to analyze the code for metrics.;It represents a <a href="../using.html#path">PATH structure</a>.</p>
78<h4>fileset</h4>
79<p>Sets a set of files to analyze for metrics.source It represents a <a href="../CoreTypes/fileset.html">FILESET structure</a>.</p>
80
81<p>
82<font color="#FF0000">
83Note: For the sake of readability, it is highly recommended to analyze for a single unique directory instead than
84using filesets or several directories. Otherwise there will be multiple metrics outputs without any way to know
85what metrics refers to what source. Chance are also that the XML handler that does some heuristic will be confused
86by the different outputs.
87</font>
88</p>
89
90<h3>Example</h3>
91<pre> &lt;mmetrics tofile=&quot;mmetrics.xml&quot;
92 metamatahome=&quot;c:/metamata&quot;
93 granularity=&quot;methods&quot;&gt;
94 &lt;classpath&gt;
95 &lt;pathelement location=&quot;c:/metamata/examples/metricsexamples&quot;/&gt;
96 &lt;/classpath&gt;
97 &lt;sourcepath&gt;
98 &lt;pathelement location=&quot;c:/metamata/examples/metricsexamples&quot;/&gt;
99 &lt;/sourcepath&gt;
100 &lt;path&gt;
101 &lt;pathelement location=&quot;c:/metamata/examples/metricsexamples&quot;/&gt;
102 &lt;/path&gt;
103 &lt;/mmetrics&gt;</pre>
104<p>
105 This invokes Metamata Metrics installed in <tt>c:/metamata</tt> on the metrics example.
106 (Note that here, classpath and sourcepath are not normally not needed)
107</p>
108
109<h3>Generating a report</h3>
110As a convenience, there is an XSL file(mmetrics-frames.xsl) that allows you to generate a full framed HTML report of the metrics.
111You can find it in the <i>etc</i> directory of Ant. As it uses the Xalan redirect extensions, you will need Xalan and Xerces to run it.
112The stylesheet takes an <i>output.dir</i> parameter (otherwise it will be generated
113in the current directory), it can be run in Ant as follows:
114<pre>
115&lt;style in=java &quot;${metrics.xml}&quot; style=&quot;mmetrics-frames.xsl&quot; out="null.tmp"&gt;
116 &lt;param name=&quot;output.dir&quot; expression=&quot;${report.dir}&quot;/&gt;
117&lt;/style&gt;
118</pre>
119<hr>
120<p align="center">Copyright &copy; 2001-2002,2004 The Apache Software Foundation. All rights
121Reserved.</p>
122</body>
123</html>
Note: See TracBrowser for help on using the repository browser.