git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@116130 13f79535-47bb-0310-9956-ffa450edef68
302 lines
12 KiB
XML
302 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"/>
|
|
|
|
<tstamp>
|
|
<format
|
|
property="maven.pdf.cover.date"
|
|
pattern="${maven.xdoc.date.format}"
|
|
locale="${maven.xdoc.date.locale}"/>
|
|
</tstamp>
|
|
<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>
|
|
<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: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.navigationFilePath = [${maven.pdf.navigationFilePath}]
|
|
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}]
|
|
</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 ${internal_pdf_workingDir}/project.fo from ${maven.pdf.navigationFilePath}/${maven.pdf.navigationFile} ...</echo>
|
|
<available file="${maven.pdf.navigationFilePath}/${maven.pdf.navigationFile}" property="maven.fo.navigation.available"/>
|
|
<fail
|
|
message="PDF generation cannot complete as ${maven.pdf.navigationFilePath}/${maven.pdf.navigationFile} is missing"
|
|
unless="maven.fo.navigation.available"/>
|
|
|
|
<j:scope>
|
|
<j:new className="java.io.File" var="styleFile">
|
|
<j:arg value="${plugin.resources}/project2fo.xslt" />
|
|
</j:new>
|
|
<j:new className="javax.xml.transform.stream.StreamSource" var="style">
|
|
<j:arg value="${styleFile}" />
|
|
</j:new>
|
|
|
|
<j:new className="org.apache.xalan.processor.TransformerFactoryImpl" var="transformerFactory" />
|
|
<j:invoke on="${transformerFactory}" method="newTransformer" var="transformer" >
|
|
<j:arg value="${style}" />
|
|
</j:invoke>
|
|
<j:invoke on="${transformer}" method="setParameter">
|
|
<j:arg value="basePath" />
|
|
<j:arg value="${internal_pdf_workingDir}"/>
|
|
</j:invoke>
|
|
<j:invoke on="${transformer}" method="setParameter">
|
|
<j:arg value="confidential" />
|
|
<j:arg value="${maven.pdf.confidential}"/>
|
|
</j:invoke>
|
|
<j:invoke on="${transformer}" method="setParameter">
|
|
<j:arg value="paperType" />
|
|
<j:arg value="${maven.pdf.paperType}"/>
|
|
</j:invoke>
|
|
<j:invoke on="${transformer}" method="setParameter">
|
|
<j:arg value="companyIncName" />
|
|
<j:arg value="${maven.pdf.companyIncName}"/>
|
|
</j:invoke>
|
|
<j:invoke on="${transformer}" method="setParameter">
|
|
<j:arg value="publicationYear" />
|
|
<j:arg value="${maven.pdf.copyrightYear}"/>
|
|
</j:invoke>
|
|
<j:invoke on="${transformer}" method="setParameter">
|
|
<j:arg value="coverProjectCompany" />
|
|
<j:arg value="${maven.pdf.cover.projectCompany}"/>
|
|
</j:invoke>
|
|
<j:invoke on="${transformer}" method="setParameter">
|
|
<j:arg value="coverProjectName" />
|
|
<j:arg value="${maven.pdf.cover.projectName}"/>
|
|
</j:invoke>
|
|
<j:invoke on="${transformer}" method="setParameter">
|
|
<j:arg value="coverType" />
|
|
<j:arg value="${maven.pdf.cover.type}"/>
|
|
</j:invoke>
|
|
<j:invoke on="${transformer}" method="setParameter">
|
|
<j:arg value="coverVersion" />
|
|
<j:arg value="${maven.pdf.cover.version}"/>
|
|
</j:invoke>
|
|
<j:invoke on="${transformer}" method="setParameter">
|
|
<j:arg value="coverDate" />
|
|
<j:arg value="${maven.pdf.cover.date}"/>
|
|
</j:invoke>
|
|
<j:invoke on="${transformer}" method="setParameter">
|
|
<j:arg value="companyLogo" />
|
|
<j:arg value="${maven.pdf.companyLogo}"/>
|
|
</j:invoke>
|
|
<j:invoke on="${transformer}" method="setParameter">
|
|
<j:arg value="projectLogo" />
|
|
<j:arg value="${maven.pdf.projectLogo}"/>
|
|
</j:invoke>
|
|
<j:invoke on="${transformer}" method="setParameter">
|
|
<j:arg value="imageDpi" />
|
|
<j:arg value="${maven.pdf.imageDpi}"/>
|
|
</j:invoke>
|
|
<j:invoke on="${transformer}" method="setParameter">
|
|
<j:arg value="debug" />
|
|
<j:arg value="${maven.pdf.debug}"/>
|
|
</j:invoke>
|
|
|
|
<j:new className="java.io.File" var="sourceFile">
|
|
<j:arg value="${maven.pdf.navigationFilePath}/${maven.pdf.navigationFile}" />
|
|
</j:new>
|
|
<j:new className="javax.xml.transform.stream.StreamSource" var="source">
|
|
<j:arg value="${sourceFile}" />
|
|
</j:new>
|
|
|
|
<j:new className="java.io.File" var="resultFile">
|
|
<j:arg value="${internal_pdf_workingDir}/project.fo" />
|
|
</j:new>
|
|
<j:new className="javax.xml.transform.stream.StreamResult" var="result">
|
|
<j:arg value="${resultFile}" />
|
|
</j:new>
|
|
|
|
<j:invoke on="${transformer}" method="transform">
|
|
<j:arg value="${source}" />
|
|
<j:arg value="${result}" />
|
|
</j:invoke>
|
|
</j:scope>
|
|
|
|
</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> |