maven-plugins/pdf/plugin.jelly
aheritier 9bbcfbf644 - code cleanup
- new debug informations


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115566 13f79535-47bb-0310-9956-ffa450edef68
2004-06-28 00:07:24 +00:00

252 lines
12 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* 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.
*/
-->
<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="${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>