<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2015 Red Hat, Inc. and/or its affiliates
~
~ 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="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.kie</groupId>
    <artifactId>kie-docs</artifactId>
    <version>7.4.0.Final</version>
  </parent>

  <artifactId>kie-docs-guides</artifactId>
  <packaging>pom</packaging>

  <name>KIE :: Documentation Guides</name>
  <description>KIE Documentation Guides</description>

  <modules>
    <module>drools-docs</module>
    <module>jbpm-docs</module>
    <module>optaplanner-wb-es-docs</module>
  </modules>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.asciidoctor</groupId>
          <artifactId>asciidoctor-maven-plugin</artifactId>
          <version>1.5.5</version>
          <dependencies>
            <dependency>
              <groupId>org.asciidoctor</groupId>
              <artifactId>asciidoctorj</artifactId>
              <version>1.5.5</version>
            </dependency>
            <dependency>
              <groupId>org.asciidoctor</groupId>
              <artifactId>asciidoctorj-pdf</artifactId>
              <version>1.5.0-alpha.14</version>
            </dependency>
          </dependencies>
          <configuration>
            <imagesDir>.</imagesDir>
            <resources>
              <resource>
                <directory>src/main/asciidoc</directory>
              </resource>
              <resource>
                <directory>${project.basedir}/../shared-kie-docs/src/main/asciidoc</directory>
              </resource>
            </resources>
            <attributes>
              <revnumber>${project.version}</revnumber>
              <!-- Custom attributes -->
              <codeDir>${project.build.directory}/code</codeDir>
              <COMMUNITY-ONLY/>
              <shared-dir>${project.basedir}/../shared-kie-docs/src/main/asciidoc/</shared-dir>
            </attributes>
          </configuration>
          <executions>
            <execution>
              <id>generate-single-html</id>
              <phase>process-sources</phase>
              <goals>
                <goal>process-asciidoc</goal>
              </goals>
              <configuration>
                <!-- Needs to be duplicated to avoid rendering each adoc separately -->
                <sourceDocumentName>index.adoc</sourceDocumentName>
                <backend>html5</backend>
                <sourceHighlighter>highlightjs</sourceHighlighter>
                <outputDirectory>${project.build.directory}/generated-docs/html_single</outputDirectory>
              </configuration>
            </execution>
            <!--
              TODO Enable PDF output when https://github.com/asciidoctor/asciidoctor-maven-plugin/issues/291 is fixed.
              The images are recognized, so it's better than with the maven-resources-plugin hack,
               but there's still a problem for the shared-kie-docs images (not the book specific images).
            -->
            <!--<execution>-->
              <!--<id>generate-pdf</id>-->
              <!--<phase>process-sources</phase>-->
              <!--<goals>-->
                <!--<goal>process-asciidoc</goal>-->
              <!--</goals>-->
              <!--<configuration>-->
                <!--&lt;!&ndash; Needs to be duplicated to avoid rendering each adoc separately &ndash;&gt;-->
                <!--<sourceDocumentName>index.adoc</sourceDocumentName>-->
                <!--<backend>pdf</backend>-->
                <!--<sourceHighlighter>coderay</sourceHighlighter>&lt;!&ndash; highlightjs does not work in PDF &ndash;&gt;-->
                <!--<outputDirectory>${project.build.directory}/generated-docs/pdf</outputDirectory>-->
              <!--</configuration>-->
            <!--</execution>-->
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <executions>
            <execution>
              <id>package-generated-docs</id>
              <phase>package</phase>
              <goals>
                <goal>single</goal>
              </goals>
              <configuration>
                <appendAssemblyId>false</appendAssemblyId>
                <descriptors>
                  <descriptor>src/main/assembly/generated-docs-zip.xml</descriptor>
                </descriptors>
                <archive>
                  <addMavenDescriptor>true</addMavenDescriptor>
                </archive>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

</project>
