<!--

    Copyright (C) 2009 eXo Platform SAS.
    
    This is free software; you can redistribute it and/or modify it
    under the terms of the GNU Lesser General Public License as
    published by the Free Software Foundation; either version 2.1 of
    the License, or (at your option) any later version.
    
    This software is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    Lesser General Public License for more details.
    
    You should have received a copy of the GNU Lesser General Public
    License along with this software; if not, write to the Free
    Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
    02110-1301 USA, or see the FSF site: http://www.fsf.org.

-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>

   <parent>
      <groupId>org.exoplatform.portal</groupId>
      <artifactId>exo.portal.parent</artifactId>
      <version>3.2.6-PLF</version>
   </parent>
   
   <groupId>org.gatein.doc</groupId>
   <artifactId>docs-aggregator</artifactId>
   <packaging>pom</packaging>
   <name>GateIn - Portal (docs-aggregator)</name>

<profiles>
  <profile>
    <id>doc</id>
    <activation>
      <property>
        <name>!gatein.dev</name>
      </property>
    </activation>	
	<modules>
		<module>user-guide</module>
		<module>reference-guide</module>
	</modules>
     
	<properties>
		<docbook.source>${project.build.directory}/docbook-src</docbook.source>
		<translation>en-US</translation>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.exoplatform.doc</groupId>
			<artifactId>doc-style</artifactId>
			<version>1.0.8-CR01</version>
			<type>jar</type>
		</dependency>
	</dependencies>

   <build>
        <plugins>
            <plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<version>2.4.3</version>
				<executions>
				  <!--
					 1a) Copy the images to the Docbook sources directory
				  -->
				  <execution>
					<id>c-copy-images</id>
					<phase>generate-sources</phase>
					<goals>
					  <goal>copy-resources</goal>
					</goals>
					<configuration>
					  <outputDirectory>${docbook.source}</outputDirectory>
					  <resources>
						<resource>
						  <directory>en/images</directory>
						  <excludes>
						   <exclude>modules/**</exclude>
						  </excludes>
						</resource>
					  </resources>
					</configuration>
				  </execution>
				  <!--
					 1b) Copy content to the Docbook sources directory
		          -->
				  <execution>
					<id>d-copy-docbksource</id>
					<phase>generate-sources</phase>
					<goals>
					  <goal>copy-resources</goal>
					</goals>
					<configuration>
					  <outputDirectory>${docbook.source}</outputDirectory>
					  <resources>
						<resource>
						  <directory>en</directory>
						</resource>
					  </resources>
					</configuration>
				  </execution>
				</executions>
			</plugin>

			<!-- 
				2) Unpack the Common style resources 
			-->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>2.1</version>
				<executions>
				  <execution>
					<id>a-unpack</id>
					<phase>generate-sources</phase>
					<goals>
					   <goal>unpack</goal>
					</goals>
					<configuration>
						<artifactItems>
							<artifactItem>
							  <groupId>org.exoplatform.doc</groupId>
							  <artifactId>doc-style</artifactId>
							  <version>${doc-style.version}</version>
							  <outputDirectory>${docbook.source}</outputDirectory>
							  <includes>**</includes>
							  <excludes>META-INF/**</excludes>
							</artifactItem>
						</artifactItems>
					</configuration>
				  </execution>
				</executions>
			</plugin>

			<!--
				3) Process all the XML files to generate HTML and PDF formats
			-->
			<plugin>
				<groupId>org.jboss.maven.plugins</groupId>
				<artifactId>maven-jdocbook-plugin</artifactId>
				<version>2.1.1</version>
				<extensions>true</extensions>
				<dependencies>
					<dependency>
						<groupId>org.exoplatform.doc</groupId>
						<artifactId>exo-docbook-xslt</artifactId>
						<version>1</version>
					</dependency>
				</dependencies>
				<executions>
					<execution>
						<id>e-jdocbook-resources</id>
						<phase>process-resources</phase>
						<goals>
							<goal>resources</goal>
						</goals>
					</execution>
					<execution>
						<id>f-generate-docs</id>
						<goals>
							<goal>generate</goal>
						</goals>
						<phase>compile</phase>
					</execution>
				</executions>
				<configuration>
					<sourceDirectory>${docbook.source}</sourceDirectory>
					<sourceDocumentName>master.xml</sourceDocumentName>
					<imageResource>
					  <directory>${docbook.source}</directory>
					  <includes>
						 <include>images/**</include>
						 <include>background/**</include>
					  </includes>
					</imageResource>
					<cssResource>
					  <directory>${docbook.source}</directory>
					  <includes>
						 <include>css/**</include>
					  </includes>
					</cssResource>
					<formats>
					  <format>
						<formatName>html</formatName>
						<stylesheetResource>file:${docbook.source}/xsl/xhtml.xsl</stylesheetResource>
						<finalName>index.html</finalName>
					  </format>
					  <format>
						<formatName>pdf</formatName>
						<stylesheetResource>file:${docbook.source}/xsl/pdf.xsl</stylesheetResource>
						<finalName>${project.artifactId}-${project.version}.pdf</finalName>
					  </format>
					</formats>
					<options>
					  <xincludeSupported>true</xincludeSupported>
					  <xmlTransformerType>saxon</xmlTransformerType>
					  <docbookVersion>1.76.1</docbookVersion>
					</options>
				</configuration>
			</plugin>
        </plugins>
    </build>
</profile>
</profiles>
</project>
