jvanzyl     2002/06/26 12:30:07

  Added:       src/templates/build/plugins/docs plugin.jelly
  Log:
  First crack at turning the docs build.xml into a jelly plugin.
  
  Revision  Changes    Path
  1.1                  
jakarta-turbine-maven/src/templates/build/plugins/docs/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  <?xml version="1.0"?>
  
  <project xmlns:j="jelly:core">
  
    <goal
      name="docs"
      prereqs="jdepend-metrics, junit-report,checkstyle-report, change-log, 
      activity-log, task-list, generate-xdocs,docbook-simple, docs:site"
      description="o Generate html project documentation xdoc sources">
    </goal>
  
    <goal
      name="docs-quick"
      prereqs="generate-xdocs, docbook-simple,docs:site"
      description="o Generates documentation that are quickly generated.">
    </goal>
  
    <goal
      name="jdepend-metrics"
      if="maven.sourcesPresent"
      description="o Generiates html from jdepend metrics">
      <maven-ant antfile="${maven.home}/plugins/metrics/build.xml"
        target="jdepend-xml"
        inheritRefs="true" inheritAll="true"
        exportRefs="true"  exportAll="true" />
    </goal>
  
    <goal
      name="junit-report"
      if="maven.unitTestSourcesPresent"
      description="o Generates xdoc from junit test case runs">
      <maven-ant antfile="${maven.home}/plugins/test/build.xml"
        target="junit-xml"
        inheritRefs="true" inheritAll="true"
        exportRefs="true"  exportAll="true" />
    </goal>
  
    <goal
      name="checkstyle-report"
      if="maven.sourcesPresent"
      description="o Generates html from checkstyle report">
      <maven-ant antfile="${maven.home}/plugins/core/build.xml"
        target="check-source"
        inheritRefs="true" inheritAll="true"
        exportRefs="true"  exportAll="true" />
    </goal>
  
    <!-- ================================================================== -->
    <!-- C R O S S  R E F E R E N C E  S O U R C E S                        -->
    <!-- ================================================================== -->
  
    <goal
      name="cross-ref"
      prereqs="do-cross-ref"/>
  
    <goal
      name="do-cross-ref"
      if="maven.sourcesPresent">
      <!-- If the 'startDir' attribute changes we need to update
           CodeTransform.java in o.a.m.jxr, this will be fixed. -->
  
      <echo>${maven.sourcesPresent}</echo>
  
      <jxr
        sourcepathref="maven.src.set"
        destDir="${maven.jxr.destdir}"
        javadocDir="${maven.javadoc.destdir}"
        imageFolder="${maven.home}/images/folder.gif"
        imageFile="${maven.home}/images/file.gif">
      </jxr>
  
      <!-- The last two parameters don't really matter but the
           task craps out if they aren't there. -->
  
    </goal>
  
    <!-- ================================================================== -->
    <!-- T A S K   C R E A T I O N                                          -->
    <!-- ================================================================== -->
  
    <goal name="task-list"
      prereqs="do-task-list"
    />
  
    <goal 
      name="do-task-list"
      if="maven.sourcesPresent">
  
      <task-parser
        projectDescriptor="project.xml"
        base="${maven.src.dir}"
        includes="**/*.java"
        outputFile="${maven.gen.docs}/task-list.xml"
      />
  
    </goal>
  
    <!-- ================================================================== -->
    <!-- C H A N G E  L O G  R E P O R T                             -->
    <!-- ================================================================== -->
  
    <goal
      name="change-log"
      prereqs="do-change-log"
    />
  
    <goal name="do-change-log">
  
      <change-log
        projectDescriptor="project.xml"
        baseDir="."
        output="${maven.gen.docs}/changelog.xml"
        range="${maven.changelog.range}"
        factory="${maven.changelog.factory}"
      />
  
    </goal>
  
    <!-- ================================================================== -->
    <!-- C V S   A C T I V I T Y   R E P O R T                              -->
    <!-- ================================================================== -->
  
    <goal
      name="activity-log"
      prereqs="do-activity-log"
    />
  
    <goal name="do-activity-log">
  
      <change-log
        projectDescriptor="project.xml"
        baseDir="."
        output="${maven.build.dir}/activity-log.xml"
        range="${maven.activitylog.range}"
        factory="${maven.changelog.factory}"
      />
  
      <!-- Transform the activity log into developer activity first -->
      <dvsl
        basedir="${maven.build.dir}"
        destdir="${maven.gen.docs}/"
        extension=".xml"
        force="true"
        toolboxfile="${maven.home}/stylesheets/toolbox.props"
        style="${maven.home}/stylesheets/developer-activity.dvsl"
        includes="activity-log.xml"
        outputencoding="${maven.docs.outputencoding}">
        <!-- Need to add the maven jar to load the toolbox -->
        <classpath refid="maven-classpath"/>
        <tool name="toolbox.string.range" value="${maven.activitylog.range}"/>
        <tool name="toolbox.string.basedir" value="${basedir}"/>
      </dvsl>
  
      <!-- Transform the activity log into file activity-->
      <dvsl
        extension=".xml"
        force="true"
        toolboxfile="${maven.home}/stylesheets/toolbox.props"
        style="${maven.home}/stylesheets/file-activity.dvsl"
        in="${maven.build.dir}/activity-log.xml"
        out="${maven.gen.docs}/file-activity-report.xml">
        <!-- Need to add the maven jar to load the toolbox -->
        <classpath refid="maven-classpath"/>
        <tool name="toolbox.string.basedir" value="${basedir}"/>
        <tool name="toolbox.string.range" value="${maven.activitylog.range}"/>
      </dvsl>
  
  
    </goal>
    <!-- ================================================================== -->
    <!-- P R O J E C T  D O C U M E N T A T I O N                           -->
    <!-- ================================================================== -->
  
    <goal
      name="generate-xdocs"
      description="o Generates xdocs for site based on project descriptor" >
  
      <create-xdocs
        controlTemplate="Control.vm"
        outputDirectory="${maven.gen.docs}"
        templatePath="${maven.home}/templates/xdocs"
        outputFile="xdocs.report"
        projectDescriptor="project.xml" />
  
    </goal>
  
    <!-- ================================================================== -->
    <!-- S I M P L E   D O C B O O K   D O C U M E N T A T I O N            -->
    <!-- ================================================================== -->
    <goal 
      name="docbook-simple" 
      if="maven.docbook-simple.ok"
      description="Transform any docbook-simple source into xdocs for later use">
  
      <style basedir="${maven.src.docbook-simple}"
        destdir="${maven.gen.docs}" extension=".xml"
        style="${maven.home}/plugins/docs/docbook2document.xsl"
        includes="**/*.xml, **/*.sgml"/>
    </goal>
  
    <!-- ================================================================== -->
    <!-- D V S L  D O C U M E N T A T I O N                                 -->
    <!-- ================================================================== -->
  
    <goal
      name="docs:site"
      description="o Generate html project documentation xdoc sources">
  
      <!-- Transform the auto-generated xdocs first -->
      <dvsl
        basedir="${maven.gen.docs}"
        destdir="${maven.docs.dest}/"
        extension=".html"
        force="true"
        toolboxfile="${maven.home}/stylesheets/toolbox.props"
        style="${maven.home}/stylesheets/site.dvsl"
        excludes="**/project.xml,**/template.xml"
        includes="**/*.xml"
        outputencoding="${maven.docs.outputencoding}">
        <!-- Need to add the maven jar to load the toolbox -->
        <classpath refid="maven-classpath"/>
        <tool name="toolbox.string.basedir" value="${basedir}"/>
        <tool name="toolbox.string.docDest" value="${maven.docs.dest}"/>
        <tool name="toolbox.string.docSrc" value="${maven.docs.src}"/>
        <tool name="toolbox.string.genDoc" value="${maven.gen.docs}"/>
        <tool name="toolbox.string.srcDir" value="${maven.src.dir}"/>
        <tool name="toolbox.string.srcPresent" value="${maven.sourcesPresent}"/>
        <tool name="toolbox.string.testSrcPresent" 
value="${maven.unitTestSourcesPresent}"/>
        <tool name="toolbox.string.currentYear" value="${maven.current.year}"/>
      </dvsl>
  
      <!-- Then transform user supplied xdocs next -->
      <dvsl
        basedir="${maven.docs.src}"
        destdir="${maven.docs.dest}/"
        extension=".html"
        force="true"
        toolboxfile="${maven.home}/stylesheets/toolbox.props"
        style="${maven.home}/stylesheets/site.dvsl"
        excludes="**/project.xml,**/template.xml"
        includes="**/*.xml"
        outputencoding="${maven.docs.outputencoding}">
        <!-- Need to add the maven jar to load the toolbox -->
        <classpath refid="maven-classpath"/>
        <tool name="toolbox.string.basedir" value="${basedir}"/>
        <tool name="toolbox.string.docSrc" value="${maven.docs.src}"/>
        <tool name="toolbox.string.srcDir" value="${maven.src.dir}"/>
        <tool name="toolbox.string.genDoc" value="${maven.gen.docs}"/>
        <tool name="toolbox.string.srcPresent" value="${maven.sourcesPresent}"/>
        <tool name="toolbox.string.testSrcPresent" 
value="${maven.unitTestSourcesPresent}"/>
        <tool name="toolbox.string.currentYear" value="${maven.current.year}"/>
      </dvsl>
  
      <!-- Copy site images -->
      <copy todir="${maven.docs.dest}/images" filtering="no">
        <fileset dir="${maven.home}/images">
          <include name="**/*.gif"/>
          <include name="**/*.jpeg"/>
          <include name="**/*.jpg"/>
          <include name="**/*.png"/>
        </fileset>
      </copy>
  
      <!-- Copy user supplied images -->
      <copy todir="${maven.docs.dest}/images" filtering="no">
        <fileset dir="${maven.docs.src}/images">
          <include name="**/*.gif"/>
          <include name="**/*.jpeg"/>
          <include name="**/*.jpg"/>
          <include name="**/*.png"/>
        </fileset>
      </copy>
  
      <!-- Copy maven supplied stylesheets.  -->
      <copy todir="${maven.docs.dest}/style" overwrite="yes" filtering="yes">
        <fileset dir="${maven.home}/stylesheets">
          <include name="**/*.css"/>
        </fileset>
        <filterset>
          <filter token="UI_BODY_BACKGROUND" value="${maven.ui.body.background}"/>
          <filter token="UI_BODY_FOREGROUND" value="${maven.ui.body.foreground}"/>
          <filter token="UI_SECTION_BACKGROUND" 
value="${maven.ui.section.background}"/>
          <filter token="UI_SECTION_FOREGROUND" 
value="${maven.ui.section.foreground}"/>
          <filter token="UI_SUBSECTION_BACKGROUND" 
value="${maven.ui.subsection.background}"/>
          <filter token="UI_SUBSECTION_FOREGROUND" 
value="${maven.ui.subsection.foreground}"/>
  
          <filter token="UI_TABLE_HEADER_BACKGROUND" 
value="${maven.ui.table.header.background}"/>
          <filter token="UI_TABLE_HEADER_FOREGROUND" 
value="${maven.ui.table.header.foreground}"/>
          <filter token="UI_TABLE_ROW_ODD_BACKGROUND" 
value="${maven.ui.table.row.odd.background}"/>
          <filter token="UI_TABLE_ROW_ODD_FOREGROUND" 
value="${maven.ui.table.row.odd.foreground}"/>
          <filter token="UI_TABLE_ROW_EVEN_BACKGROUND" 
value="${maven.ui.table.row.even.background}"/>
          <filter token="UI_TABLE_ROW_EVEN_FOREGROUND" 
value="${maven.ui.table.row.even.foreground}"/>
  
          <filter token="UI_BANNER_BACKGROUND" value="${maven.ui.banner.background}"/>
          <filter token="UI_BANNER_FOREGROUND" value="${maven.ui.banner.foreground}"/>
          <filter token="UI_BANNER_BORDER_TOP" value="${maven.ui.banner.border.top}"/>
          <filter token="UI_BANNER_BORDER_BOTTOM" 
value="${maven.ui.banner.border.bottom}"/>
  
          <filter token="UI_SOURCE_BACKGROUND" value="${maven.ui.source.background}"/>
          <filter token="UI_SOURCE_FOREGROUND" value="${maven.ui.source.foreground}"/>
          <filter token="UI_SOURCE_BORDER_TOP" value="${maven.ui.source.border.top}"/>
          <filter token="UI_SOURCE_BORDER_BOTTOM" 
value="${maven.ui.source.border.bottom}"/>
          <filter token="UI_SOURCE_BORDER_RIGHT" 
value="${maven.ui.source.border.right}"/>
          <filter token="UI_SOURCE_BORDER_LEFT" 
value="${maven.ui.source.border.left}"/>
  
          <filter token="UI_NAVCOL_BACKGROUND" value="${maven.ui.navcol.background}"/>
          <filter token="UI_NAVCOL_FOREGROUND" value="${maven.ui.navcol.foreground}"/>
          <filter token="UI_NAVCOL_BACKGROUND_NS4" 
value="${maven.ui.navcol.background.ns4}"/>
          <filter token="UI_NAVCOL_FOREGROUND_NS4" 
value="${maven.ui.navcol.foreground.ns4}"/>
          <filter token="UI_NAVCOL_BORDER_TOP" value="${maven.ui.navcol.border.top}"/>
          <filter token="UI_NAVCOL_BORDER_RIGHT" 
value="${maven.ui.navcol.border.right}"/>
          <filter token="UI_NAVCOL_BORDER_BOTTOM" 
value="${maven.ui.navcol.border.bottom}"/>
  
          <filter token="UI_BREADCRUMBS_BACKGROUND" 
value="${maven.ui.breadcrumbs.background}"/>
          <filter token="UI_BREADCRUMBS_FOREGROUND" 
value="${maven.ui.breadcrumbs.foreground}"/>
          <filter token="UI_BREADCRUMBS_BORDER_TOP" 
value="${maven.ui.breadcrumbs.border.top}"/>
          <filter token="UI_BREADCRUMBS_BORDER_BOTTOM" 
value="${maven.ui.breadcrumbs.border.bottom}"/>
  
          <filter token="UI_HREF_LINK" value="${maven.ui.href.link}"/>
          <filter token="UI_HREF_LINK_ACTIVE" value="${maven.ui.href.link.active}"/>
          <filter token="UI_HREF_LINK_SELFREF" value="${maven.ui.href.link.selfref}"/>
        </filterset>
      </copy>
  
      <!-- Copy user supplied stylesheets, can override maven -->
      <copy todir="${maven.docs.dest}/style" filtering="no">
        <fileset dir="${maven.docs.src}/stylesheets">
          <include name="**/*.css"/>
        </fileset>
      </copy>
    </goal>
  
    <goal
      name="fo"
      prereqs="do-fo"
      description="o Generate XSL:FO project documentation"/>
  
    <goal name="do-fo">
  
      <mkdir dir="${maven.docs.dest}"/>
  
      <java classname="org.apache.xalan.xslt.Process" fork="yes">
        <classpath>
          <pathelement location="${lib.repo}/xercesImpl-2.0.0.jar"/>
          <pathelement location="${lib.repo}/xmlParserAPIs-2.0.0.jar"/>
          <pathelement location="${lib.repo}/xalan-2.1.0.jar"/>
        </classpath>
        <arg value="-in"/>
        <!-- FIXME: Using ${maven.docs.src} here causes the build to fail because
                    xalan constructs the path relative to the current directory
                    even if it is an absolute path. -->
        <arg value="xdocs/navigation.xml"/>
        <arg value="-out"/>
        <arg value="${maven.docs.dest}/project.fo"/>
        <arg value="-xsl"/>
        <arg value="${maven.home}/stylesheets/project2fo.xslt"/>
        <arg value="-param"/>
        <arg value="basePath"/>
        <arg value="${maven.docs.src}"/>
      </java>
  
    </goal>
  
    <goal
      name="pdf"
      prereqs="fo, do-pdf"
      description="o Generate PDF project documentation"/>
  
    <goal name="do-pdf">
  
      <java classname="org.apache.fop.apps.Fop" fork="yes">
        <classpath>
          <pathelement location="${lib.repo}/fop-0.20.3.jar"/>
          <pathelement location="${lib.repo}/batik.jar"/>
          <pathelement location="${lib.repo}/logkit-1.0.jar"/>
          <pathelement location="${lib.repo}/avalon-framework-4.0.jar"/>
          <pathelement location="${lib.repo}/xercesImpl-2.0.0.jar"/>
        </classpath>
        <arg line="-fo ${maven.docs.dest}/project.fo -pdf 
${maven.docs.dest}/project.pdf"/>
      </java>
  
    </goal>
  
    <!-- ================================================================== -->
    <!-- S I T E                                                            -->
    <!-- ================================================================== -->
  
    <goal
      name="site"
      prereqs="do-site, post-site-callback"
    />
  
    <goal
      name="do-site"
      prereqs="docs,javadocs,cross-ref"
    />
  
    <!-- ================================================================== -->
    <!-- D E P L O Y  S I T E                                               -->
    <!-- ================================================================== -->
  
    <goal
      name="check-maven-username"
      unless="maven.username">
  
      <fail>
        +------------------------------------------------------------------
        | ERROR!
        |
        | You must specify a maven username in order to deploy the site!
        | You can either set this property in your ~/build.properties
        | or specify one on the command line:
        |
        | ant -Dmaven.username=${user.name} maven:deploy-site
        +------------------------------------------------------------------
      </fail>
    </goal>
  
    <goal
      name="deploy-site"
      prereqs="check-maven-username, site,do-deploy-site"
    />
  
    <goal
      name="do-deploy-site"
      if="maven.username">
  
      <echo>
        siteAddress = ${maven.siteAddress}
        siteDirectory = ${maven.siteDirectory}
      </echo>
  
      <!-- This needs to taken from the project properties -->
      <property name="maven.homepage" value="${maven.siteDirectory}"/>
  
      <tar tarfile="${maven.final.name}-site.tar" basedir="${maven.docs.dest}"/>
      <gzip zipfile="${maven.final.name}-site.tar.gz" 
src="${maven.final.name}-site.tar"/>
      <delete file="${maven.final.name}-site.tar"/>
  
      <exec dir="." executable="${maven.scp.executable}">
        <arg value="${maven.final.name}-site.tar.gz"/>
        <arg value="${maven.username}@${maven.siteAddress}:${maven.homepage}"/>
      </exec>
  
      <exec dir="." executable="${maven.ssh.executable}">
        <arg line="${maven.siteAddress} -l ${maven.username} 'mkdir -p 
${maven.homepage};cd ${maven.homepage};gunzip ${maven.final.name}-site.tar.gz;tar xUvf 
${maven.final.name}-site.tar;chmod -R g+u *;rm ${maven.final.name}-site.tar'"/>
      </exec>
  
      <delete file="${maven.final.name}-site.tar.gz"/>
  
    </goal>
  
    <!-- ================================================================== -->
    <!-- J A V A D O C S                                                    -->
    <!-- ================================================================== -->
  
    <goal
      name="javadocs"
      prereqs="do-javadocs"
      description="o Generates the Javadoc API documentation"
    />
  
    <goal
      name="do-javadocs"
      if="maven.sourcesPresent">
  
      <!-- Get the year to display in the Javadocs -->
      <tstamp>
        <format property="year" pattern="${maven.inceptionYear}-yyyy"/>
      </tstamp>
  
      <property
        name="copyright"
        value="Copyright &amp;copy; ${year} ${maven.organization}. All Rights 
Reserved."
      />
  
      <echo>
        javadoc.destdir = ${maven.javadoc.destdir}
        package = ${maven.package}
        javadoc.author = ${maven.javadoc.author}
        javadoc.private = ${maven.javadoc.private}
        javadoc.version = ${maven.javadoc.version}
        javadoc.use = ${maven.javadoc.use}
        javadoc.windowtitle = ${maven.javadoc.windowtitle}
        javadoc.doctitle = ${maven.javadoc.doctitle}
        copyright = ${copyright}
      </echo>
  
      <javadoc
        sourcepathref="maven.src.set"
        packagenames="${maven.package}.*"
        destdir="${maven.javadoc.destdir}"
        author="${maven.javadoc.author}"
        private="${maven.javadoc.private}"
        version="${maven.javadoc.version}"
        use="${maven.javadoc.use}"
        windowtitle="${maven.javadoc.windowtitle}"
        doctitle="${maven.javadoc.doctitle}"
        bottom="${copyright}">
        <classpath refid="maven.dependency.classpath"/>
      </javadoc>
  
    </goal>
  
  </project>
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to