<?xml version="1.0" encoding="UTF-8"?>
<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.exoplatform.platform</groupId>
    <artifactId>exo.platform.doc</artifactId>
    <version>3.5.0-Beta2</version>
  </parent>
  <artifactId>exo.platform.doc.bundle</artifactId>
  <packaging>pom</packaging>
  <name>eXo Platform - Docs package</name>
  <profiles>
    <profile>
      <id>distrib</id>
      <dependencies>
        <!-- Admin guide -->
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>exo.platform.doc.admin</artifactId>
          <version>${project.version}</version>
          <type>zip</type>
        </dependency>
        <!-- Dev guide -->
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>exo.platform.doc.developer</artifactId>
          <version>${project.version}</version>
          <type>zip</type>
        </dependency>
        <!-- Ref guide -->
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>exo.platform.doc.refguide</artifactId>
          <version>${project.version}</version>
          <type>zip</type>
        </dependency>
        <!-- GateIn user guide -->
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>exo.platform.doc.user.gatein</artifactId>
          <version>${project.version}</version>
          <type>zip</type>
        </dependency>
        <!-- Social user guide -->
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>exo.platform.doc.user.social</artifactId>
          <version>${project.version}</version>
          <type>pdf</type>
        </dependency>
        <!-- Collaboration user guide -->
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>exo.platform.doc.user.collaboration</artifactId>
          <version>${project.version}</version>
          <type>pdf</type>
        </dependency>
        <!-- Knowledge user guide -->
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>exo.platform.doc.user.knowledge</artifactId>
          <version>${project.version}</version>
          <type>pdf</type>
        </dependency>
        <!--dependency>
          <groupId>org.gatein.doc</groupId>
          <artifactId>gatein-reference-guide-en</artifactId>
          <version>${org.exoplatform.portal.version}</version>
          <type>jdocbook</type>
        </dependency>
        <dependency>
          <groupId>org.exoplatform.jcr</groupId>
          <artifactId>reference-docs-en</artifactId>
          <version>${org.exoplatform.jcr.version}</version>
          <type>jdocbook</type>
        </dependency-->
      </dependencies>
      <build>
        <finalName>eXo-Platform-docs-${project.version}</finalName>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>01-extract-dependencies</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <target>
                    <dependencyfilesets prefix="prjdeps." />
                    <mkdir dir="${project.build.directory}/work/admin-guide" />
                    <unzip dest="${project.build.directory}/work/admin-guide">
                      <fileset refid="prjdeps.${project.groupId}:exo.platform.doc.admin:zip" />
                    </unzip>
                    <mkdir dir="${project.build.directory}/work/developer-guide" />
                    <unzip dest="${project.build.directory}/work/developer-guide">
                      <fileset refid="prjdeps.${project.groupId}:exo.platform.doc.developer:zip" />
                    </unzip>
                    <mkdir dir="${project.build.directory}/work/reference" />
                    <unzip dest="${project.build.directory}/work/reference">
                      <fileset refid="prjdeps.${project.groupId}:exo.platform.doc.refguide:zip" />
                    </unzip>
                    <!--mkdir dir="${project.build.directory}/work/refguide/html/gatein" />
                    <unzip dest="${project.build.directory}/work/refguide/html/gatein">
                      <fileset refid="prjdeps.org.gatein.doc:gatein-reference-guide-en:jdocbook" />
                      <patternset>
                        <include name="html/" />
                      </patternset>
                      <mapper type="regexp" from="^html/(.*)$" to="\1" />
                    </unzip>
                    <mkdir dir="${project.build.directory}/work/refguide/html/jcr" />
                    <unzip dest="${project.build.directory}/work/refguide/html/jcr">
                      <fileset refid="prjdeps.org.exoplatform.jcr:reference-docs-en:jdocbook" />
                      <patternset>
                        <include name="html/" />
                      </patternset>
                      <mapper type="regexp" from="^html/(.*)$" to="\1" />
                    </unzip-->
                    <mkdir dir="${project.build.directory}/work/user-guide" />
                    <unzip dest="${project.build.directory}/work/user-guide">
                      <fileset refid="prjdeps.${project.groupId}:exo.platform.doc.user.gatein:zip" />
                    </unzip>
                  </target>
                </configuration>
              </execution>
            </executions>
          </plugin>
		  <plugin>
		    <groupId>org.apache.maven.plugins</groupId>
		    <artifactId>maven-dependency-plugin</artifactId>
		    <executions>
		      <execution>
		        <id>02-copy</id>
		        <phase>prepare-package</phase>
		        <goals>
		          <goal>copy</goal>
		        </goals>
		        <configuration>
		          <artifactItems>
          <!-- PLF-986: bundle the WCM user guide in docbook -->
		            <artifactItem>
		              <groupId>org.exoplatform.ecms</groupId>
		              <artifactId>exo-ecms-docs-userguide</artifactId>
		              <version>${org.exoplatform.ecms.version}</version>
		              <type>pdf</type>
		              <outputDirectory>${project.build.directory}/work/user-guide</outputDirectory>
		              <destFileName>eXo-Content-User-Guide.pdf</destFileName>
                      <!-- overwrites the original one -->
		              <!--overWrite>true</overWrite-->
		            </artifactItem>
          <!-- PLF-1721: bundle the Social, Collaboration and Knowledge user guides in wikbook -->
                    <artifactItem>
		              <groupId>org.exoplatform.platform</groupId>
		              <artifactId>exo.platform.doc.user.social</artifactId>
		              <version>${project.version}</version>
		              <type>pdf</type>
		              <outputDirectory>${project.build.directory}/work/user-guide</outputDirectory>
		              <destFileName>eXo-Social-User-Guide.pdf</destFileName>
                      <!-- overwrites the original one -->
		              <!--overWrite>true</overWrite-->
		            </artifactItem>
                    <artifactItem>
		              <groupId>org.exoplatform.platform</groupId>
		              <artifactId>exo.platform.doc.user.collaboration</artifactId>
		              <version>${project.version}</version>
		              <type>pdf</type>
		              <outputDirectory>${project.build.directory}/work/user-guide</outputDirectory>
		              <destFileName>eXo-Collaboration-User-Guide.pdf</destFileName>
                      <!-- overwrites the original one -->
		              <!--overWrite>true</overWrite-->
		            </artifactItem>
                    <artifactItem>
		              <groupId>org.exoplatform.platform</groupId>
		              <artifactId>exo.platform.doc.user.knowledge</artifactId>
		              <version>${project.version}</version>
		              <type>pdf</type>
		              <outputDirectory>${project.build.directory}/work/user-guide</outputDirectory>
		              <destFileName>eXo-Knowledge-User-Guide.pdf</destFileName>
                      <!-- overwrites the original one -->
		              <!--overWrite>true</overWrite-->
		            </artifactItem>
		          </artifactItems>
		        </configuration>
		      </execution>
		    </executions>
		  </plugin>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <id>03-package</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <descriptors>
                    <descriptor>src/main/assembly/docs-archive.xml</descriptor>
                  </descriptors>
                  <appendAssemblyId>false</appendAssemblyId>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
