smor 2002/07/09 04:41:54
Modified: src/plugins/graph plugin.jelly
src/java/org/apache/maven/jelly/tags/project GoalsToXML.java
Added: src/plugins/graph goalstoxdocs.dvsl
Log:
- Added a new goal : "graph:goals-to-xdoc".
With this you generate an xdoc document in ${maven.gen.docs}/goals-report.xml.
This shows you Maven's and the project's goals, their description and their
prerequisites.
- goalstoxdoc.dvsl processed the template
- GoalsToXML has been tweaked to sort the goals by name, so that in the output,
they are also sorted.
There is currently no link anywhere to the generated html file.
Revision Changes Path
1.3 +34 -6 jakarta-turbine-maven/src/plugins/graph/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins/graph/plugin.jelly,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- plugin.jelly 8 Jul 2002 19:35:26 -0000 1.2
+++ plugin.jelly 9 Jul 2002 11:41:54 -0000 1.3
@@ -1,6 +1,13 @@
<project default="graph"
xmlns:maven="jelly:org.apache.maven.jelly.tags.project.MavenTagLibrary">
+ <taskdef
+ name="dvsl"
+ classname="org.apache.tools.dvsl.DVSLTask">
+ <classpath refid="maven-classpath"/>
+ </taskdef>
+
+
<!-- ===================================================================== -->
<!-- G R A P H P R O J E C T D E P E N D E N C I E S -->
<!-- ===================================================================== -->
@@ -30,12 +37,6 @@
<maven:goalsToXML file="${maven.build.dir}/graph/goals.xml"
project="${org.apache.commons.jelly.werkz.Project}"/>
- <taskdef
- name="dvsl"
- classname="org.apache.tools.dvsl.DVSLTask">
- <classpath refid="maven-classpath"/>
- </taskdef>
-
<dvsl
basedir="${maven.build.dir}/graph"
destdir="${maven.build.dir}/graph"
@@ -53,6 +54,33 @@
<arg value="-o"/>
<arg value="${maven.graph.output.image.file}"/>
</exec>
+
+ </goal>
+
+ <!-- ===================================================================== -->
+ <!-- C R E A T E A N X D O C O U T O F G O A L S -->
+ <!-- ===================================================================== -->
+ <!-- Create an xdoc document from the project goals. -->
+ <!-- This document, outputted as "${maven.gen.docs}/goals-report.xml", -->
+ <!-- shows the goals, their description, and their prerequisites. We may -->
+ <!-- add the callbacks to the mix (preGoal, postGoal, preAction, etc.) and -->
+ <!-- actions, too. -->
+ <!-- ===================================================================== -->
+
+ <goal name="graph:goals-to-xdoc"
+ description="Creates an xdoc document from the project goals"
+ prereqs="graph:goals">
+
+ <dvsl
+ basedir="${maven.build.dir}/graph"
+ in="${maven.build.dir}/graph/goals.xml"
+ out="${maven.gen.docs}/goals-report.xml"
+ force="true"
+ style="${plugin.dir}/goalstoxdocs.dvsl"
+ includes="**/goals.xml"
+ outputencoding="${maven.docs.outputencoding}">
+ <!-- Need to add the maven jar to load the toolbox -->
+ </dvsl>
</goal>
1.1 jakarta-turbine-maven/src/plugins/graph/goalstoxdocs.dvsl
Index: goalstoxdocs.dvsl
===================================================================
#match("project")
<?xml version="1.0" encoding="ISO-8859-1"?>
<document>
<properties>
<title>Goals Descriptions</title>
</properties>
<body>
<section name="Project Goals">
<table>
<tr>
<th>Goal Name</th>
<th>Description</th>
<th>Prerequisites</th>
</tr>
$context.applyTemplates("goal")
</table>
</section>
</body>
</document>
#end
#match("goal")
<tr>
<td>$attrib.name</td>
#set( $description = $attrib.description )
#if( $description == "null")
#set( $description = "")
#end
<td>$attrib.description</td>
<td>
#foreach( $prereq in $node.selectNodes("prerequisite") )
<div>$prereq.attrib("name")</div>
#end
</td>
</tr>
#end
1.3 +22 -0
jakarta-turbine-maven/src/java/org/apache/maven/jelly/tags/project/GoalsToXML.java
Index: GoalsToXML.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jelly/tags/project/GoalsToXML.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GoalsToXML.java 8 Jul 2002 16:47:23 -0000 1.2
+++ GoalsToXML.java 9 Jul 2002 11:41:54 -0000 1.3
@@ -72,6 +72,8 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import java.util.Collections;
+import java.util.Comparator;
/**
@@ -137,6 +139,16 @@
List list = new ArrayList( goals );
+ // sort by name
+ Comparator comparator = new Comparator() {
+ public int compare(Object o1, Object o2) {
+ Goal g1 = (Goal) o1;
+ Goal g2 = (Goal) o2;
+ return g1.getName().compareTo( g2.getName() );
+ }
+ };
+ Collections.sort( list, comparator );
+
Iterator goalIter = list.iterator();
Goal eachGoal = null;
@@ -155,6 +167,16 @@
Collection prerequisites = eachGoal.getPrerequisites();
List prereqslist = new ArrayList( prerequisites );
+
+ // sort by name
+ Comparator prereqcomparator = new Comparator() {
+ public int compare(Object o1, Object o2) {
+ Goal g1 = (Goal) o1;
+ Goal g2 = (Goal) o2;
+ return g1.getName().compareTo( g2.getName() );
+ }
+ };
+ Collections.sort( prereqslist, prereqcomparator );
Iterator prereqIterator = prereqslist.iterator();
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>