You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by ni...@apache.org on 2004/02/11 12:12:38 UTC
cvs commit: xml-forrest/scratchpad/forrestdoc/src/ant/org/apache/forrest/tools/taskdefs PathConvert.java
nicolaken 2004/02/11 03:12:38
Modified: scratchpad/forrestdoc build.xml
Added: scratchpad/forrestdoc/src ant.xml java.xml js.xml
scratchpad/forrestdoc build.properties core.xml
scratchpad/forrestdoc/src/resources/ws
dir2projects-summary.xsl dir2projects.xsl
index.html styles.css
scratchpad/forrestdoc/src/ant/org/apache/forrest/tools/taskdefs
PathConvert.java
Removed: scratchpad/forrestdoc ws.xml
Log:
Refactor the build so that each element has it's buildfile and
so that I can generate the project or workspace builds more easily.
Finished the first version of the workspace build :-)
If forrest is ina Gump workspace, run
build ws
to have generate in the build dir of the workspace forrestdocs for all projects.
Revision Changes Path
1.1 xml-forrest/scratchpad/forrestdoc/src/ant.xml
Index: ant.xml
===================================================================
<?xml version="1.0" ?>
<project
name="forrestdoc-ant" default="dist" basedir=".">
<condition property="ant.build.available">
<available file="${project.dir}/build.xml"/>
</condition>
<echo>ant buildfine available: ${ant.build.available}</echo>
<property name="target.vizant.dir" location="${project.target.dir}/vizant" />
<target name="vizant" depends="runvizant, antxml2formats" if="ant.build.available"/>
<target name="runvizant" if="ant.build.available">
<mkdir dir="${target.vizant.dir}" />
<taskdef name="vizant" classname="org.apache.forrest.forrestdoc.ant.doc.Vizant">
<classpath refid="task.classpath"/>
</taskdef>
<vizant antfile="${project.dir}/build.xml"
outfile="${target.vizant.dir}/buildgraph.xml"
uniqueref="true">
<!--
<attrstmt type="graph">
<attr name="ranksep" value="1.0"/>
<attr name="nodesep" value="0.5"/>
</attrstmt>
<attrstmt type="node">
<attr name="URL" value="javascript:alert('\N');"/>
<attr name="color" value="grey90"/>
<attr name="style" value="filled"/>
</attrstmt>
<attrstmt type="edge">
<attr name="color" value="grey70"/>
</attrstmt>
<attrstmt type="edge.antcall">
<attr name="label" value="antcall"/>
<attr name="fontcolor" value="gray70"/>
<attr name="fontsize" value="9"/>
</attrstmt>
<attrstmt type="node.default">
<attr name="color" value="pink"/>
</attrstmt>
<subgraph>
<attrstmt type="graph">
<attr name="style" value="filled"/>
<attr name="color" value="grey95"/>
</attrstmt>
</subgraph>
-->
</vizant>
</target>
<target name="antxml2formats" if="ant.build.available">
<xslt in="${target.vizant.dir}/buildgraph.xml" out="${target.vizant.dir}/target.dot" style="${resources.dir}/vizant/xml2dot.xsl" />
<antcall target="dot">
<param name="dot.source" value="${target.vizant.dir}/target.dot"/>
<param name="dot.dest" value="${target.vizant.dir}/vizant"/>
</antcall>
<antcall target="dot">
<param name="dot.format" value="svg"/>
<param name="dot.source" value="${target.vizant.dir}/target.dot"/>
<param name="dot.dest" value="${target.vizant.dir}/vizant"/>
</antcall>
<xslt in="${target.vizant.dir}/buildgraph.xml" out="${target.vizant.dir}/target.html" style="${resources.dir}/vizant/xml2html.xsl" />
<xslt in="${target.vizant.dir}/buildgraph.xml" out="${target.vizant.dir}/buildtg.xml" style="${resources.dir}/vizant/xml2tg.xsl" />
<copy file="${target.vizant.dir}/buildtg.xml" tofile="${target.vizant.dir}/InitialXML._xml"/>
<copy todir="${target.vizant.dir}">
<fileset dir="${resources.dir}/touchgraph" casesensitive="yes"/>
</copy>
<copy todir="${target.vizant.dir}">
<fileset dir="${resources.dir}/vizant" casesensitive="yes"/>
</copy>
</target>
<target name="tg" if="ant.build.available">
<java classname="com.touchgraph.linkbrowser.TGLinkBrowser" fork="yes">
<arg value="${target.vizant.dir}/buildtg.xml"/>
<classpath>
<path>
<fileset dir="${target.vizant.dir}" casesensitive="yes">
<patternset>
<include name="**/*.jar"/>
<include name="**/*.zip"/>
</patternset>
</fileset>
</path>
</classpath>
</java>
</target>
</project>
1.1 xml-forrest/scratchpad/forrestdoc/src/java.xml
Index: java.xml
===================================================================
<?xml version="1.0" ?>
<!-- made to be imported in teh main forrestdoc build driver -->
<project name="forrestdoc-java">
<property name="target.javasrc.dir" location="${project.target.dir}/javasrc" />
<property name="target.javadoc.dir" location="${project.target.dir}/javadoc" />
<property name="target.xml.dir" location="${project.target.dir}/xml" />
<property name="target.dot.dir" location="${project.target.dir}/dot" />
<property name="target.uml.dir" location="${project.target.dir}/uml" />
<presetdef name="fjavadoc">
<javadoc
useexternalfile="true">
<fileset dir="${project.dir}" defaultexcludes="yes">
<include name="**/*.java" />
</fileset>
</javadoc>
</presetdef>
<target name="javasrc">
<mkdir dir="${target.javasrc.dir}" />
<java classname="org.apache.forrest.forrestdoc.java.src.Pass1"
fork="true"
dir="."
failonerror="true"
maxmemory="256m">
<sysproperty key="recurse" value="true" />
<sysproperty key="title" value="Java Code Documentation" />
<sysproperty key="outdir" path="${target.javasrc.dir}" />
<arg value="${project.dir}" />
<classpath refid="task.classpath"/>
</java>
<java classname="org.apache.forrest.forrestdoc.java.src.Pass2"
fork="true"
dir="."
failonerror="true"
maxmemory="256m">
<sysproperty key="recurse" value="true" />
<sysproperty key="title" value="Java Code Documentation" />
<sysproperty key="outdir" path="${target.javasrc.dir}" />
<arg value="${project.dir}" />
<classpath refid="task.classpath"/>
</java>
<copy file="${resources.dir}/javasrc/styles.css"
todir="${target.javasrc.dir}"
filtering="off" />
</target>
<target name="javasrc2">
<mkdir dir="${target.javasrc.dir}" />
<taskdef name="javasrc" classname="org.apache.forrest.forrestdoc.java.src.JavaSrcTask">
<classpath refid="task.classpath"/>
</taskdef>
<javasrc srcDir="${project.dir}" destDir="${target.javasrc.dir}" />
</target>
<target name="uml" depends="xml, xml2dot, dot">
<antcall target="dot">
<param name="dot.format" value="svg"/>
</antcall>
</target>
<target name="umlgraph" depends="umldoclet, dot"/>
<target name="umldoclet">
<fjavadoc>
<doclet name="org.apache.forrest.forrestdoc.java.doc.UmlDoclet"
path="./build/classes/">
<!-- <param name="-horizontal" value="true"/> -->
<!-- <param name="-attributes" value="true"/> -->
<!-- <param name="-operations" value="true"/> -->
<!-- <param name="-visibility" value="true"/> -->
<!-- <param name="-types" value="true"/> -->
<param name="-all" value="true"/>
</doclet>
</fjavadoc>
</target>
<target name="javadoc">
<mkdir dir="${target.javadoc.dir}" />
<fjavadoc destDir="${target.javadoc.dir}"
author = "true"
version="true">
<!-- <doctitle><![CDATA[<h1>Test</h1>]]></doctitle>
<header><![CDATA[<h2>header</h2>]]></header>
<footer><![CDATA[<h3>footer</h3>]]></footer>
<bottom><![CDATA[<i>Copyright © 2000 Dummy Corp. All Rights Reserved.</i>]]></bottom>
-->
<tag name="todo" scope="all" description="To do:" />
<link href="http://developer.java.sun.com/developer/products/xml/docs/api/"/>
</fjavadoc>
</target>
<target name="xml">
<mkdir dir="${target.xml.dir}" />
<fjavadoc>
<doclet name="org.apache.forrest.forrestdoc.java.doc.XMLDoclet"
path="./build/classes/">
<!-- <param name="-foo" value="foovalue"/>
<param name="-bar" value="barvalue"/> -->
</doclet>
</fjavadoc>
<move file="simple.xml" tofile="${target.xml.dir}/xmldocs.xml"/>
</target>
<target name="xml2dot">
<copy file="${resources.dir}/javadoc/javadoc-v04draft.dtd" todir="${target.xml.dir}" filtering="off" />
<xslt force="true" in="${target.xml.dir}/xmldocs.xml" out="${target.dot.dir}/graph.dot" style="${resources.dir}/javadoc/xml2dot.xsl"/>
</target>
<target name="dot">
<mkdir dir="${target.uml.dir}" />
<property name="dot.format" value="png"/>
<property name="dot.source" value="${target.dot.dir}/graph.dot"/>
<property name="dot.dest" value="${target.uml.dir}/graph"/>
<exec executable="dot">
<arg line="-T${dot.format} ${dot.source} -o ${dot.dest}.${dot.format}" />
</exec>
</target>
</project>
1.1 xml-forrest/scratchpad/forrestdoc/src/js.xml
Index: js.xml
===================================================================
<?xml version="1.0" ?>
<project
name="forrestdoc-js" default="dist" basedir=".">
<property name="target.jsdoc.dir" location="${project.target.dir}/jsdoc" />
<target name="jsdoc">
<mkdir dir="${target.jsdoc.dir}" />
<taskdef name="jsdoc" classname="org.apache.forrest.forrestdoc.js.doc.JSDocTask" classpath="./build/classes/"/>
<jsdoc jSDir="${project.dir}" destDir="${target.jsdoc.dir}" />
</target>
</project>
1.5 +81 -252 xml-forrest/scratchpad/forrestdoc/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/xml-forrest/scratchpad/forrestdoc/build.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- build.xml 10 Feb 2004 18:56:52 -0000 1.4
+++ build.xml 11 Feb 2004 11:12:37 -0000 1.5
@@ -1,41 +1,11 @@
<?xml version="1.0" ?>
<project
- name="forrestdoc" default="dist" basedir=".">
+ name="forrestdoc" default="project" basedir=".">
<!-- init -->
<tstamp />
- <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
-
- <property name="project.dir" location="." />
- <property name="target.dir" location="${project.dir}/build/forrestdoc"/>
- <basename property="project.dirname" file="${project.dir}"/>
- <property name="project.target.dir" location="${target.dir}/${project.dirname}"/>
-
- <echo>scan dir: ${project.dir}</echo>
- <echo>target dir: ${project.target.dir}</echo>
-
- <condition property="ant.build.available">
- <available file="${project.dir}/build.xml"/>
- </condition>
-
- <echo>ant buildfine available: ${ant.build.available}</echo>
-
- <property name="src.dir" location="./src/java" />
- <property name="resources.dir" location="./src/resources" />
- <property name="build.dir" location="./build" />
- <property name="dist.dir" location="./dist" />
- <property name="lib.dir" location="./lib" />
-
- <property name="build.classes.dir" location="${build.dir}/classes" />
+ <property file="build.properties"/>
- <property name="target.javasrc.dir" location="${project.target.dir}/javasrc" />
- <property name="target.javadoc.dir" location="${project.target.dir}/javadoc" />
- <property name="target.xml.dir" location="${project.target.dir}/xml" />
- <property name="target.dot.dir" location="${project.target.dir}/dot" />
- <property name="target.uml.dir" location="${project.target.dir}/uml" />
- <property name="target.jsdoc.dir" location="${project.target.dir}/jsdoc" />
- <property name="target.vizant.dir" location="${project.target.dir}/vizant" />
-
<path id="lib.classpath">
<fileset dir="${lib.dir}">
<include name="*.jar" />
@@ -48,18 +18,18 @@
<path id="task.classpath">
<path refid="lib.classpath"/>
<pathelement path="${build.classes.dir}"/>
+ <pathelement path="${ant.build.dir}"/>
</path>
- <presetdef name="fjavadoc">
- <javadoc
- useexternalfile="true">
- <fileset dir="${project.dir}" defaultexcludes="yes">
- <include name="**/*.java" />
- </fileset>
- </javadoc>
- </presetdef>
-
-
+ <mkdir dir="${ant.build.dir}" />
+ <javac srcdir="${ant.src.dir}"
+ debug="true"
+ destdir="${ant.build.dir}"
+ classpathref="lib.classpath" />
+
+ <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
+ <taskdef name="extendedpathconvert" classname="org.apache.forrest.tools.taskdefs.PathConvert" classpathref="task.classpath"/>
+
<!-- Targets -->
<target name="compile"
@@ -83,228 +53,87 @@
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
-
- <target name="test"
- description="test this project"
- depends="all">
- </target>
-
- <target name="project"
- description="create all possible docs for this project"
- depends="javasrc, jsdoc, xml, uml, javadoc, vizant">
- <copy todir="${project.target.dir}">
- <fileset dir="${resources.dir}/common" casesensitive="yes"/>
- </copy>
- </target>
<target name="all"
description="test this project"
depends="project">
- </target>
-
- <!--
- The utility targets to run the aspects of ForrestDoc
- -->
- <target name="javasrc" depends="compile">
- <mkdir dir="${target.javasrc.dir}" />
- <java classname="org.apache.forrest.forrestdoc.java.src.Pass1"
- fork="true"
- dir="."
- failonerror="true"
- maxmemory="256m">
- <sysproperty key="recurse" value="true" />
- <sysproperty key="title" value="Java Code Documentation" />
- <sysproperty key="outdir" path="${target.javasrc.dir}" />
- <arg value="${project.dir}" />
- <classpath refid="task.classpath"/>
- </java>
-
- <java classname="org.apache.forrest.forrestdoc.java.src.Pass2"
- fork="true"
- dir="."
- failonerror="true"
- maxmemory="256m">
- <sysproperty key="recurse" value="true" />
- <sysproperty key="title" value="Java Code Documentation" />
- <sysproperty key="outdir" path="${target.javasrc.dir}" />
- <arg value="${project.dir}" />
- <classpath refid="task.classpath"/>
- </java>
-
- <copy file="${resources.dir}/javasrc/styles.css"
- todir="${target.javasrc.dir}"
- filtering="off" />
- </target>
-
- <target name="jsdoc" depends="compile">
- <mkdir dir="${target.jsdoc.dir}" />
- <taskdef name="jsdoc" classname="org.apache.forrest.forrestdoc.js.doc.JSDocTask" classpath="./build/classes/"/>
- <jsdoc jSDir="${project.dir}" destDir="${target.jsdoc.dir}" />
</target>
- <target name="javasrc2" depends="compile">
- <mkdir dir="${target.javasrc.dir}" />
- <taskdef name="javasrc" classname="org.apache.forrest.forrestdoc.java.src.JavaSrcTask">
- <classpath refid="task.classpath"/>
- </taskdef>
- <javasrc srcDir="${project.dir}" destDir="${target.javasrc.dir}" />
- </target>
-
- <target name="uml" depends="xml, xml2dot, dot">
- <antcall target="dot">
- <param name="dot.format" value="svg"/>
- </antcall>
- </target>
- <target name="umlgraph" depends="umldoclet, dot"/>
-
- <target name="umldoclet" depends="compile">
- <fjavadoc>
- <doclet name="org.apache.forrest.forrestdoc.java.doc.UmlDoclet"
- path="./build/classes/">
- <!-- <param name="-horizontal" value="true"/> -->
- <!-- <param name="-attributes" value="true"/> -->
- <!-- <param name="-operations" value="true"/> -->
- <!-- <param name="-visibility" value="true"/> -->
- <!-- <param name="-types" value="true"/> -->
- <param name="-all" value="true"/>
- </doclet>
- </fjavadoc>
- </target>
-
- <target name="javadoc">
- <mkdir dir="${target.javadoc.dir}" />
- <fjavadoc destDir="${target.javadoc.dir}"
- author = "true"
- version="true">
-<!-- <doctitle><![CDATA[<h1>Test</h1>]]></doctitle>
- <header><![CDATA[<h2>header</h2>]]></header>
- <footer><![CDATA[<h3>footer</h3>]]></footer>
- <bottom><![CDATA[<i>Copyright © 2000 Dummy Corp. All Rights Reserved.</i>]]></bottom>
--->
- <tag name="todo" scope="all" description="To do:" />
- <link href="http://developer.java.sun.com/developer/products/xml/docs/api/"/>
- </fjavadoc>
- </target>
+ <target name="project" depends="compile"
+ description="create all possible docs for this project">
+ <echo>START</echo>
+ <trycatch property="foo" reference="bar">
+ <try>
+ <ant antfile="core.xml" dir="." target="project"
+ inheritAll="true" inheritRefs="true"/>
+ </try>
+ <catch>
+ <echo>In <catch>.</echo>
+ </catch>
+ <finally>
+ <echo>In <finally>.</echo>
+ </finally>
+ </trycatch>
+ </target>
- <target name="xml" depends="compile">
- <mkdir dir="${target.xml.dir}" />
- <fjavadoc>
-
- <doclet name="org.apache.forrest.forrestdoc.java.doc.XMLDoclet"
- path="./build/classes/">
- <!-- <param name="-foo" value="foovalue"/>
- <param name="-bar" value="barvalue"/> -->
- </doclet>
- </fjavadoc>
- <move file="simple.xml" tofile="${target.xml.dir}/xmldocs.xml"/>
- </target>
-
- <target name="xml2dot">
- <copy file="${resources.dir}/javadoc/javadoc-v04draft.dtd" todir="${target.xml.dir}" filtering="off" />
- <xslt force="true" in="${target.xml.dir}/xmldocs.xml" out="${target.dot.dir}/graph.dot" style="${resources.dir}/javadoc/xml2dot.xsl"/>
- </target>
-
- <target name="dot">
- <mkdir dir="${target.uml.dir}" />
- <property name="dot.format" value="png"/>
- <property name="dot.source" value="${target.dot.dir}/graph.dot"/>
- <property name="dot.dest" value="${target.uml.dir}/graph"/>
-
- <exec executable="dot">
- <arg line="-T${dot.format} ${dot.source} -o ${dot.dest}.${dot.format}" />
- </exec>
- </target>
-
-
- <target name="vizant" depends="runvizant, xml2formats" if="ant.build.available"/>
+ <!-- driver targets -->
- <target name="runvizant" depends="compile" if="ant.build.available">
- <mkdir dir="${target.vizant.dir}" />
- <taskdef name="vizant" classname="org.apache.forrest.forrestdoc.ant.doc.Vizant">
- <classpath refid="task.classpath"/>
- </taskdef>
- <vizant antfile="${project.dir}/build.xml"
- outfile="${target.vizant.dir}/buildgraph.xml"
- uniqueref="true">
- <!--
- <attrstmt type="graph">
- <attr name="ranksep" value="1.0"/>
- <attr name="nodesep" value="0.5"/>
- </attrstmt>
+ <target name="ws" depends="compile"
+ description="create all possible docs for this workspace">
+
+ <property name="resolved.ws.dir" location="${ws.dir}"/>
+ <property name="ws.build.dir" location="${ws.dir}/build/forrestdoc"/>
+ <property name="ws.temp.dir" location="${ws.dir}/build/temp"/>
+
+ <mkdir dir="${ws.build.dir}" />
+ <mkdir dir="${ws.temp.dir}" />
- <attrstmt type="node">
- <attr name="URL" value="javascript:alert('\N');"/>
- <attr name="color" value="grey90"/>
- <attr name="style" value="filled"/>
- </attrstmt>
-
- <attrstmt type="edge">
- <attr name="color" value="grey70"/>
- </attrstmt>
-
- <attrstmt type="edge.antcall">
- <attr name="label" value="antcall"/>
- <attr name="fontcolor" value="gray70"/>
- <attr name="fontsize" value="9"/>
- </attrstmt>
-
- <attrstmt type="node.default">
- <attr name="color" value="pink"/>
- </attrstmt>
-
- <subgraph>
- <attrstmt type="graph">
- <attr name="style" value="filled"/>
- <attr name="color" value="grey95"/>
- </attrstmt>
- </subgraph>
- -->
- </vizant>
- </target>
-
- <target name="xml2formats" if="ant.build.available">
- <xslt in="${target.vizant.dir}/buildgraph.xml" out="${target.vizant.dir}/target.dot" style="${resources.dir}/vizant/xml2dot.xsl" />
-
- <antcall target="dot">
- <param name="dot.source" value="${target.vizant.dir}/target.dot"/>
- <param name="dot.dest" value="${target.vizant.dir}/vizant"/>
- </antcall>
-
- <antcall target="dot">
- <param name="dot.format" value="svg"/>
- <param name="dot.source" value="${target.vizant.dir}/target.dot"/>
- <param name="dot.dest" value="${target.vizant.dir}/vizant"/>
- </antcall>
-
- <xslt in="${target.vizant.dir}/buildgraph.xml" out="${target.vizant.dir}/target.html" style="${resources.dir}/vizant/xml2html.xsl" />
-
- <xslt in="${target.vizant.dir}/buildgraph.xml" out="${target.vizant.dir}/buildtg.xml" style="${resources.dir}/vizant/xml2tg.xsl" />
- <copy file="${target.vizant.dir}/buildtg.xml" tofile="${target.vizant.dir}/InitialXML._xml"/>
- <copy todir="${target.vizant.dir}">
- <fileset dir="${resources.dir}/touchgraph" casesensitive="yes"/>
- </copy>
+ <dirset dir="${ws.dir}" id="ws.project.dirs">
+ <include name="*"/>
+ <exclude name=".*"/>
+ <exclude name="build"/>
+ </dirset>
+
+ <extendedpathconvert pathsep="," type="xml" file="${ws.temp.dir}/dirs.xml" refid="ws.project.dirs">
+ <map from="${resolved.ws.dir}" to=""/>
+ </extendedpathconvert>
+
+ <xslt in="${ws.temp.dir}/dirs.xml"
+ out="${ws.build.dir}/projects.html" style="${resources.dir}/ws/dir2projects.xsl" />
+ <xslt in="${ws.temp.dir}/dirs.xml"
+ out="${ws.build.dir}/projects-summary.html" style="${resources.dir}/ws/dir2projects-summary.xsl" />
+ <copy file="${resources.dir}/ws/index.html" todir="${ws.build.dir}"/>
+ <copy file="${resources.dir}/ws/styles.css" todir="${ws.build.dir}"/>
+
+ <for param="current.project.dir">
+ <path>
+ <dirset refid="ws.project.dirs"/>
+ </path>
+ <sequential>
+ <echo>START @{current.project.dir}</echo>
+ <trycatch property="foo" reference="bar">
+ <try>
+ <ant antfile="core.xml" dir="." target="project"
+ inheritAll="true" inheritRefs="true">
+ <property name="project.dir" value="@{current.project.dir}"/>
+ <property name="target.dir" value="${ws.dir}/build/forrestdoc"/>
+ </ant>
+ </try>
+ <catch>
+ <echo>In <catch>.</echo>
+ </catch>
+ <finally>
+ <echo>In <finally>.</echo>
+ </finally>
+ </trycatch>
- <copy todir="${target.vizant.dir}">
- <fileset dir="${resources.dir}/vizant" casesensitive="yes"/>
- </copy>
- </target>
- <target name="tg" if="ant.build.available">
- <java classname="com.touchgraph.linkbrowser.TGLinkBrowser" fork="yes">
- <arg value="${target.vizant.dir}/buildtg.xml"/>
- <classpath>
- <path>
- <fileset dir="${target.vizant.dir}" casesensitive="yes">
- <patternset>
- <include name="**/*.jar"/>
- <include name="**/*.zip"/>
- </patternset>
- </fileset>
- </path>
- </classpath>
- </java>
- </target>
+ </sequential>
+ </for>
+
+ </target>
+
</project>
1.1 xml-forrest/scratchpad/forrestdoc/build.properties
Index: build.properties
===================================================================
src.dir=./src/java
ant.src.dir=./src/ant
resources.dir=./src/resources
build.dir=./build
ant.build.dir=./build/tools/ant
dist.dir=./dist
lib.dir=./lib
build.classes.dir=${build.dir}/classes
ws.dir=../../..
1.1 xml-forrest/scratchpad/forrestdoc/core.xml
Index: core.xml
===================================================================
<?xml version="1.0" ?>
<project
name="forrestdoc" default="dist" basedir=".">
<property name="project.dir" location="."/>
<property name="target.dir" location="${project.dir}/build/forrestdoc"/>
<basename property="project.dirname" file="${project.dir}"/>
<property name="project.target.dir" location="${target.dir}/${project.dirname}"/>
<echo>Using Project dir: ${project.dir}</echo>
<echo>Using Target dir: ${project.target.dir}</echo>
<import file="./src/java.xml"/>
<import file="./src/ant.xml"/>
<import file="./src/js.xml"/>
<target name="project"
description="create all possible docs for this project"
depends="javasrc, jsdoc, xml, uml, javadoc, vizant">
<copy todir="${project.target.dir}">
<fileset dir="${resources.dir}/common" casesensitive="yes"/>
</copy>
</target>
</project>
1.1 xml-forrest/scratchpad/forrestdoc/src/resources/ws/dir2projects-summary.xsl
Index: dir2projects-summary.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method = "html" encoding="Windows-1252" />
<xsl:template match="/">
<html><head>
<link rel="stylesheet" type="text/css" href="styles.css"/></head><body>
<h2>Forrestdoc run for Gump Workspace</h2>
<table class="summary">
<thead>
<tr>
<th>Projects</th>
</tr>
</thead>
<tbody>
<xsl:apply-templates/>
</tbody>
</table>
<hr></hr>Made with Apache ForrestDoc.
</body></html>
</xsl:template>
<xsl:template match="pathelement">
<xsl:variable name="dir" select="substring(.,2)" />
<xsl:variable name="url" select="concat(substring(.,2),'/index.html')" />
<tr><td><a href="{$url}"><xsl:value-of select="$dir" /></a></td></tr>
</xsl:template>
</xsl:stylesheet>
1.1 xml-forrest/scratchpad/forrestdoc/src/resources/ws/dir2projects.xsl
Index: dir2projects.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method = "html" encoding="Windows-1252" />
<xsl:template match="/">
<html><head><link rel="stylesheet" type="text/css" href="styles.css"/></head><body>
<h3 class="packageListItem">Projects</h3>
<p class="packageListItem"><A HREF="projects-summary.html" TARGET="projects-summaryFrame">Summary</A></p>
<br/>
<xsl:apply-templates/>
</body></html>
</xsl:template>
<xsl:template match="pathelement">
<xsl:variable name="dir" select="substring(.,2)" />
<xsl:variable name="url" select="concat(substring(.,2),'/index.html')" />
<p class="packageListItem"><a href="{$url}" TARGET="projects-summaryFrame"><xsl:value-of select="$dir" /></a></p>
</xsl:template>
</xsl:stylesheet>
1.1 xml-forrest/scratchpad/forrestdoc/src/resources/ws/index.html
Index: index.html
===================================================================
<TITLE>ForrestDoc Code Documentation</TITLE>
<FRAMESET cols="10%,80%">
<FRAME src="projects.html" name="projectsFrame">
<FRAME src="projects-summary.html" name="projects-summaryFrame">
</FRAMESET>
1.1 xml-forrest/scratchpad/forrestdoc/src/resources/ws/styles.css
Index: styles.css
===================================================================
/* Javadoc style sheet */
/* Define colors, fonts and other style attributes here to override the defaults */
body {
background-color: #fff;
font-family: Arial, Helvetica, sans-serif;
}
a:link { color: #00f;}
a:visited { color: #00a;}
a:active, a:hover { color: #f30 !important;}
ul, li {
list-style-type:none ;
margin:0;
padding:0;
}
table td{
padding: 3px;
border: 1px solid #000;
}
table{
width:100%;
border: 1px solid #000;
border-collapse: collapse;
}
div.overview {
background-color:#ddd;
padding: 4px 4px 4px 0;
}
div.overview li, div.framenoframe li {
display: inline;
}
div.framenoframe {
text-align: center;
font-size: x-small;
}
div.framenoframe li {
margin: 0 3px 0 3px;
}
div.overview li {
margin:3px 3px 0 3px;
padding: 4px;
}
li.selected {
background-color:#888;
color: #fff;
font-weight: bold;
}
table.summary {
margin-bottom: 20px;
}
table.summary td, table.summary th {
font-weight: bold;
text-align: left;
padding: 3px;
}
table.summary th{
background-color:#036;
color: #fff;
}
table.summary td{
background-color:#eee;
border: 1px solid black;
}
em {
color: #A00;
}
em.comment {
color: #390;
}
.string {
color: #009;
}
div#footer {
text-align:center;
}
#overview {
padding:2px;
}
hr {
height: 1px;
color: #000;
}
.comment { color:#007d00; font-style:italic }
.linenum { color:#888 font-weight:normal; }
.textDiv { font-weight:bold }
.packageListItem { font-size: 90%; margin:0; padding:0; border:0 }
.packageName { font-weight:bold }
.classDef { color:#875b37;font-weight:bold }
.classRef { color:#875b37;font-weight:normal; }
.classListItem { margin:0; padding:0; border:0 }
.classReflist { border-bottom:solid }
.classReflistHeader { font-weight:bold; border:0; margin:0; padding:0 }
.classRefItem { margin:0; padding:0; border:0 }
p.classRefItem a { color:#875b37 }
p.classReflistHeader a { color:#875b37 }
.methodDef { color:#377587;font-weight:bold }
.methodRef { color:#377587;font-weight:normal }
.methodReflist { }
.methodReflistHeader { font-weight:bold; border:0; margin:0; padding:0}
.methodRefItem { margin:0; padding:0; border:0; color:#009 }
p.methodRefItem a { color:#377587 }
p.methodReflistHeader a { color:#377587 }
.varDef { color:#232187;font-weight:bold }
.varRef { color:#232187;font-weight:normal }
.variableReflist { }
.variableReflistHeader { color:#000000;font-weight:bold; border:0; margin:0; padding:0}
.variableRefItem { margin:0; padding:0; border:0; color:#660 }
p.variableRefItem a { color:#232187; }
p.variableRefListheader a { color:#232187; }
1.1 xml-forrest/scratchpad/forrestdoc/src/ant/org/apache/forrest/tools/taskdefs/PathConvert.java
Index: PathConvert.java
===================================================================
/*
* Copyright 2001-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.forrest.tools.taskdefs;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.StringTokenizer;
import java.util.Vector;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.condition.Os;
import org.apache.tools.ant.types.DirSet;
import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.FileList;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference;
/**
* Converts path and classpath information to a specific target OS
* format. The resulting formatted path is placed into the specified property.
*
* @author Larry Streepy <a href="mailto:streepy@healthlanguage.com">
* streepy@healthlanguage.com</a>
* @author Nicola Ken Barozzi <a href="mailto:nicolaken@apache.org">
* nicolaken@apache.org</a>
* @since Ant 1.4
* @ant.task category="utility"
*/
public class PathConvert extends Task {
// Members
/**
* Path to be converted
*/
private Path path = null;
/**
* Reference to path/fileset to convert
*/
private Reference refid = null;
/**
* The target OS type
*/
private String targetOS = null;
/**
* Set when targetOS is set to windows
*/
private boolean targetWindows = false;
/**
* Set if we're running on windows
*/
private boolean onWindows = false;
/**
* Set if we should create a new property even if the result is empty
*/
private boolean setonempty = true;
/**
* The property to receive the conversion
*/
private String property = null;//
/**
* The file to write the conversion to
*/
private File file = null;//
/**
* The type of the output, xml or plain
*/
private String type = null;//
/**
* Path prefix map
*/
private Vector prefixMap = new Vector();
/**
* User override on path sep char
*/
private String pathSep = null;
/**
* User override on directory sep char
*/
private String dirSep = null;
/**
* constructor
*/
public PathConvert() {
onWindows = Os.isFamily("dos");
type="plain";
}
/**
* Helper class, holds the nested <map> values. Elements will look like
* this: <map from="d:" to="/foo"/>
*
* When running on windows, the prefix comparison will be case
* insensitive.
*/
public class MapEntry {
/** Set the "from" attribute of the map entry */
/**
* the prefix string to search for; required.
* Note that this value is case-insensitive when the build is
* running on a Windows platform and case-sensitive when running on
* a Unix platform.
* @param from
*/
public void setFrom(String from) {
this.from = from;
}
/**
* The replacement text to use when from is matched; required.
* @param to new prefix
*/
public void setTo(String to) {
this.to = to;
}
/**
* Apply this map entry to a given path element
*
* @param elem Path element to process
* @return String Updated path element after mapping
*/
public String apply(String elem) {
if (from == null || to == null) {
throw new BuildException("Both 'from' and 'to' must be set "
+ "in a map entry");
}
// If we're on windows, then do the comparison ignoring case
String cmpElem = onWindows ? elem.toLowerCase() : elem;
String cmpFrom = onWindows ? from.toLowerCase() : from;
// If the element starts with the configured prefix, then
// convert the prefix to the configured 'to' value.
if (cmpElem.startsWith(cmpFrom)) {
int len = from.length();
if (len >= elem.length()) {
elem = to;
} else {
elem = to + elem.substring(len);
}
}
return elem;
}
// Members
private String from = null;
private String to = null;
}
/**
* an enumeration of supported targets:
* windows", "unix", "netware", and "os/2".
*/
public static class TargetOs extends EnumeratedAttribute {
public String[] getValues() {
return new String[]{"windows", "unix", "netware", "os/2", "tandem"};
}
}
/** Create a nested PATH element */
public Path createPath() {
if (isReference()) {
throw noChildrenAllowed();
}
if (path == null) {
path = new Path(getProject());
}
return path.createPath();
}
/**
* Create a nested MAP element
* @return a Map to configure
*/
public MapEntry createMap() {
MapEntry entry = new MapEntry();
prefixMap.addElement(entry);
return entry;
}
/**
* Set targetos to a platform to one of
* "windows", "unix", "netware", or "os/2".
*
* Required unless unless pathsep and/or dirsep are specified.
*
* @deprecated use the method taking a TargetOs argument instead
* @see #setTargetos(PathConvert.TargetOs)
*/
public void setTargetos(String target) {
TargetOs to = new TargetOs();
to.setValue(target);
setTargetos(to);
}
/**
* Set targetos to a platform to one of
* "windows", "unix", "netware", or "os/2"; required unless
* unless pathsep and/or dirsep are specified.
*
* @since Ant 1.5
*/
public void setTargetos(TargetOs target) {
targetOS = target.getValue();
// Currently, we deal with only two path formats: Unix and Windows
// And Unix is everything that is not Windows
// for NetWare and OS/2, piggy-back on Windows, since in the
// validateSetup code, the same assumptions can be made as
// with windows - that ; is the path separator
targetWindows = !targetOS.equals("unix") && !targetOS.equals("tandem");
}
/**
* Set setonempty
*
* If false, don't set the new property if the result is the empty string.
* @param setonempty true or false
*
* @since Ant 1.5
*/
public void setSetonempty(boolean setonempty) {
this.setonempty = setonempty;
}
/**
* The property into which the converted path will be placed.
*/
public void setProperty(String p) {
property = p;
}
/**
* The file into which the converted path will be written.
*/
public void setFile(File f) {
file = f;
}
/**
* The type of output into which the converted path will be placed.
* Can be <code>plain</core> or <code>xml</code>
*/
public void setType(String t) {
type = t;
}
/**
* Adds a reference to a Path, FileSet, DirSet, or FileList defined
* elsewhere.
*/
public void setRefid(Reference r) {
if (path != null) {
throw noChildrenAllowed();
}
refid = r;
}
/**
* Set the default path separator string;
* defaults to current JVM
* {@link java.io.File#pathSeparator File.pathSeparator}
* @param sep path separator string
*/
public void setPathSep(String sep) {
pathSep = sep;
}
/**
* Set the default directory separator string;
* defaults to current JVM {@link java.io.File#separator File.separator}
* @param sep directory separator string
*/
public void setDirSep(String sep) {
dirSep = sep;
}
/**
* Has the refid attribute of this element been set?
* @return true if refid is valid
*/
public boolean isReference() {
return refid != null;
}
/** Do the execution.
* @throws BuildException if something is invalid
*/
public void execute() throws BuildException {
Path savedPath = path;
String savedPathSep = pathSep; // may be altered in validateSetup
String savedDirSep = dirSep; // may be altered in validateSetup
try {
// If we are a reference, create a Path from the reference
if (isReference()) {
path = new Path(getProject()).createPath();
Object obj = refid.getReferencedObject(getProject());
if (obj instanceof Path) {
path.setRefid(refid);
} else if (obj instanceof FileSet) {
FileSet fs = (FileSet) obj;
path.addFileset(fs);
} else if (obj instanceof DirSet) {
DirSet ds = (DirSet) obj;
path.addDirset(ds);
} else if (obj instanceof FileList) {
FileList fl = (FileList) obj;
path.addFilelist(fl);
} else {
throw new BuildException("'refid' does not refer to a "
+ "path, fileset, dirset, or "
+ "filelist.");
}
}
validateSetup(); // validate our setup
// Currently, we deal with only two path formats: Unix and Windows
// And Unix is everything that is not Windows
// (with the exception for NetWare and OS/2 below)
// for NetWare and OS/2, piggy-back on Windows, since here and
// in the apply code, the same assumptions can be made as with
// windows - that \\ is an OK separator, and do comparisons
// case-insensitive.
String fromDirSep = onWindows ? "\\" : "/";
StringBuffer rslt = new StringBuffer(100);
// Get the list of path components in canonical form
String[] elems = path.list();
if (type.equals("xml")) rslt.append("<?xml version=\"1.0\" ?><path>");
for (int i = 0; i < elems.length; i++) {
if (type.equals("xml")) rslt.append("<pathelement>");
String elem = elems[i];
elem = mapElement(elem); // Apply the path prefix map
// Now convert the path and file separator characters from the
// current os to the target os.
if (i != 0 && !type.equals("xml")) {
rslt.append(pathSep);
}
StringTokenizer stDirectory =
new StringTokenizer(elem, fromDirSep, true);
String token = null;
while (stDirectory.hasMoreTokens()) {
token = stDirectory.nextToken();
if (fromDirSep.equals(token)) {
rslt.append(dirSep);
} else {
rslt.append(token);
}
}
if (type.equals("xml")) rslt.append("</pathelement>");
}
if (type.equals("xml")) rslt.append("</path>");
// Place the result into the specified property,
// unless setonempty == false
String value = rslt.toString();
if (setonempty) {
exportProperty(property, value);
} else {
if (rslt.length() > 0) {
exportProperty(property, value);
}
}
} finally {
path = savedPath;
dirSep = savedDirSep;
pathSep = savedPathSep;
}
}
private void exportProperty(String property, String value) throws BuildException{
if(property!=null) {
log("Set property " + property + " = " + value, Project.MSG_VERBOSE);
getProject().setNewProperty(property, value);
}
if(file!=null) {
log("Writing to file " + file.getPath() + " \n value: " + value, Project.MSG_VERBOSE);
PrintStream ps = null;
try {
ps = new PrintStream(new BufferedOutputStream(new FileOutputStream(file)));
ps.print(value);
ps.flush();
} catch (IOException ioe) {
throw new BuildException(ioe, getLocation());
} finally {
if (ps != null) {
ps.close();
}
}
}
}
/**
* Apply the configured map to a path element. The map is used to convert
* between Windows drive letters and Unix paths. If no map is configured,
* then the input string is returned unchanged.
*
* @param elem The path element to apply the map to
* @return String Updated element
*/
private String mapElement(String elem) {
int size = prefixMap.size();
if (size != 0) {
// Iterate over the map entries and apply each one.
// Stop when one of the entries actually changes the element.
for (int i = 0; i < size; i++) {
MapEntry entry = (MapEntry) prefixMap.elementAt(i);
String newElem = entry.apply(elem);
// Note I'm using "!=" to see if we got a new object back from
// the apply method.
if (newElem != elem) {
elem = newElem;
break; // We applied one, so we're done
}
}
}
return elem;
}
/**
* Validate that all our parameters have been properly initialized.
*
* @throws BuildException if something is not setup properly
*/
private void validateSetup() throws BuildException {
if (path == null) {
throw new BuildException("You must specify a path to convert");
}
if (property == null && file == null ) {
throw new BuildException("You must specify at least a property or a file");
}
// Must either have a target OS or both a dirSep and pathSep
if (targetOS == null && pathSep == null && dirSep == null) {
throw new BuildException("You must specify at least one of "
+ "targetOS, dirSep, or pathSep");
}
// Determine the separator strings. The dirsep and pathsep attributes
// override the targetOS settings.
String dsep = File.separator;
String psep = File.pathSeparator;
if (targetOS != null) {
psep = targetWindows ? ";" : ":";
dsep = targetWindows ? "\\" : "/";
}
if (pathSep != null) {
// override with pathsep=
psep = pathSep;
}
if (dirSep != null) {
// override with dirsep=
dsep = dirSep;
}
pathSep = psep;
dirSep = dsep;
}
/**
* Creates an exception that indicates that this XML element must not have
* child elements if the refid attribute is set.
*/
private BuildException noChildrenAllowed() {
return new BuildException("You must not specify nested <path> "
+ "elements when using the refid attribute.");
}
}