You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Stephane Bailliez <st...@haht.com> on 2002/02/25 10:16:37 UTC

RE: cvs commit: jakarta-turbine-maven/src/templates/build build-m etrics.xml Control.vm build.xml

Is there someone working on the metrics part ?
I committed a description of metrics in xdocs that would be nice to see.
I also started to see how we could do that with the visitors but not sure
yet about a couple of things.

If we have to create something like code audit there is some need to enhance
the parser to have waaaaaaay more concrete nodes and also add a couple of
helper methods to these nodes.

my parser skills are a bit rusty but if someone want to give it a shot I can
provide the javadoc related to the ast nodes in webgain audit. That should
give a rough idea of what is used.

As I see it there is probably a need for 2 parsers. Metrics does not need as
much nodes as audit and I believe it will slow down the metrics like crazy -
just pure guess - since we often need to iterate back and forth through the
childrens of a node and there is no need to iterate through 1000 when we are
interested only in 1% of it.

Stephane

> -----Original Message-----
> From: brekke@apache.org [mailto:brekke@apache.org]
> Sent: Monday, February 25, 2002 6:52 AM
> To: jakarta-turbine-maven-cvs@apache.org
> Subject: cvs commit: jakarta-turbine-maven/src/templates/build
> build-metrics.xml Control.vm build.xml
> 
> 
> brekke      02/02/24 21:51:50
> 
>   Modified:    .        build-bootstrap.xml
>                src/templates/build Control.vm build.xml
>   Added:       src/templates/build build-metrics.xml
>   Log:
>   Preliminary support for generating some source code metrics via
>   <a 
> href="http://www.clarkware.com/software/JDepend.html">JDepend</a>.
>   Currently you need to have the JDepend jar in your 
> $ANT_HOME/lib directory.
>   
>   Added a build-metrics.xml template to be generated when the 
> build system is
>   gen'd.  Added convience target, metrics, to build.xml so 
> one can just use:
>   
>   ant metrics
>   
>   If you define -Duse.jdepend.gui=1 on the command-line the 
> JDepend swing ui
>   will start up.  The default mode is to generate a 
> jdepend-report.txt in the
>   root directory.  I have two targets commented out which 
> generate an xml report.
>   One uses the jdepend ant task that is included in Ant 1.5 
> which can format
>   xml and the other just uses the xmlgui version of JDepend 
> and will work
>   regardless of the ant version.
>   
>   Revision  Changes    Path
>   1.14      +2 -1      jakarta-turbine-maven/build-bootstrap.xml
>   
>   Index: build-bootstrap.xml
>   ===================================================================
>   RCS file: /home/cvs/jakarta-turbine-maven/build-bootstrap.xml,v
>   retrieving revision 1.13
>   retrieving revision 1.14
>   diff -u -r1.13 -r1.14
>   --- build-bootstrap.xml	24 Feb 2002 21:22:05 -0000	1.13
>   +++ build-bootstrap.xml	25 Feb 2002 05:51:49 -0000	1.14
>   @@ -36,7 +36,8 @@
>    
>        <!-- Remove the elements of past generations before creating
>             the new one -->
>   -    
>   +
>   +    <delete file="build-metrics.xml"/>
>        <delete file="build-docs.xml"/>
>        <delete file="build-test.xml"/>
>        <delete file="build.xml"/>
>   
>   
>   
>   1.6       +1 -1      
> jakarta-turbine-maven/src/templates/build/Control.vm
>   
>   Index: Control.vm
>   ===================================================================
>   RCS file: 
> /home/cvs/jakarta-turbine-maven/src/templates/build/Control.vm,v
>   retrieving revision 1.5
>   retrieving revision 1.6
>   diff -u -r1.5 -r1.6
>   --- Control.vm	23 Feb 2002 04:01:49 -0000	1.5
>   +++ Control.vm	25 Feb 2002 05:51:49 -0000	1.6
>   @@ -1,4 +1,4 @@
>   -#set ($buildElements = 
> ["build-docs.xml","build-test.xml","build.xml","default.proper
ties","LICENSE","README.txt"])
>   +#set ($buildElements = ["build-metrics.xml", 
> "build-docs.xml","build-test.xml","build.xml","default.propert
> ies","LICENSE","README.txt"])
>    
>    $project
>    $project.name
>   
>   
>   
>   1.14      +5 -0      
> jakarta-turbine-maven/src/templates/build/build.xml
>   
>   Index: build.xml
>   ===================================================================
>   RCS file: 
> /home/cvs/jakarta-turbine-maven/src/templates/build/build.xml,v
>   retrieving revision 1.13
>   retrieving revision 1.14
>   diff -u -r1.13 -r1.14
>   --- build.xml	23 Feb 2002 16:40:14 -0000	1.13
>   +++ build.xml	25 Feb 2002 05:51:49 -0000	1.14
>   @@ -366,6 +366,11 @@
>      <!-- 
> ================================================================== -->
>    
>      <target
>   +    name="metrics">
>   +    <ant antfile="build-metrics.xml"/>
>   +  </target>
>   +
>   +  <target
>        name="test">
>        <ant antfile="build-test.xml"/>
>      </target>
>   
>   
>   
>   1.1                  
> jakarta-turbine-maven/src/templates/build/build-metrics.xml
>   
>   Index: build-metrics.xml
>   ===================================================================
>   <?xml version="1.0"?>
>   
>   <project name="$project.id" default="metrics" basedir=".">
>   
>   #include("build.properties.loading")
>   
>   #include("build.init.target")
>   
>     <!-- 
> ================================================================== -->
>     <!-- M E T R I C S                                        
>               -->
>     <!-- 
> ================================================================== -->
>   
>     <target
>       name="metrics"
>       depends="init,jdepend-report,jdepend-gui"
>       description="==> Gathers the code metrics">
>   
>     </target>
>   
>     <!-- 
> ==============================================================
> ========== -->
>     <!-- J D E P E N D  R E P O R T  T A R G E T              
>                     -->
>     <!-- 
> ==============================================================
> ========== -->
>     <target name="jdepend-report" unless="use.jdepend.gui">
>   
>       <!-- Once we start to use Ant 1.5, we can use the 
> builtin jdepend target -->
>       <!-- to generate our xml reports.  Until then we can 
> use the xmlui.      -->
>       <!-- 
>       <jdepend format="xml" 
> outputfile="${docs.src}/jdepend-report.xml">
>         <sourcespath>
>           <pathelement location="${src.dir}/java" />
>         </sourcespath>
>         <classpath location="${build.dest}" />
>       </jdepend>
>       -->
>   
>       <!-- This call will gen a xml report regardless of the 
> version of ant. -->
>       <!--
>       <java classname="jdepend.xmlui.JDepend" fork="yes" 
> failonerror="yes">
>         <arg line="-file ${docs.src}/jdepend-report.xml 
> ${src.dir}/java ${build.dest}"/>
>         <classpath>
>           <path refid="classpath"/>
>           <pathelement location="./"/>
>           <pathelement path="${java.class.path}" />
>         </classpath>
>       </java>
>       -->
>   
>       <!-- For now we just creat a text report using the 
> built in jdepend task. -->
>       <jdepend outputfile="jdepend-report.txt">
>         <sourcespath>
>           <pathelement location="${src.dir}/java"/>
>         </sourcespath>
>         <classpath location="${build.dest}" />
>       </jdepend>
>   
>     </target>
>   
>     <!-- 
> ==============================================================
> ========== -->
>     <!-- J D E P E N D  G U I  T A R G E T                    
>                     -->
>     <!-- 
> ==============================================================
> ========== -->
>     <target name="jdepend-gui" if="use.jdepend.gui">
>       <java classname="jdepend.swingui.JDepend" fork="yes" 
> failonerror="yes">
>         <arg line="${src.dir}/java ${build.dest}"/>
>         <classpath>
>           <path refid="classpath"/>
>           <pathelement location="./"/>
>           <pathelement path="${java.class.path}" />
>         </classpath>
>       </java>
>     </target>
>   
>   </project>
>   
>   
>   
> 
> --
> To unsubscribe, e-mail:   
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: cvs commit: jakarta-turbine-maven/src/templates/build build-m etrics.xml Control.vm build.xml

Posted by Jason van Zyl <jv...@zenplex.com>.
On Mon, 2002-02-25 at 04:16, Stephane Bailliez wrote:
> 
> Is there someone working on the metrics part ?

Jeff integrated JDepend last nigth. It is under a BSD license and has a
simple parser. I am going to use the JavaCC parser to do some other neat
things as well. I am also interested (most interested) in generating
visualizations of the metrics.

> I committed a description of metrics in xdocs that would be nice to see.
> I also started to see how we could do that with the visitors but not sure
> yet about a couple of things.

What I was planning with one of the visitors was to populate an small
model that represents a Java source file. Then once you have populated a
set of these classes that represent a source file (or classfile) then
perform the metrics on those. There are also many other possible uses
for a object model for a source file too.

> If we have to create something like code audit there is some need to enhance
> the parser to have waaaaaaay more concrete nodes and also add a couple of
> helper methods to these nodes.

The parser is simply there as a start, the only thing I've added is the
ability to reuse the parser. Same thing I did with the Velocity parser.
The parser will also require some work to trap whitespace properly, say
if we wanted to make a pretty printer.

> my parser skills are a bit rusty but if someone want to give it a shot I can
> provide the javadoc related to the ast nodes in webgain audit. That should
> give a rough idea of what is used.

I think that would be fine as regenerating the parser from the grammar
shouldn't affect the nodes and I don't think we'll be changing the names
of the productions in the grammar so that should be fine.

> As I see it there is probably a need for 2 parsers. Metrics does not need as
> much nodes as audit and I believe it will slow down the metrics like crazy -
> just pure guess - since we often need to iterate back and forth through the
> childrens of a node and there is no need to iterate through 1000 when we are
> interested only in 1% of it.

Take a look at JDepend we could definitely use that for metrics. The
java parser we have I intend to be a rigorous parser and I'm going to
add 1.4 support (i believe someone just did on the javacc list) and
support for aspectj. I would really like to start coming up with some
metrics for aspect oriented code. I'm going to the AOSD conference in
April so hopefully I'll get some cool ideas there.

> Stephane
> 
> > -----Original Message-----
> > From: brekke@apache.org [mailto:brekke@apache.org]
> > Sent: Monday, February 25, 2002 6:52 AM
> > To: jakarta-turbine-maven-cvs@apache.org
> > Subject: cvs commit: jakarta-turbine-maven/src/templates/build
> > build-metrics.xml Control.vm build.xml
> > 
> > 
> > brekke      02/02/24 21:51:50
> > 
> >   Modified:    .        build-bootstrap.xml
> >                src/templates/build Control.vm build.xml
> >   Added:       src/templates/build build-metrics.xml
> >   Log:
> >   Preliminary support for generating some source code metrics via
> >   <a 
> > href="http://www.clarkware.com/software/JDepend.html">JDepend</a>.
> >   Currently you need to have the JDepend jar in your 
> > $ANT_HOME/lib directory.
> >   
> >   Added a build-metrics.xml template to be generated when the 
> > build system is
> >   gen'd.  Added convience target, metrics, to build.xml so 
> > one can just use:
> >   
> >   ant metrics
> >   
> >   If you define -Duse.jdepend.gui=1 on the command-line the 
> > JDepend swing ui
> >   will start up.  The default mode is to generate a 
> > jdepend-report.txt in the
> >   root directory.  I have two targets commented out which 
> > generate an xml report.
> >   One uses the jdepend ant task that is included in Ant 1.5 
> > which can format
> >   xml and the other just uses the xmlgui version of JDepend 
> > and will work
> >   regardless of the ant version.
> >   
> >   Revision  Changes    Path
> >   1.14      +2 -1      jakarta-turbine-maven/build-bootstrap.xml
> >   
> >   Index: build-bootstrap.xml
> >   ===================================================================
> >   RCS file: /home/cvs/jakarta-turbine-maven/build-bootstrap.xml,v
> >   retrieving revision 1.13
> >   retrieving revision 1.14
> >   diff -u -r1.13 -r1.14
> >   --- build-bootstrap.xml	24 Feb 2002 21:22:05 -0000	1.13
> >   +++ build-bootstrap.xml	25 Feb 2002 05:51:49 -0000	1.14
> >   @@ -36,7 +36,8 @@
> >    
> >        <!-- Remove the elements of past generations before creating
> >             the new one -->
> >   -    
> >   +
> >   +    <delete file="build-metrics.xml"/>
> >        <delete file="build-docs.xml"/>
> >        <delete file="build-test.xml"/>
> >        <delete file="build.xml"/>
> >   
> >   
> >   
> >   1.6       +1 -1      
> > jakarta-turbine-maven/src/templates/build/Control.vm
> >   
> >   Index: Control.vm
> >   ===================================================================
> >   RCS file: 
> > /home/cvs/jakarta-turbine-maven/src/templates/build/Control.vm,v
> >   retrieving revision 1.5
> >   retrieving revision 1.6
> >   diff -u -r1.5 -r1.6
> >   --- Control.vm	23 Feb 2002 04:01:49 -0000	1.5
> >   +++ Control.vm	25 Feb 2002 05:51:49 -0000	1.6
> >   @@ -1,4 +1,4 @@
> >   -#set ($buildElements = 
> > ["build-docs.xml","build-test.xml","build.xml","default.proper
> ties","LICENSE","README.txt"])
> >   +#set ($buildElements = ["build-metrics.xml", 
> > "build-docs.xml","build-test.xml","build.xml","default.propert
> > ies","LICENSE","README.txt"])
> >    
> >    $project
> >    $project.name
> >   
> >   
> >   
> >   1.14      +5 -0      
> > jakarta-turbine-maven/src/templates/build/build.xml
> >   
> >   Index: build.xml
> >   ===================================================================
> >   RCS file: 
> > /home/cvs/jakarta-turbine-maven/src/templates/build/build.xml,v
> >   retrieving revision 1.13
> >   retrieving revision 1.14
> >   diff -u -r1.13 -r1.14
> >   --- build.xml	23 Feb 2002 16:40:14 -0000	1.13
> >   +++ build.xml	25 Feb 2002 05:51:49 -0000	1.14
> >   @@ -366,6 +366,11 @@
> >      <!-- 
> > ================================================================== -->
> >    
> >      <target
> >   +    name="metrics">
> >   +    <ant antfile="build-metrics.xml"/>
> >   +  </target>
> >   +
> >   +  <target
> >        name="test">
> >        <ant antfile="build-test.xml"/>
> >      </target>
> >   
> >   
> >   
> >   1.1                  
> > jakarta-turbine-maven/src/templates/build/build-metrics.xml
> >   
> >   Index: build-metrics.xml
> >   ===================================================================
> >   <?xml version="1.0"?>
> >   
> >   <project name="$project.id" default="metrics" basedir=".">
> >   
> >   #include("build.properties.loading")
> >   
> >   #include("build.init.target")
> >   
> >     <!-- 
> > ================================================================== -->
> >     <!-- M E T R I C S                                        
> >               -->
> >     <!-- 
> > ================================================================== -->
> >   
> >     <target
> >       name="metrics"
> >       depends="init,jdepend-report,jdepend-gui"
> >       description="==> Gathers the code metrics">
> >   
> >     </target>
> >   
> >     <!-- 
> > ==============================================================
> > ========== -->
> >     <!-- J D E P E N D  R E P O R T  T A R G E T              
> >                     -->
> >     <!-- 
> > ==============================================================
> > ========== -->
> >     <target name="jdepend-report" unless="use.jdepend.gui">
> >   
> >       <!-- Once we start to use Ant 1.5, we can use the 
> > builtin jdepend target -->
> >       <!-- to generate our xml reports.  Until then we can 
> > use the xmlui.      -->
> >       <!-- 
> >       <jdepend format="xml" 
> > outputfile="${docs.src}/jdepend-report.xml">
> >         <sourcespath>
> >           <pathelement location="${src.dir}/java" />
> >         </sourcespath>
> >         <classpath location="${build.dest}" />
> >       </jdepend>
> >       -->
> >   
> >       <!-- This call will gen a xml report regardless of the 
> > version of ant. -->
> >       <!--
> >       <java classname="jdepend.xmlui.JDepend" fork="yes" 
> > failonerror="yes">
> >         <arg line="-file ${docs.src}/jdepend-report.xml 
> > ${src.dir}/java ${build.dest}"/>
> >         <classpath>
> >           <path refid="classpath"/>
> >           <pathelement location="./"/>
> >           <pathelement path="${java.class.path}" />
> >         </classpath>
> >       </java>
> >       -->
> >   
> >       <!-- For now we just creat a text report using the 
> > built in jdepend task. -->
> >       <jdepend outputfile="jdepend-report.txt">
> >         <sourcespath>
> >           <pathelement location="${src.dir}/java"/>
> >         </sourcespath>
> >         <classpath location="${build.dest}" />
> >       </jdepend>
> >   
> >     </target>
> >   
> >     <!-- 
> > ==============================================================
> > ========== -->
> >     <!-- J D E P E N D  G U I  T A R G E T                    
> >                     -->
> >     <!-- 
> > ==============================================================
> > ========== -->
> >     <target name="jdepend-gui" if="use.jdepend.gui">
> >       <java classname="jdepend.swingui.JDepend" fork="yes" 
> > failonerror="yes">
> >         <arg line="${src.dir}/java ${build.dest}"/>
> >         <classpath>
> >           <path refid="classpath"/>
> >           <pathelement location="./"/>
> >           <pathelement path="${java.class.path}" />
> >         </classpath>
> >       </java>
> >     </target>
> >   
> >   </project>
> >   
> >   
> >   
> > 
> > --
> > To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
-- 
jvz.

Jason van Zyl
jvanzyl@apache.org

http://tambora.zenplex.org


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>