svn commit: rev 21376 - in avalon/trunk: central/system runtime/merlin/impl tools/magic/src/main/org/apache/avalon/tools/tasks

[email protected]
Newsgroups gmane.comp.jakarta.avalon.cvs
Message-ID <[email protected]>
Author: mcconnell
Date: Wed Jun 16 23:13:20 2004
New Revision: 21376

Modified:
   avalon/trunk/central/system/index.xml
   avalon/trunk/runtime/merlin/impl/build.xml
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/JavadocTask.java
Log:
Update central/site to handle the runtime javadoc generation and add support to the javadoc task for delegation of a target project against which doc generation is processed.

Modified: avalon/trunk/central/system/index.xml
==============================================================================
--- avalon/trunk/central/system/index.xml	(original)
+++ avalon/trunk/central/system/index.xml	Wed Jun 16 23:13:20 2004
@@ -81,6 +81,17 @@
   <projects>
 
     <!--
+    Avalon Central.
+    -->
+
+    <project basedir="../site">
+      <info>
+        <group>avalon</group>
+        <name>site</name>
+      </info>
+    </project>
+
+    <!--
     Avalon Tools.
     -->
 
@@ -148,13 +159,6 @@
     <!--
     Avalon Utilities.
     -->
-
-    <project basedir="../site">
-      <info>
-        <group>avalon</group>
-        <name>site</name>
-      </info>
-    </project>
 
     <project basedir="../../runtime/util/configuration">
       <info>

Modified: avalon/trunk/runtime/merlin/impl/build.xml
==============================================================================
--- avalon/trunk/runtime/merlin/impl/build.xml	(original)
+++ avalon/trunk/runtime/merlin/impl/build.xml	Wed Jun 16 23:13:20 2004
@@ -17,7 +17,6 @@
 
   <target name="package" depends="standard.package">
     <x:artifact/>
-    <x:javadoc/>
   </target>
 
 </project>

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/JavadocTask.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/JavadocTask.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/JavadocTask.java	Wed Jun 16 23:13:20 2004
@@ -80,19 +80,18 @@
     public static final String SPI = "spi";
     public static final String IMPL = "impl";
 
-    private String m_root = "";
+    private String m_root;
+    private String m_id;
     private String m_title;
 
     public void setRoot( String root )
     {
-        if( root.endsWith( "/" ) )
-        { 
-            m_root = root.substring( 0, root.length() - 1 );
-        }
-        else
-        {
-            m_root = root;
-        }
+        m_root = root;
+    }
+
+    public void setId( String id )
+    {
+        m_id = id;
     }
 
     public void setTitle( String title )
@@ -102,7 +101,7 @@
 
     public void execute() throws BuildException
     {
-        Definition def = getHome().getDefinition( getKey() );
+        Definition def = getReferenceDefinition();
         File root = getJavadocRootDirectory( def );
         Path classpath = def.getPath( getProject(), Policy.RUNTIME );
         Link j2se = new Link( "http://java.sun.com/j2se/1.4/docs/api/" );
@@ -195,11 +194,12 @@
 
     private File getJavadocRootDirectory( Definition def )
     {
-        File docs = getContext().getDocsDirectory();
+        File docs = getProductRoot( def );
+        
         String version = def.getInfo().getVersion();
         if( null == version )
         {
-            return new File( docs, JAVADOC );
+            return docs;
         }
         else
         {
@@ -207,6 +207,19 @@
         }
     }
 
+    private File getProductRoot( Definition def )
+    {
+        File docs = getContext().getDocsDirectory();
+        if( m_root != null )
+        {
+            return Context.getFile( docs, m_root );
+        }
+        else
+        {
+            return docs;
+        }
+    }
+
     private String getTitle( Definition def, String group )
     {
         String extra = getTitleSuppliment( def, group );
@@ -227,6 +240,18 @@
         else
         {
             return ", Version " + version + " : " + group;
+        }
+    }
+
+    private Definition getReferenceDefinition()
+    {
+        if( null != m_id )
+        {
+            return getHome().getDefinition( m_id );
+        }
+        else
+        {
+            return getHome().getDefinition( getKey() );
         }
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.