git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@232685 13f79535-47bb-0310-9956-ffa450edef68
195 lines
10 KiB
XML
195 lines
10 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" xmlns:doc="doc">
|
|
<goal name="maven-pdf-plugin:register" description="Register the pdf generation during site goal.">
|
|
<doc:registerReport name="PDF" pluginName="maven-pdf-plugin" target="_blank" description="Documentation in PDF format."/>
|
|
</goal>
|
|
<goal name="maven-pdf-plugin:deregister" description="Deregister the pdf generation.">
|
|
<doc:deregisterReport name="PDF"/>
|
|
</goal>
|
|
<goal name="maven-pdf-plugin:report" description="Called by xdoc to execute the pdf goal.">
|
|
<!--
|
|
using a postgoal so that maven generated reports are on place
|
|
(xdoc:generate-from-pom is called after report generation)
|
|
-->
|
|
<postGoal name="site">
|
|
<attainGoal name="pdf"/>
|
|
</postGoal>
|
|
</goal>
|
|
<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}"/>
|
|
<format property="mavenCurrentYear" pattern="yyyy"/>
|
|
</tstamp>
|
|
<j:set var="image" value="${maven.pdf.projectLogo}"/>
|
|
<j:if test="${!image.startsWith('http://') and !image.startsWith('https://')}">
|
|
<j:if test="${image.startsWith('/')}" trim="yes">
|
|
<j:set var="image" value="${image.substring(1)}"/>
|
|
</j:if>
|
|
<j:set var="maven.pdf.projectLogo" value="${image}"/>
|
|
</j:if>
|
|
<j:set var="image" value="${maven.pdf.companyLogo}"/>
|
|
<j:if test="${!image.startsWith('http://') and !image.startsWith('https://')}">
|
|
<j:if test="${image.startsWith('/')}" trim="yes">
|
|
<j:set var="image" value="${image.substring(1)}"/>
|
|
</j:if>
|
|
<j:set var="maven.pdf.companyLogo" value="${image}"/>
|
|
</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:if test="${empty(maven.pdf.copyrightYear)}">
|
|
<j:set var="maven.pdf.copyrightYear">
|
|
<j:if test="${!empty(pom.organization.name)}">
|
|
<j:if test="${!empty(pom.inceptionYear)}">
|
|
<j:if test="${pom.inceptionYear == mavenCurrentYear}">${mavenCurrentYear}</j:if>
|
|
<j:if test="${pom.inceptionYear != mavenCurrentYear}">${pom.inceptionYear}-${mavenCurrentYear}</j:if>
|
|
</j:if>
|
|
<j:if test="${empty(pom.inceptionYear)}">${mavenCurrentYear}</j:if>
|
|
</j:if>
|
|
</j:set>
|
|
</j:if>
|
|
<xslt in="${maven.pdf.navigationFilePath}/${maven.pdf.navigationFile}" 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}"/>
|
|
</xslt>
|
|
</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>
|
|
<taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop">
|
|
<classpath>
|
|
<pathelement location="${plugin.getDependencyPath('fop')}"/>
|
|
<pathelement location="${plugin.getDependencyPath('batik')}"/>
|
|
<pathelement location="${plugin.getDependencyPath('avalon-framework')}"/>
|
|
<pathelement location="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.jar.jimi')}"/>
|
|
<pathelement location="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.jar.jaicore')}"/>
|
|
<pathelement location="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.jar.jaicodec')}"/>
|
|
</classpath>
|
|
</taskdef>
|
|
<fop>
|
|
<ant:setProperty name="basedir" value="${internal_pdf_workingDir}"/>
|
|
<ant:setProperty name="userconfig" value="${internal_pdf_workingDir}/userconfig.xml"/>
|
|
<ant:setProperty name="messagelevel" value="info"/>
|
|
<if test="${maven.pdf.debug}">
|
|
<ant:setProperty name="messagelevel" value="debug"/>
|
|
</if>
|
|
<ant:setProperty name="fofile" value="${internal_pdf_workingDir}/project.fo"/>
|
|
<ant:setProperty name="outfile" value="${internal_pdf_workingDir}/${maven.pdf.pdfName}"/>
|
|
</fop>
|
|
<copy todir="${maven.xdoc.dest}" file="${internal_pdf_workingDir}/${maven.pdf.pdfName}"/>
|
|
</goal>
|
|
</project>
|