<?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.0.10</version>
  </parent>
  <artifactId>exo.platform.doc.bundle</artifactId>
  <packaging>war</packaging>
  <name>eXo Platform - Docs bundle as WAR</name>
  <profiles>
    <profile>
      <id>distrib</id>
      <dependencies>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>exo.platform.doc.admin</artifactId>
          <version>${project.version}</version>
          <type>zip</type>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>exo.platform.doc.developer</artifactId>
          <version>${project.version}</version>
          <type>zip</type>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>exo.platform.doc.refguide</artifactId>
          <version>${project.version}</version>
          <type>zip</type>
        </dependency>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>exo.platform.doc.user</artifactId>
          <version>${project.version}</version>
          <type>zip</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>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>extract-dependencies</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <target>
                    <dependencyfilesets prefix="prjdeps." />
                    <mkdir dir="${project.build.directory}/work/admin" />
                    <unzip dest="${project.build.directory}/work/admin">
                      <fileset refid="prjdeps.${project.groupId}:exo.platform.doc.admin:zip" />
                    </unzip>
                    <mkdir dir="${project.build.directory}/work/developer" />
                    <unzip dest="${project.build.directory}/work/developer">
                      <fileset refid="prjdeps.${project.groupId}:exo.platform.doc.developer:zip" />
                    </unzip>
                    <mkdir dir="${project.build.directory}/work/refguide" />
                    <unzip dest="${project.build.directory}/work/refguide">
                      <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" />
                    <unzip dest="${project.build.directory}/work/user">
                      <fileset refid="prjdeps.${project.groupId}:exo.platform.doc.user:zip" />
                    </unzip>
                  </target>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <!-- PLF-986: bundle the WCM user guide in docbook -->
		  <plugin>
		    <groupId>org.apache.maven.plugins</groupId>
		    <artifactId>maven-dependency-plugin</artifactId>
		    <executions>
		      <execution>
		        <id>copy</id>
		        <phase>prepare-package</phase>
		        <goals>
		          <goal>copy</goal>
		        </goals>
		        <configuration>
		          <artifactItems>
		            <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</outputDirectory>
		              <destFileName>eXo-Content-User-Guide.pdf</destFileName>
                      <!-- overwrites the original one -->
		              <overWrite>true</overWrite>
		            </artifactItem>
		          </artifactItems>
		        </configuration>
		      </execution>
		    </executions>
		  </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
              <webResources>
                <resource>
                  <directory>${project.build.directory}/work</directory>
                </resource>
              </webResources>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
