You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ah...@apache.org on 2004/06/28 02:07:24 UTC
cvs commit: maven-plugins/pdf plugin.jelly
aheritier 2004/06/27 17:07:24
Modified: pdf plugin.jelly
Log:
- code cleanup
- new debug informations
Revision Changes Path
1.20 +230 -138 maven-plugins/pdf/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file: /home/cvs/maven-plugins/pdf/plugin.jelly,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- plugin.jelly 2 Apr 2004 03:47:05 -0000 1.19
+++ plugin.jelly 28 Jun 2004 00:07:24 -0000 1.20
@@ -17,143 +17,235 @@
*/
-->
-<project xmlns:j="jelly:core" xmlns:u="jelly:util" xmlns:ant="jelly:ant" xmlns:maven="jelly:maven">
- <goal name="pdf:init" prereqs="xdoc:init">
- <j:set var="docsXdocSrc" value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.docs.src')}"/>
- <j:set var="docsDest" value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.docs.dest')}"/>
- <j:set var="docsGenSrc" value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.gen.docs')}"/>
- <j:set var="docsPdf" value="${maven.build.dir}/pdf"/>
- <j:set var="docsToc" value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.docs.src')}/${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.navigationFile')}"/>
- <j:set var="confidential" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.confidential')}"/>
- <j:set var="paperType" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.paperType')}"/>
- <j:set var="companyIncName" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.companyIncName')}"/>
- <j:set var="publicationYear" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.copyrightYear')}"/>
- <j:set var="coverProjectCompany" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.cover.projectCompany')}"/>
- <j:set var="coverProjectName" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.cover.projectName')}"/>
- <j:set var="coverType" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.cover.type')}"/>
- <j:set var="coverVersion" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.cover.version')}"/>
- <j:set var="coverDate" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.cover.date')}"/>
- <tstamp>
- <format property="coverDate" pattern="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.xdoc.date.format')}" locale="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.xdoc.date.locale')}"/>
- </tstamp>
- <j:choose>
- <j:when test="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.projectLogo').startsWith('http://')}">
- <j:set var="projectLogo" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.projectLogo')}"/>
- </j:when>
- <j:otherwise>
- <j:set var="maven.bin.script" value="${maven.home}/bin/maven"/>
- <maven:makeAbsolutePath var="projectLogo" basedir="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.docs.src')}" path="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.projectLogo')}" trim="true"/>
- </j:otherwise>
- </j:choose>
- <j:choose>
- <j:when test="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.companyLogo').startsWith('http://')}">
- <j:set var="companyLogo" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.companyLogo')}"/>
- </j:when>
- <j:otherwise>
- <j:set var="maven.bin.script" value="${maven.home}/bin/maven"/>
- <maven:makeAbsolutePath var="companyLogo" basedir="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.docs.src')}" path="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.companyLogo')}" trim="true"/>
- </j:otherwise>
- </j:choose>
- <j:set var="imageDpi" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.imageDpi')}"/>
- <j:set var="debug" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.debug')}"/>
- <j:set var="pdfName" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.pdfName')}"/>
- <mkdir dir="${docsPdf}"/>
- </goal>
- <goal name="fo" prereqs="fo:fo" description="This simply pre-requisites the fo:fo goal. "/>
- <goal name="fo:fo" prereqs="pdf:prepare" description="Generates an fo xml document from the ${maven.pdf.navigationFile} file supplied as part of the documentation. Please note that as yet, no sanity check is done to make sure this file exists.">
- <echo>Generating ${docsDest}/project.fo ...</echo>
- <available file="${docsToc}" property="maven.fo.navigation.available"/>
- <fail message="PDF generation cannot complete as ${docsToc} is missing" unless="maven.fo.navigation.available"/>
- <!-- 'Major hack.' Stolen from the Latka plugin.jelly. All of this could be avoided by putting
- xalan into $MAVEN_HOME/lib/endorsed directory in the distribution, but never mind -->
+<project
+ xmlns:j="jelly:core"
+ xmlns:u="jelly:util"
+ xmlns:ant="jelly:ant"
+ xmlns:maven="jelly:maven">
+
+
+ <goal name="pdf:init" prereqs="xdoc:init">
+ <!-- xdoc plugin properties -->
+ <maven:get var="maven.xdoc.src" plugin="maven-xdoc-plugin" property="maven.docs.src"/>
+ <maven:get var="maven.xdoc.dest" plugin="maven-xdoc-plugin" property="maven.docs.dest"/>
+ <maven:get var="maven.xdoc.gen" plugin="maven-xdoc-plugin" property="maven.gen.docs"/>
+ <maven:get var="maven.xdoc.date.format" plugin="maven-xdoc-plugin" property="maven.xdoc.date.format"/>
+ <maven:get var="maven.xdoc.date.locale" plugin="maven-xdoc-plugin" property="maven.xdoc.date.locale"/>
+
+ <!-- pdf plugin properties -->
+ <maven:get var="maven.pdf.confidential" plugin="maven-pdf-plugin" property="maven.pdf.confidential"/>
+ <maven:get var="maven.pdf.paperType" plugin="maven-pdf-plugin" property="maven.pdf.paperType"/>
+ <maven:get var="maven.pdf.companyIncName" plugin="maven-pdf-plugin" property="maven.pdf.companyIncName"/>
+ <maven:get var="maven.pdf.copyrightYear" plugin="maven-pdf-plugin" property="maven.pdf.copyrightYear"/>
+ <maven:get var="maven.pdf.imageDpi" plugin="maven-pdf-plugin" property="maven.pdf.imageDpi"/>
+ <maven:get var="maven.pdf.debug" plugin="maven-pdf-plugin" property="maven.pdf.debug"/>
+ <maven:get var="maven.pdf.navigationFile" plugin="maven-pdf-plugin" property="maven.pdf.navigationFile"/>
+ <maven:get var="maven.pdf.pdfName" plugin="maven-pdf-plugin" property="maven.pdf.pdfName"/>
+ <maven:get var="maven.pdf.cover.projectCompany" plugin="maven-pdf-plugin" property="maven.pdf.cover.projectCompany"/>
+ <maven:get var="maven.pdf.cover.projectName" plugin="maven-pdf-plugin" property="maven.pdf.cover.projectName"/>
+ <maven:get var="maven.pdf.cover.type" plugin="maven-pdf-plugin" property="maven.pdf.cover.type"/>
+ <maven:get var="maven.pdf.cover.version" plugin="maven-pdf-plugin" property="maven.pdf.cover.version"/>
+ <maven:get var="maven.pdf.cover.date" plugin="maven-pdf-plugin" property="maven.pdf.cover.date"/>
+ <tstamp>
+ <format
+ property="maven.pdf.cover.date"
+ pattern="${maven.xdoc.date.format}"
+ locale="${maven.xdoc.date.locale}"/>
+ </tstamp>
+ <maven:get var="maven.pdf.projectLogo" plugin="maven-pdf-plugin" property="maven.pdf.projectLogo"/>
+ <j:if test="not ${maven.pdf.projectLogo.startsWith('http://')}">
+ <maven:makeAbsolutePath
+ var="maven.pdf.projectLogo"
+ basedir="${maven.xdoc.src}"
+ path="${maven.pdf.projectLogo}"
+ trim="true"/>
+ </j:if>
+ <maven:get var="maven.pdf.companyLogo" plugin="maven-pdf-plugin" property="maven.pdf.companyLogo"/>
+ <j:if test="not ${maven.pdf.companyLogo.startsWith('http://')}">
+ <maven:makeAbsolutePath
+ var="maven.pdf.companyLogo"
+ basedir="${maven.xdoc.src}"
+ path="${maven.pdf.companyLogo}"
+ trim="true"/>
+ </j:if>
+
+ <!-- internal variables -->
+ <j:set var="internal.pdf.workingDir" value="${maven.build.dir}/pdf"/>
+ <j:set var="internal.pdf.tocFile" value="${maven.xdoc.src}/${maven.pdf.navigationFile}"/>
+
+ <j:if test="${maven.pdf.debug}">
+ <ant:echo>
+### Debug mode is on ###
+==============================
+=== xdoc plugin properties ===
+==============================
+maven.docs.src = [${maven.xdoc.src}]
+maven.docs.dest = [${maven.xdoc.dest}]
+maven.gen.docs = [${maven.xdoc.gen}]
+maven.xdoc.date.format = [${maven.xdoc.date.format}]
+maven.xdoc.date.locale = [${maven.xdoc.date.locale}]
+==============================
+=== pdf plugin properties ===
+==============================
+maven.pdf.confidential = [${maven.pdf.confidential}]
+maven.pdf.paperType = [${maven.pdf.paperType}]
+maven.pdf.companyIncName = [${maven.pdf.companyIncName}]
+maven.pdf.copyrightYear = [${maven.pdf.copyrightYear}]
+maven.pdf.imageDpi = [${maven.pdf.imageDpi}]
+maven.pdf.debug = [${maven.pdf.debug}]
+maven.pdf.navigationFile = [${maven.pdf.navigationFile}]
+maven.pdf.pdfName = [${maven.pdf.pdfName}]
+maven.pdf.cover.projectCompany = [${maven.pdf.cover.projectCompany}]
+maven.pdf.cover.projectName = [${maven.pdf.cover.projectName}]
+maven.pdf.cover.type = [${maven.pdf.cover.type}]
+maven.pdf.cover.version = [${maven.pdf.cover.version}]
+maven.pdf.cover.date = [${maven.pdf.cover.date}]
+maven.pdf.projectLogo = [${maven.pdf.projectLogo}]
+maven.pdf.companyLogo = [${maven.pdf.companyLogo}]
+==============================
+=== pdf internal variables ===
+==============================
+internal.pdf.workingDir = [${internal.pdf.workingDir}]
+internal.pdf.tocFile = [${internal.pdf.tocFile}]
+ </ant:echo>
+ </j:if>
+ <j:if test="not ${maven.pdf.debug}">
+ <ant:echo>
+### Debug mode is off ###
+ </ant:echo>
+ </j:if>
+
+ <!-- Create working directory -->
+ <mkdir dir="${internal.pdf.workingDir}"/>
+ </goal>
+
+
+ <goal
+ name="fo"
+ prereqs="fo:fo"
+ description="This simply pre-requisites the fo:fo goal. "/>
+
+
+ <goal
+ name="fo:fo"
+ prereqs="pdf:prepare"
+ description="Generates an fo xml document from the ${maven.pdf.navigationFile} file supplied as part of the documentation.">
+
+ <echo>Generating ${maven.xdoc.dest}/project.fo ...</echo>
+ <available file="${internal.pdf.tocFile}" property="maven.fo.navigation.available"/>
+ <fail
+ message="PDF generation cannot complete as ${internal.pdf.tocFile} is missing"
+ unless="maven.fo.navigation.available"/>
+ <!-- 'Major hack.' Stolen from the Latka plugin.jelly. All of this could be avoided by putting
+ xalan into $MAVEN_HOME/lib/endorsed directory in the distribution, but never mind -->
${systemScope.setProperty('javax.xml.transform.TransformerFactory','org.apache.xalan.processor.TransformerFactoryImpl')}
- <style in="${docsToc}" out="${docsPdf}/project.fo" style="${plugin.resources}/project2fo.xslt" force="true">
- <param name="basePath" expression="${docsPdf}"/>
- <param name="confidential" expression="${confidential}"/>
- <param name="paperType" expression="${paperType}"/>
- <param name="companyIncName" expression="${companyIncName}"/>
- <param name="publicationYear" expression="${publicationYear}"/>
- <param name="coverProjectCompany" expression="${coverProjectCompany}"/>
- <param name="coverProjectName" expression="${coverProjectName}"/>
- <param name="coverType" expression="${coverType}"/>
- <param name="coverVersion" expression="${coverVersion}"/>
- <param name="coverDate" expression="${coverDate}"/>
- <param name="companyLogo" expression="${companyLogo}"/>
- <param name="projectLogo" expression="${projectLogo}"/>
- <param name="imageDpi" expression="${imageDpi}"/>
- <param name="debug" expression="${debug}"/>
- </style>
- </goal>
- <goal name="pdf" prereqs="fo:fo,pdf:prepare,pdf:pdf" description="This is the default goal of the plugin and simply pre-requisites the pdf:pdf goal. "/>
- <goal name="pdf:prepare" prereqs="pdf:init" description="Stages all files needed to generate the PDF">
- <!-- First, copy all of the generated xdocs -->
- <copy todir="${docsPdf}">
- <fileset dir="${docsGenSrc}" force="true">
- <include name="**/*.*"/>
- </fileset>
- </copy>
- <!-- Copy all of the user-supplied xdocs -->
- <copy todir="${docsPdf}" force="true" overwrite="true">
- <fileset dir="${docsXdocSrc}">
- <include name="**/*.*"/>
- </fileset>
- </copy>
- <!-- Then, copy all of images generated -->
- <copy todir="${docsPdf}" force="true">
- <fileset dir="${docsDest}">
- <include name="**/*.gif"/>
- <include name="**/*.jpg"/>
- <include name="**/*.png"/>
- </fileset>
- </copy>
- <!-- Finally, copy the FOP config file and all of the fonts -->
- <copy todir="${docsPdf}" force="true">
- <fileset dir="${plugin.resources}">
- <include name="userconfig.xml"/>
- <include name="fonts/*.*"/>
- </fileset>
- </copy>
- </goal>
- <goal name="pdf:pdf" description="Generates a PDF document containing all project documentation. The PDF is generated from the .fo file generated in the fo:fo goal." prereqs="pdf:prepare">
- <echo>Generating ${docsPdf}/${pdfName} ...</echo>
- <echo>Config file: ${docsPdf}/userconfig.xml</echo>
- <java classname="org.apache.fop.apps.Fop" fork="yes" failonerror="true" maxmemory="500m">
- <classpath>
- <pathelement location="${plugin.getDependencyPath('fop')}"/>
- <pathelement location="${plugin.getDependencyPath('batik')}"/>
- <pathelement location="${plugin.getDependencyPath('batik:batik-awt-util')}"/>
- <pathelement location="${plugin.getDependencyPath('batik:batik-bridge')}"/>
- <pathelement location="${plugin.getDependencyPath('batik:batik-css')}"/>
- <pathelement location="${plugin.getDependencyPath('batik:batik-dom')}"/>
- <pathelement location="${plugin.getDependencyPath('batik:batik-ext')}"/>
- <pathelement location="${plugin.getDependencyPath('batik:batik-extension')}"/>
- <pathelement location="${plugin.getDependencyPath('batik:batik-gui-util')}"/>
- <pathelement location="${plugin.getDependencyPath('batik:batik-gvt')}"/>
- <pathelement location="${plugin.getDependencyPath('batik:batik-parser')}"/>
- <pathelement location="${plugin.getDependencyPath('batik:batik-rasterizer')}"/>
- <pathelement location="${plugin.getDependencyPath('batik:batik-script')}"/>
- <pathelement location="${plugin.getDependencyPath('batik:batik-svg-dom')}"/>
- <pathelement location="${plugin.getDependencyPath('batik:batik-svggen')}"/>
- <pathelement location="${plugin.getDependencyPath('batik:batik-swing')}"/>
- <pathelement location="${plugin.getDependencyPath('batik:batik-transcoder')}"/>
- <pathelement location="${plugin.getDependencyPath('batik:batik-util')}"/>
- <pathelement location="${plugin.getDependencyPath('batik:batik-xml')}"/>
- <pathelement location="${plugin.getDependencyPath('logkit')}"/>
- <pathelement location="${plugin.getDependencyPath('avalon-framework')}"/>
- <pathelement location="${plugin.getDependencyPath('xerces')}"/>
- <pathelement location="${plugin.getDependencyPath('xml-apis')}"/>
- </classpath>
- <arg value="-c"/>
- <arg value="${docsPdf}/userconfig.xml"/>
- <if test="${debug}">
- <arg value="-d"/>
- </if>
- <arg value="-fo"/>
- <arg value="${docsPdf}/project.fo"/>
- <arg value="-pdf"/>
- <arg value="${docsPdf}/${pdfName}"/>
- <sysproperty key="javax.xml.transform.TransformerFactory" value="org.apache.xalan.processor.TransformerFactoryImpl"/>
- </java>
- <copy todir="${docsDest}" file="${docsPdf}/${pdfName}"/>
- </goal>
+ <style
+ in="${internal.pdf.tocFile}"
+ out="${internal.pdf.workingDir}/project.fo"
+ style="${plugin.resources}/project2fo.xslt"
+ force="true">
+ <param name="basePath" expression="${internal.pdf.workingDir}"/>
+ <param name="confidential" expression="${maven.pdf.confidential}"/>
+ <param name="paperType" expression="${maven.pdf.paperType}"/>
+ <param name="companyIncName" expression="${maven.pdf.companyIncName}"/>
+ <param name="publicationYear" expression="${maven.pdf.copyrightYear}"/>
+ <param name="coverProjectCompany" expression="${maven.pdf.cover.projectCompany}"/>
+ <param name="coverProjectName" expression="${maven.pdf.cover.projectName}"/>
+ <param name="coverType" expression="${maven.pdf.cover.type}"/>
+ <param name="coverVersion" expression="${maven.pdf.cover.version}"/>
+ <param name="coverDate" expression="${maven.pdf.cover.date}"/>
+ <param name="companyLogo" expression="${maven.pdf.companyLogo}"/>
+ <param name="projectLogo" expression="${maven.pdf.projectLogo}"/>
+ <param name="imageDpi" expression="${maven.pdf.imageDpi}"/>
+ <param name="debug" expression="${maven.pdf.debug}"/>
+ </style>
+ </goal>
+
+
+ <goal
+ name="pdf"
+ prereqs="fo:fo,pdf:prepare,pdf:pdf"
+ description="This is the default goal of the plugin and simply pre-requisites the pdf:pdf goal. "/>
+
+
+ <goal
+ name="pdf:prepare"
+ prereqs="pdf:init"
+ description="Stages all files needed to generate the PDF">
+ <!-- First, copy all of the generated xdocs -->
+ <copy todir="${internal.pdf.workingDir}">
+ <fileset dir="${maven.xdoc.gen}" force="true">
+ <include name="**/*.*"/>
+ </fileset>
+ </copy>
+ <!-- Copy all of the user-supplied xdocs -->
+ <copy todir="${internal.pdf.workingDir}" force="true" overwrite="true">
+ <fileset dir="${maven.xdoc.src}">
+ <include name="**/*.*"/>
+ </fileset>
+ </copy>
+ <!-- Then, copy all of images generated -->
+ <copy todir="${internal.pdf.workingDir}" force="true">
+ <fileset dir="${maven.xdoc.dest}">
+ <include name="**/*.gif"/>
+ <include name="**/*.jpg"/>
+ <include name="**/*.png"/>
+ </fileset>
+ </copy>
+ <!-- Finally, copy the FOP config file and all of the fonts -->
+ <copy todir="${internal.pdf.workingDir}" force="true">
+ <fileset dir="${plugin.resources}">
+ <include name="userconfig.xml"/>
+ <include name="fonts/*.*"/>
+ </fileset>
+ </copy>
+ </goal>
+
+
+ <goal
+ name="pdf:pdf"
+ description="Generates a PDF document containing all project documentation. The PDF is generated from the .fo file generated in the fo:fo goal."
+ prereqs="pdf:prepare">
+
+ <echo>Generating ${internal.pdf.workingDir}/${maven.pdf.pdfName} ...</echo>
+ <echo>Config file: ${internal.pdf.workingDir}/userconfig.xml</echo>
+ <java classname="org.apache.fop.apps.Fop" fork="yes" failonerror="true" maxmemory="500m">
+ <classpath>
+ <pathelement location="${plugin.getDependencyPath('fop')}"/>
+ <pathelement location="${plugin.getDependencyPath('batik')}"/>
+ <pathelement location="${plugin.getDependencyPath('batik:batik-awt-util')}"/>
+ <pathelement location="${plugin.getDependencyPath('batik:batik-bridge')}"/>
+ <pathelement location="${plugin.getDependencyPath('batik:batik-css')}"/>
+ <pathelement location="${plugin.getDependencyPath('batik:batik-dom')}"/>
+ <pathelement location="${plugin.getDependencyPath('batik:batik-ext')}"/>
+ <pathelement location="${plugin.getDependencyPath('batik:batik-extension')}"/>
+ <pathelement location="${plugin.getDependencyPath('batik:batik-gui-util')}"/>
+ <pathelement location="${plugin.getDependencyPath('batik:batik-gvt')}"/>
+ <pathelement location="${plugin.getDependencyPath('batik:batik-parser')}"/>
+ <pathelement location="${plugin.getDependencyPath('batik:batik-rasterizer')}"/>
+ <pathelement location="${plugin.getDependencyPath('batik:batik-script')}"/>
+ <pathelement location="${plugin.getDependencyPath('batik:batik-svg-dom')}"/>
+ <pathelement location="${plugin.getDependencyPath('batik:batik-svggen')}"/>
+ <pathelement location="${plugin.getDependencyPath('batik:batik-swing')}"/>
+ <pathelement location="${plugin.getDependencyPath('batik:batik-transcoder')}"/>
+ <pathelement location="${plugin.getDependencyPath('batik:batik-util')}"/>
+ <pathelement location="${plugin.getDependencyPath('batik:batik-xml')}"/>
+ <pathelement location="${plugin.getDependencyPath('logkit')}"/>
+ <pathelement location="${plugin.getDependencyPath('avalon-framework')}"/>
+ <pathelement location="${plugin.getDependencyPath('xerces')}"/>
+ <pathelement location="${plugin.getDependencyPath('xml-apis')}"/>
+ </classpath>
+ <arg value="-c"/>
+ <arg value="${internal.pdf.workingDir}/userconfig.xml"/>
+ <if test="${maven.pdf.debug}">
+ <arg value="-d"/>
+ </if>
+ <arg value="-fo"/>
+ <arg value="${internal.pdf.workingDir}/project.fo"/>
+ <arg value="-pdf"/>
+ <arg value="${internal.pdf.workingDir}/${maven.pdf.pdfName}"/>
+ <sysproperty key="javax.xml.transform.TransformerFactory" value="org.apache.xalan.processor.TransformerFactoryImpl"/>
+ </java>
+ <copy todir="${maven.xdoc.dest}" file="${internal.pdf.workingDir}/${maven.pdf.pdfName}"/>
+ </goal>
</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org