<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ JBoss, Home of Professional Open Source
  ~ Copyright 2012 Red Hat Inc. and/or its affiliates and other
  ~ contributors as indicated by the @author tags. All rights reserved.
  ~ See the copyright.txt in the distribution for a full listing of
  ~ individual contributors.
  ~
  ~ 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/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>

   <parent>
      <groupId>org.infinispan</groupId>
      <artifactId>infinispan-parent</artifactId>
      <version>5.1.3.ER6-redhat-1</version>
      <relativePath>parent/pom.xml</relativePath>
   </parent>

   <groupId>org.infinispan</groupId>
   <artifactId>infinispan</artifactId>

   <name>Infinispan Distribution</name>
   <description>Builds the complete Infinispan distribution bundles</description>
   <packaging>pom</packaging>

   <modules>
      <module>parent</module>
      <module>core</module>
      <module>tools</module>
      <module>cachestore</module>
      <module>cachestore/jdbc</module>
      <module>cachestore/remote</module>
      <module>server</module>
      <module>server/core</module>
      <module>server/memcached</module>
      <module>server/hotrod</module>
      <module>server/rest</module>
      <module>client/hotrod-client</module>
      <module>rhq-plugin</module>
   </modules>

   <profiles>
      <profile>
         <id>distribution</id>
         <activation>
            <activeByDefault>false</activeByDefault>
         </activation>
         <properties>
            <maven.test.skip.exec>true</maven.test.skip.exec>
         </properties>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-javadoc-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>javadoc</id>
                        <phase>prepare-package</phase>
                        <goals>
                           <goal>aggregate-jar</goal>
                        </goals>
                        <configuration>
                           <quiet>true</quiet>
                           
                           <!-- In case you anyone needs to trace javadoc issues
                           <additionalJOption>-J-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y</additionalJOption>
                           -->
                           <stylesheetfile>${basedir}/src/javadoc/stylesheet.css</stylesheetfile>
                           <javadocDirectory>${basedir}/src/javadoc</javadocDirectory>
                           <docfilessubdirs>true</docfilessubdirs>
                           <links>
                              <link>http://java.sun.com/javase/6/docs/api/</link>
                              <link>http://java.sun.com/javaee/5/docs/api/</link>
                           </links>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-jar-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>build-test-jar</id>
                        <phase>none</phase>
                     </execution>
                  </executions>
               </plugin>
            </plugins>
         </build>
      </profile>

      <!-- This profile is an scaled down version of the distribution profile which should only be used to speed up
      testing of distribution zip files. It doesn't generate any documentation and only generates the -all.zip distribution -->
      <profile>
         <id>minimal-distribution</id>
         <activation>
            <activeByDefault>false</activeByDefault>
         </activation>
         <properties>
            <maven.test.skip.exec>true</maven.test.skip.exec>
         </properties>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-jar-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>build-test-jar</id>
                        <phase>none</phase>
                     </execution>
                  </executions>
               </plugin>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-assembly-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>assemble</id>
                        <phase>package</phase>
                        <goals>
                           <goal>single</goal>
                        </goals>
                     </execution>
                  </executions>
                  <configuration>
                     <descriptors>
                        <descriptor>src/main/resources/assemblies/all.xml</descriptor>
                     </descriptors>
                     <finalName>${project.artifactId}-${project.version}</finalName>
                     <outputDirectory>${buildDirectory}/distribution</outputDirectory>
                     <workDirectory>${buildDirectory}/assembly/work</workDirectory>
                  </configuration>
               </plugin>
            </plugins>
         </build>
      </profile>

      <!-- TODO somehow combine this with the 'distribution' profile so all docs are built together -->
      <profile>
         <id>jmxdoc</id>
         <activation>
            <activeByDefault>false</activeByDefault>
         </activation>
         <properties>
            <maven.test.skip.exec>true</maven.test.skip.exec>
         </properties>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-javadoc-plugin</artifactId>
                  <configuration>
                     <doclet>org.infinispan.tools.doclet.jmx.JmxDoclet</doclet>
                     <docletArtifact>
                        <groupId>org.infinispan</groupId>
                        <artifactId>infinispan-tools</artifactId>
                        <version>${project.version}</version>
                     </docletArtifact>
                     <footer><![CDATA[
                <!-- Google Analytics -->
<script type='text/javascript'>
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type='text/javascript'>
try {
var pageTracker = _gat._getTracker("UA-8601422-4");
pageTracker._trackPageview();
} catch(err) {}</script>
               ]]></footer>
                  </configuration>
                  <executions>
                     <execution>
                        <id>javadoc</id>
                        <phase>package</phase>
                        <goals>
                           <goal>aggregate</goal>
                        </goals>
                     </execution>
                  </executions>
               </plugin>
            </plugins>
         </build>
      </profile>

      <!-- TODO somehow combine this with the 'distribution' profile so all docs are built together -->
      <profile>
         <id>configdoc</id>
         <activation>
            <activeByDefault>false</activeByDefault>
         </activation>
         <properties>
            <maven.test.skip.exec>true</maven.test.skip.exec>
         </properties>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-javadoc-plugin</artifactId>
                  <configuration>
                     <doclet>org.infinispan.tools.doclet.config.ConfigDoclet</doclet>
                     <!-- To debug config generation, simply uncomment this line
                     and when the build hangs in the config generation while
                     building the distribution, add a remote debugger for port 8000.

                     <additionalJOption>-J-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y</additionalJOption>

                     -->
                     <docletArtifact>
                        <groupId>org.infinispan</groupId>
                        <artifactId>infinispan-tools</artifactId>
                        <version>${project.version}</version>
                     </docletArtifact>
                     <footer><![CDATA[
                <!-- Google Analytics -->
<script type='text/javascript'>
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type='text/javascript'>
try {
var pageTracker = _gat._getTracker("UA-8601422-4");
pageTracker._trackPageview();
} catch(err) {}</script>
               ]]></footer>
                  </configuration>
                  <executions>
                     <execution>
                        <id>javadoc</id>
                        <phase>package</phase>
                        <goals>
                           <goal>aggregate</goal>
                        </goals>
                     </execution>
                  </executions>
               </plugin>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-antrun-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>copy_css</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                           <goal>run</goal>
                        </goals>
                        <configuration>
                           <tasks>
                              <copy file="tools/src/main/resources/stylesheet2.css" todir="${buildDirectory}/site/apidocs"/>
                           </tasks>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
            </plugins>
         </build>
      </profile>
      
      <profile>
         <id>source-distribution</id>
         <activation>
            <activeByDefault>false</activeByDefault>
         </activation>
         <properties>
            <maven.test.skip.exec>true</maven.test.skip.exec>
         </properties>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-jar-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>build-test-jar</id>
                        <phase>none</phase>
                     </execution>
                  </executions>
               </plugin>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-assembly-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>assemble</id>
                        <phase>package</phase>
                        <goals>
                           <goal>single</goal>
                        </goals>
                     </execution>
                  </executions>
                  <configuration>
                     <descriptors>
                        <descriptor>src/main/resources/assemblies/src.xml</descriptor>
                     </descriptors>
                     <finalName>${project.artifactId}-${project.version}</finalName>
                     <outputDirectory>${buildDirectory}/distribution</outputDirectory>
                     <workDirectory>${buildDirectory}/assembly/work</workDirectory>
                  </configuration>
               </plugin>
            </plugins>
         </build>
      </profile>


   </profiles>
</project>
